CMD like /gamble - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: CMD like /gamble (
/showthread.php?tid=246498)
CMD like /gamble -
Gertin - 04.04.2011
I have this cmd :
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 !
Re: CMD like /gamble -
xir - 04.04.2011
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;
}
Re: CMD like /gamble -
Gertin - 04.04.2011
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
Re: CMD like /gamble -
xir - 04.04.2011
Sorry add this right under GetTickCount line
pawn Код:
NeedToWait[playerid] = GetTickCount();
Re: CMD like /gamble -
Gertin - 04.04.2011
nope, not working !
Re: CMD like /gamble -
Gertin - 05.04.2011
*** BUMB ***
Re: CMD like /gamble -
Gertin - 05.04.2011
ok, its working now. All things, i make my version !