Lottery system - 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: Lottery system (
/showthread.php?tid=605520)
Lottery system -
GunZsmd - 20.04.2016
Hey guys,
My RP GM had a lottery system but im trying to change it to a textdraw based one. Currently i got all the textdraws and everything but i have been thinking and i just can't figure out how to store the numbers of the textdraw in the correct order people press them. Like imagine their 5 numbers are 1, 2 ,3 ,4 ,5 what im trying to know is when the player presses the 1 how to save it as the first number then the second time he presses another number it saves it as second etc...
I would apreciate if someone could help me plz
cumpz,
Vasco
Re: Lottery system -
CodeStyle175 - 20.04.2016
PHP код:
new PlayerText:LotteryButton[MAX_PLAYERS][5];
new Lottery[MAX_PLAYERS][5];
new LotteryTry[MAX_PLAYERS];
OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid){
if(_:playertextid != INVALID_TEXT_DRAW){
new cnt=LotteryTry[playerid];
for(new i; i < 5; i++){
if(Lottery[playerid][i]==playertextid){
Lottery[playerid][cnt]=i+1;
LotteryTry[playerid]++;
if(LotteryTry[playerid]!=5){
//...ShowTDagain
}else{
scm(playerid,-1,"You have selected all your numbers.");
}
break;
}
}
return 1;
}