Jump to content

Creare Sistem /getgift


TigeR

Recommended Posts

#define pGiftx   

    pGiftx - este pentru a se updata in baza de date .

La enum PlayerInfo  sau cum ai tu adaugi si acolo

{

pGift

}

 

dupa care mergi la Public Update

si adaugi :

 

                case pGiftx:
                {
                    mysql_format(SQL, var, sizeof(var), "UPDATE `users` SET `Gift`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pGift], PlayerInfo[playerid][pNormalName]);
                    mysql_tquery(SQL,var,"","");
                }

la public PayDay bagi :

                    PlayerInfo[pGift] += 1;
                    Update(i, pGiftx); 

 

dupa care incepi sa scrii comanda :

CMD:getgift(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first."); // Verifica daca-i logat
    if(PlayerInfo[playerid][pGift] == 0) return SendClientMessage(playerid, COLOR_WHITE, "Ai nevoie de minim 1 Gift Point pentru a putea folosi comanda."); // Iii trimite un mesaj daca nu are giftpoints

    new gString[512];
    new szMessage[256];//s-ar putea sa nu ai voie daca nu ai si SCM
    switch(random(2)) // Aici e facut sa iti deie randem din cele 2 case-uri tu poti adauga case 3 case 4 etc.. si pentru fiecare case nou modifici in switch(random(3)) switch(random(4))  sau cate ai.
     {
        case 0:
        {
            new rp = 5;// Aici poti baga sa-i adauge cat rp vrei tu eu am pus 5
            SendClientMessage(playerid, COLOR_WHITE, "Ai castigat 5 Respect Points de la giftbox.");// castiga 5 Respect points
            PlayerInfo[playerid][pGift] -= 1;
            Update(playerid, pGiftx);
            PlayerInfo[playerid][pExp] += rp;
            Update(playerid, pRP);
            GameTextForPlayer(playerid, "~g~5 Respect Points!", 5000, 1);
        }
        case 1:
        {
            new cash = 100000 + random(200000); // Castiga o suma de bani 100.000 $ + random din suma de 200.000 $
            format(gString,sizeof(gString),"* You received $%s.",FormatNumber(cash)); // aici il scrie
            SendClientMessage(playerid, COLOR_SYN, gString);//aici afiseaza mesajul
            PlayerInfo[playerid][pGift] -= 1;
            Update(playerid, pGiftx);
            GivePlayerCash(playerid, cash);
            GameTextForPlayer(playerid, "~g~100.000 - 300.000$!", 5000, 1);
        }

    }
    return 1;
} 

 

Acest sistem este facut de mine sa stii pentru tine sa te ajut ti-am mai scris pe acolo sa mai intalegi si etc.

Este scris de la 0. :* Bafta in continuare !1

Edited by CheaTer
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.

Guest
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.