Jump to content

[+] Cerere Tutorial - PremiumPoints


Recommended Posts

Daca vrei sa ai sistem de premium points va trebui sa ai si un shop pentru a le folosi.

 Pentru a salva PP-urile playerului adaugi inca un camp la enum si-l denumesti pPremiumPoints, creezi o coloana noua in rubrica users din baza de date (asta doar daca folosesti) si la fiecare logare iei valoarea din baza de date a respectivului jucator si i-o atribui in variabila PlayerInfo[playerid][pPremiumPoints], respectiv la fiecare deconectare introduci in baza de date numarul de PP uri ale jucatorului x.

 Apoi faci ceva shop in care sa folosesti punctele:

CMD:ppshop(playerid, params[]) {
	// verificarile tale daca-i ON .. stiu eu ce mai folosesti

	ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "SHOP", "1.000.000 $\t100 PP\n100.000$\t 50 PP", "Cumpara", "Iesi");  
	return 0;

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
	if(dialogid == DIALOG_SHOP) {
		if(!response) return 1;
		if(listitem == 0) {
			if(PlayerInfo[playerid][pPremiumPoints] < 100) return SCM(playerid, -1, "Nu ai destule PP)";
            PlayerInfo[playerid][pPremiumPoints] -= 100; // tot una cu x = x - 100 (x-=100)
            GivePlayerMoney(playerid, 1000000);
            new Query[256];
			mysql_format(Query, sizeof(Query), "UPDATE `users` SET `Premiumpoints`='%d' WHERE `Name`='%s'", PlayerInfo[playerid][pPremiumPoints], GetName(playerid));
            mysql_tquery(SQL, Query, "", "");  // asta e toata partea de salvare

	return 1;



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.