CMD like /gamble
#1

I have this cmd :
pawn Код:
new gamble;
pawn Код:
COMMAND:gamble(playerid,params[])
{
    switch(gamble)
    {
        case 0:
        {
            new PlayerName[MAX_PLAYER_NAME];
            GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
            new string[256];
            format(string, sizeof(string), "You have win Deagle with 33 ammo !");
            SendClientMessage(playerid, COLOR_GREEN,string);
            format(string, sizeof(string), "{FF0066}[Lucky Gamble^^]%s have win Deagle with 33 ammo !",PlayerName);
            SendClientMessage(playerid, COLOR_GREEN,string);
            GivePlayerWeapon(playerid, 24, 33);
            //SetTimer("NeedToWait",30000,true);
        }
        case 1:
        {
            new PlayerName[MAX_PLAYER_NAME];
            GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
            new string[256];
            format(string, sizeof(string), "You have win Sniper with 147 ammo !");
            SendClientMessage(playerid, COLOR_GREEN,string);
            format(string, sizeof(string), "{FF0066}[Lucky Gamble^^]%s have win Sniper with 147 ammo !",PlayerName);
            SendClientMessage(playerid, COLOR_GREEN,string);
            GivePlayerWeapon(playerid, 34, 147);
            //SetTimer("NeedToWait",30000,true);
        }
        case 2:
        {
            new PlayerName[MAX_PLAYER_NAME];
            GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
            new string[256];
            format(string, sizeof(string), "You have lose 10 000$ !");
            SendClientMessage(playerid, COLOR_GREEN,string);
            format(string, sizeof(string), "{FF0000}[UnLucky Gamble O.o]%s have lose 10 000$ !",PlayerName);
            SendClientMessage(playerid, COLOR_GREEN,string);
            GivePlayerMoney(playerid, -10000);
            //SetTimer("NeedToWait",30000,true);
        }
    }
    return gamble;
}
When i make /gamble, then i win only desert . How i can make that, like i can win something else too ? And i want to make that, like if you use /gamble, then you need to wait 30 secs to gamble again, how to make that !
Reply
#2

pawn Код:
new NeedToWait[MAX_PLAYERS];//Top of your script

COMMAND:gamble(playerid,params[])
{
    if(GetTickCount() - NeedToWait[playerid] <  30000) return SendClientMessage(playerid,COLOR_GREEN,"You can only use this command every 30 seconds !");
    new rand = random(3);
    new PlayerName[MAX_PLAYER_NAME], string[128];
    GetPlayerName(playerid,PlayerName,sizeof(PlayerName));
    if(!rand)
    {
        switch(gamble)
        {
            case 0:
            {
                format(string, sizeof(string), "You have win Deagle with 33 ammo !");
                SendClientMessage(playerid, COLOR_GREEN,string);
                format(string, sizeof(string), "{FF0066}[Lucky Gamble^^]%s have win Deagle with 33 ammo !",PlayerName);
                SendClientMessage(playerid, COLOR_GREEN,string);
                GivePlayerWeapon(playerid, 24, 33);
                //SetTimer("NeedToWait",30000,true);
            }
            case 1:
            {
                format(string, sizeof(string), "You have win Sniper with 147 ammo !");
                SendClientMessage(playerid, COLOR_GREEN,string);
                format(string, sizeof(string), "{FF0066}[Lucky Gamble^^]%s have win Sniper with 147 ammo !",PlayerName);
                SendClientMessage(playerid, COLOR_GREEN,string);
                GivePlayerWeapon(playerid, 34, 147);
                //SetTimer("NeedToWait",30000,true);
            }
            case 2:
            {
                format(string, sizeof(string), "You have lose 10 000$ !");
                SendClientMessage(playerid, COLOR_GREEN,string);
                format(string, sizeof(string), "{FF0000}[UnLucky Gamble O.o]%s have lose 10 000$ !",PlayerName);
                SendClientMessage(playerid, COLOR_GREEN,string);
                GivePlayerMoney(playerid, -10000);
                //SetTimer("NeedToWait",30000,true);
            }
        }
    }
    return gamble;
}
Reply
#3

That, like i cant make again that in 30 sec, its dont send that, like i need to be wait 30 sec and the other thing dont work :S
Reply
#4

Sorry add this right under GetTickCount line

pawn Код:
NeedToWait[playerid] = GetTickCount();
Reply
#5

nope, not working !
Reply
#6

*** BUMB ***
Reply
#7

ok, its working now. All things, i make my version !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)