if(winner != -1) //If there was a winner
{
for(new i; i<MAX_PLAYERS; i++) //checks through all players
{
new Pname[24];
GetPlayerName(i, Pname, 24);
new str[128];
SendClientMessageToAll(0x62FF32FF, "****LOTTO INFORMATION****"); //Lotto info
format(str, sizeof(str), "WE HAVE A WINNER! %s (Id: %d) won $%d!!!!", Pname, i, Jackpot);
LottoLog(str);
GivePlayerMoney(i, Jackpot);
SendClientMessageToAll(0x62FF32FF, str); //Lotto info
SendClientMessageToAll(0x62FF32FF, "Make sure you get a ticket for next draw - /lotto [1-30]"); //Lotto info
Jackpot = LOTTO_START; //Resets the jackpot
}
}
if(strcmp(cmd, "/givemoney", true) == 0) { new string[128]; new playermoney; new sendername[MAX_PLAYER_NAME]; new giveplayer[MAX_PLAYER_NAME]; new giveplayerid, moneys; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_RED, "USAGE: /givecash <playerid/playername> <amount>"); return 1; } giveplayerid = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_RED, "USAGE: /givecash <playerid/playername> <amount>"); return 1; } moneys = strval(tmp); if (IsPlayerConnected(giveplayerid) && giveplayerid != INVALID_PLAYER_ID && giveplayerid != playerid) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); playermoney = GetPlayerMoney(playerid); if (moneys > 0 && playermoney >= moneys) { GivePlayerMoney(playerid, (0 - moneys)); GivePlayerMoney(giveplayerid, moneys); format(string, sizeof(string), "You gave %s(%d), Money Amount: $%d.", giveplayer,giveplayerid, moneys); SendClientMessage(playerid, COLOR_GREEN, string); format(string, sizeof(string), "You got $%d from %s(%d).", moneys, sendername, playerid); SendClientMessage(giveplayerid, COLOR_GREEN, string); PlayerPlaySound(playerid,1084,0.0,0.0,0.0); printf("%s(%d) has transfered %d to %s(%d)",sendername, playerid, moneys, giveplayer, giveplayerid); } else { SendClientMessage(playerid, COLOR_RED, "Invalid amount!"); } } else { format(string, sizeof(string), "ERROR: Player Is Not Connected or Its Yourself!"); SendClientMessage(playerid, COLOR_RED, string); } return 1; }
Debug the code, print out something after every line. It must be silently exiting somewhere.
|
GivePlayerMoney(i, Jackpot);
like i find : http://forum.sa-mp.com/showthread.ph...hlight=JackPot
USE NEXT TIME SEARCH! (You can take there a Code) |
like i find : http://forum.sa-mp.com/showthread.ph...hlight=JackPot
USE NEXT TIME SEARCH! (You can take there a Code) |
pawn Код:
|
for(new i; i<MAX_PLAYERS; i++)
{