|------------------------------------------מערכת לוטו----------------------------|
למעלה במוד:
לאחר מכן איפה שכול ה forward (למעלה במוד) את זה:#define LOTTOPAY 1200
#define LOTTOTIME 20 // in minutes
#define LOTTONUMS 50
עכשיו איפה שכול ה New שלכם:forward lottotime(playerid);
בפאבליק OnPlayerCommandText שימו את הפקודה הזאת:new lottoCash = 0;
new lottoPlayer[LOTTONUMS];
new isInLotto[MAX_PLAYERS];
new isLotto = false;
בפאבליק OnGameModeInit את זה:else if(strcmp(cmd, "/lotto", true)==0){
if(!isLotto) return SendClientMessage(playerid,COLOR_RED," אין הגרלה כרגע! ");
if(isInLotto[playerid]) return SendClientMessage(playerid,COLOR_RED,"אתה כבר משתתף בלוטו!! ");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /lotto [number] (0 < number < 50)");
moneys = strval(tmp);
if(lottoPlayer[moneys - 1] != -1) return SendClientMessage(playerid, COLOR_RED, "המספר הזה כבר נבחר! ");
if(moneys > LOTTONUMS || moneys < 1) return SendClientMessage(playerid, COLOR_RED, " זה לא מספר חוקי! ");
lottoPlayer[moneys-1] = playerid;
GivePlayerMoney(playerid,-LOTTOPAY);
lottoCash += LOTTOPAY;
isInLotto[playerid] = true;
SendClientMessage(playerid, COLOR_GREEN, " בהצלחה! ");
return 1;}
וגם את זה:for(new i = 0; i < LOTTONUMS; i++)
{
lottoPlayer[i] = -1;
}
עכשיו שימו את כל הפאבליקים הבאים למטה!!:SetTimer("lottotime",LOTTOTIME*59997,1);
forward lottotime();
public lottotime()
{
SetTimer("lotto",60000,0);
SetTimer("lMsg",30000,0);
SendClientMessageToAll(COLOR_PEACH, " ---- מערכת הגרלות ----");
SendClientMessageToAll(0xFFFFFFAA, " :בעוד דקה תהיה מערכת הגרלות פעילה");
SendClientMessageToAll(COLOR_GREEN, " /lotto [number] 1200$,הימור עולה כדי להמר כיתבו - ! ");
SendClientMessageToAll(COLOR_GREEN, " המספר חייב להיות בין 50-1! ");
SendClientMessageToAll(COLOR_PEACH, " ---- מערכת הגרלות ----");
isLotto = true;
}forward lMsg();public lMsg()
{
SendClientMessageToAll(COLOR_PEACH, " ---- מערכת הגרלות ----");
SendClientMessageToAll(0xFFFFFFAA, " :בעוד חצי דקה תהיה מערכת הגרלות פעילה");
SendClientMessageToAll(COLOR_GREEN, " /lotto [number] 1200$הימור עולה אם אתם רוצים להמר כיתבו - ! ");
SendClientMessageToAll(COLOR_GREEN, " המספר חייב להיות בין 50-1! ");
SendClientMessageToAll(COLOR_PEACH, " ---- !בהצלחה ----");
}forward lotto();הכסף שאתם רוצים השחקן יקבל בזכייה #define LOTTOPAY 1200public lotto()
{
new string[254];
new name[MAX_PLAYER_NAME];
new num = random(LOTTONUMS);
if(IsPlayerConnected(lottoPlayer[num]))
{
GetPlayerName(lottoPlayer[num],name,sizeof(name));
format(string,sizeof(string),"%s זכית בהגרלה וקיבלת: %d$",name,num + 1,lottoCash);
SendClientMessageToAll(COLOR_PEACH,string);
GivePlayerMoney(lottoPlayer[num],lottoCash);
lottoCash = 0;
}
else
{
format(string,sizeof(string)," %d : לא היו זוכים בהגרלה, מספר המזל היה:",num + 1,lottoCash);
SendClientMessageToAll(COLOR_GREEN,string);
}
for(new i = 0; i < LOTTONUMS; i++)
{
lottoPlayer[i] = -1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
isInLotto[i] = 0;
}
isLotto = false;
}
כמה זמן היה הלוטו #define LOTTOTIME 20 // in minutes
#define LOTTONUMS 50
זהוא גמרתי...
קרדיט ל-VirTu4L
! ~ תהנו~!![]()