Lotto System Bug
#1

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
Reply
#2

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.
Reply
#3

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;
Reply
#4

Thanks
Reply
#5

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


Forum Jump:


Users browsing this thread: 2 Guest(s)