Jump to content
  • 0

GM edwick /collect



Salut, cand dau collect la reward care se numeste Reward System Nu are cooldown, cand dau /collect, pot sa dau de multe ori...


YCMD:collect(playerid, params[], help) {
    new castig = random(61);
    switch(castig) {
        case 0..30: {
            new money = 500000 + random(1000000);
            GivePlayerCash(playerid, -1, money);
            SCMf(playerid, COLOR_RED, "Ai castigat $%s.", FormatNumber(money));
        case 31..37: {
            new rp = 2 + random(5);
            PlayerInfo[playerid][pExp] += rp; UpdateVar(playerid, "Drugs", PlayerInfo[playerid][pDrugs]);
            SCMf(playerid, COLOR_RED, "Ai castigat %d droguri.", rp);
        case 38..43: {
            PlayerInfo[playerid][pHidden] ++; UpdateVar(playerid, "Hidden", PlayerInfo[playerid][pHidden]);
            SCM(playerid, COLOR_RED, "Ai castigat o culoare hidden.");
            va_SendClientMessageToAll(COLOR_RED, "(( Reward: %s a castigat o culoare hidden. Felicitari! ))", GetName(playerid));
        case 44..47: {
            new pp = 5 + random(15);
            PlayerInfo[playerid][pPremiumPoints] += pp; UpdateVar(playerid, "PremiumPoints", PlayerInfo[playerid][pPremiumPoints]);
            GameTextForPlayer(playerid, "~r~ROLLING...", 5000, 3);
            SCMf(playerid, COLOR_RED, "Ai castigat %d premium points. Felicitari!", pp);
            va_SendClientMessageToAll(COLOR_RED, "((Reward: %s a castigat %d puncte premium. Felicitari! ))", GetName(playerid), pp);
        case 48..55: {
            new gems = 10 + random(20);
            PlayerInfo[playerid][pPremiumPoints] += gems; UpdateVar(playerid, "PremiumPoints", PlayerInfo[playerid][pPremiumPoints]);
            SCMf(playerid, COLOR_RED, "Reward: %s a castigat %d puncte premium. Felicitari!", GetName(playerid), gems);
        case 56..59: {
            PlayerInfo[playerid][pVoucher] ++; UpdateVar(playerid, "Voucher", PlayerInfo[playerid][pVoucher]);
            SCM(playerid, COLOR_RED, "Ai castigat un Legendary Voucher. Felicitari!");
            va_SendClientMessageToAll(COLOR_RED, "(( Reward: %s a castigat un Legendary Voucher. Felicitari! ))", GetName(playerid));
        case 60..61: {
            new money = 500000 + random(1000000);
            GivePlayerCash(playerid, -1, money);
            SCMf(playerid, COLOR_RED, "Ai castigat $%s.", FormatNumber(money));
     return true;


Ma ajuta cineva?


🔥Daca ii dai cuiva a doua sansa, e ca si cum i-ai oferi un glont la pistol ca sa te nimereasca.🔥

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0


Ai nevoie de o variabila de genul, plasata pe la inceputul gamemodeului

new CooldownCollect[MAX_PLAYERS];

Apoi la inceputul comenzii tale inaitne de new castig, o sa adaugi un if

if(CooldownCollect[playerid] > 0) return SendClientMessage(playerid,-1,"Ai luat deja cadoul");

Iar la finalul comenzii tale inainte de return true; o sa setezi aceasta variabila in 120 sau cate secunde vrei sa astepte pana o poate folosi iar

CooldownCollect[playerid] = 120;

Mai ai nevoie de un timer de o secunda sau minute depinde cat de exact si cat de mult vrei dureze, unde o sa adaugi decrementarea variabilei intr un for sau foreach al jucatorilor 

if(CooldownCollect[i]> 0) CooldownCollect[i] --;

Dar totul va fi local fara baza de date si nu va ramane salvat, daca vrei sa ramana salvat va trebuie sa creezi in baza de date variabila iar apoi sa faci incarcarea si salvarea acesteia ceea ce este unpic mai complicat.


    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
Pagina     Scripting     pawn
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.

Answer this question...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • 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.