//Made by lokii. #include //credits to samp team. #include // credits to zeex. static bool:inlotto[MAX_PLAYERS] = {false,...}; static bool:active = false; static timer; public OnFilterScriptExit() { KillTimer(timer); for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) { if(!IsPlayerConnected(i) || IsPlayerNPC(i)) continue; inlotto[i] = false; } return 1; } public OnPlayerDisconnect(playerid) { inlotto[playerid] = false; return 1; } forward Lotto(); public Lotto() { static str[74], name[24], rand1, rand2; active = false; for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) { PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0); } rand1 = random(GetMaxPlayers()+250); rand2 = random(500000-50000)+50000; if(!IsPlayerConnected(rand1) || IsPlayerNPC(rand1) || !inlotto[rand1]) { SendClientMessageToAll(-1, "Nobody won the lotto"); } else { GetPlayerName(rand1, name, sizeof(name)); format(str, sizeof(str), "%s {FFFFFF}won the lotto ({00FF00}$%d{FFFFFF})", name, rand2); SendClientMessageToAll(0xFFFF00FF, str); GivePlayerMoney(rand1, rand2); } return 1; } CMD:joinlotto(playerid) { if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0xFF0000FF, "You dont have enough money"); inlotto[playerid] = true; PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); GivePlayerMoney(playerid, -500); SendClientMessage(playerid, 0x00FF00FF, "You joined lotto {FF0000}-$500"); return 1; } CMD:setlotto(playerid) { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You'r not allowed to use this command"); if(active) return SendClientMessage(playerid, 0xFF0000FF, "The lotto is allready active"); for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) { PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0); } SendClientMessageToAll(-1, "Lotto started /joinlotto ({00FF00}$500{FFFFFF}) to enter"); active = true; timer = SetTimer("Lotto", 120000, false); return 1; } //EOF.