my system only for id 0?
#1

Only id 0 can gamble, when a higher ID try's to gamble it will say: you can only gamble once in the 30 seconds. :S

pawn Код:
dcmd_gamble(playerid, params[])
{
    #pragma unused params
    new string[128];
    if((allowgamble[playerid] == 1) && UserUD[playerid][cookies] > 50)
    {
    switch(random(9))
    {
    case 0:format(string, sizeof(string), "[GAMBLE] %s(id: %d) has gambled 5 cookies. Reward: $2000", UserUD[playerid][accname],playerid);
    }
  SendClientMessageToAll(rankupdate, string);
  allowgamble[playerid] = 0;
  SetTimerEx("gambleon", 30000, false, "i", playerid);
    }
    else if(allowgamble[playerid] == 0)
    {
    SendClientMessage(playerid,red,"Error: You can only gamble once in the 30 seconds!");
    }
    else
    {
    SendClientMessage(playerid,red,"Error: You need to have atleast 50 cookies to gamble!");
    }
    return 1;
}


public gambleon(playerid)
{
  allowgamble[playerid] = 1;
    return 1;
}
Reply
#2

Do you have allowgamble[playerid] = 1; at OnPlayerConnect? Also this code looks better
What will happen if the random is not 0? it will print nothing and you will have to wait 30secs for nothing lol. Also now you cant get the cash...
pawn Код:
dcmd_gamble(playerid, params[])
{
    #pragma unused params
    if(allowgamble[playerid] == 0) return SendClientMessage(playerid,red,"Error: You can only gamble once in the 30 seconds!");
    if(UserUD[playerid][cookies] < 50) return SendClientMessage(playerid,red,"Error: You need to have atleast 50 cookies to gamble!");
    new string[128];
    switch(random(9))
    {
        case 0:format(string, sizeof(string), "[GAMBLE] %s(id: %d) has gambled 5 cookies. Reward: $2000", UserUD[playerid][accname],playerid);
    }
    SendClientMessageToAll(rankupdate, string);
    allowgamble[playerid] = 0;
    SetTimerEx("gambleon", 30000, false, "i", playerid);
    return 1;
}


public gambleon(playerid)
{
    allowgamble[playerid] = 1;
    return 1;
}
Reply
#3

You are probably settings allowgamble[playerid] = 1; for ID 0 only.
Reply
#4

i have this:
Код:
new allowgamble[MAX_PLAYERS] = 1;
Reply
#5

Quote:
Originally Posted by FuTuRe`
i have this:
Код:
new allowgamble[MAX_PLAYERS] = 1;
This is it.

It only saves 1 to ID 0.
Reply
#6

I already fixed it, i had to put under: OnPlayerConnect allowgamle =1 xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)