SA-MP Forums Archive
Lotto System Bug - 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)
+--- Thread: Lotto System Bug (/showthread.php?tid=278691)



Lotto System Bug - Join7 - 23.08.2011

Code:
if (strcmp(cmd, "/lotto", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			return 1;
		}
		return 1;
	}
I bet his 1000 tickets. How can I restrict it to only 1 way to bet


Re: Lotto System Bug - Amit_B - 23.08.2011

When the lotto ends, use
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++) PlayerInfo[i][pLotto] = 0;
also when player connecting to the server
pawn Code:
PlayerInfo[playerid][pLotto] = 0;
and on the command, above the strtok, add
pawn Code:
if(PlayerInfo[playerid][pLotto] != 0) return SendClientMessage(playerid,0xff0000ff,"You have already bought a ticket.");
What i've done here, is that the pLotto variable will be equal to 0 when the player didn't choosen any number.
If the PlayerInfo[playerid][pLotto] is not equal to 0, it means that he bought a ticket.


Re: Lotto System Bug - FireCat - 23.08.2011

Quote:
Originally Posted by Amit_B
View Post
When the lotto ends, use
pawn Code:
for(new i = 0; i < MAX_PLAYERS; i++) PlayerInfo[i][pLotto] = 0;
also when player connecting to the server
pawn Code:
PlayerInfo[playerid][pLotto] = 0;
and on the command, above the strtok, add
pawn Code:
if(PlayerInfo[playerid][pLotto] != 0) return SendClientMessage(playerid,0xff0000ff,"You have already bought a ticket.");
What i've done here, is that the pLotto variable will be equal to 0 when the player didn't choosen any number.
If the PlayerInfo[playerid][pLotto] is not equal to 0, it means that he bought a ticket.
And on OnPlayerDisconnect
You might want to add:
pawn Code:
PlayerInfo[playerid][pLotto] = 0;



Re: Lotto System Bug - Join7 - 23.08.2011

Thanks


Re: Lotto System Bug - Join7 - 24.08.2011

Yes, but now also makes Jackpot: about $ 20,000