if(Team1Kills > Team2Kills)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(gTeam[i] == TEAM1)
{
GameTextForPlayer(i, "You Won! When is the party?", 4000, 3);
SetPlayerScore(i, GetPlayerScore(i) + 10);
GivePlayerMoney(i, GetPlayerMoney(i) + 10000);
SetTimer("LoadingandRound", 4000, false);
Team1Kills = 0;
Team2Kills = 0;
}
else
{
GameTextForPlayer(i, "You brought Disgrace!You LOST!", 4000, 3);
SetTimer("LoadingandRound", 4000, false);
Team1Kills = 0;
Team2Kills = 0;
}
}
}
else if(Team2Kills > Team1Kills)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(gTeam[i] == TEAM2)
{
GameTextForPlayer(i, "You Won! When is the party?", 4000, 3);
SetPlayerScore(i, GetPlayerScore(i) + 10);
GivePlayerMoney(i, GetPlayerMoney(i) + 10000);
SetTimer("LoadingandRound", 4000, false);
Team1Kills = 0;
Team2Kills = 0;
}
else
{
GameTextForPlayer(i, "You brought Disgrace!You LOST!", 4000, 3);
SetTimer("LoadingandRound", 4000, false);
Team1Kills = 0;
Team2Kills = 0;
}
}
}
CMD:setmoney(playerid, params[])
{
new targetid, money, string[100];
if(pInfo[playerid][pAdmin] < 3) return SCM(playerid, COLOR_RED, "[ERROR] You are not authorised to use this command");
if(sscanf(params, "ud", targetid, money)) return SCM(playerid, COLOR_RED, "[USAGE] /setmoney <playerid/part of name> <amount>");
if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected");
ResetPlayerMoney(targetid);
GivePlayerMoney(targetid, money);
format(string, sizeof(string), "Admin %s has set your money to %d", GetName(playerid), money);
SCM(targetid, COLOR_GREEN, string);
format(string, sizeof(string), "You have successfully set %s's money to %d", GetName(targetid), money);
SCM(playerid, COLOR_GREEN, string);
return 1;
}
CMD:setscore(playerid, params[])
{
new targetid, score, string[100];
if(pInfo[playerid][pAdmin] < 3) return SCM(playerid, COLOR_RED, "[ERROR] You are not authorised to use this command");
if(sscanf(params, "ud", targetid, score)) return SCM(playerid, COLOR_RED, "[USAGE] /setscore <playerid/part of name> <amount>");
if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected");
SetPlayerScore(targetid, score);
format(string, sizeof(string), "Admin %s has set your score to %d", GetName(playerid), score);
SCM(targetid, COLOR_GREEN, string);
format(string, sizeof(string), "You have successfully set %s's score to %d", GetName(targetid), score);
SCM(playerid, COLOR_GREEN, string);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(IsBeingSpeced[playerid] == 1)
{
for(new i=0;i<MAX_PLAYERS;++i)
{
if(spectatorid[i] == playerid)
{
TogglePlayerSpectating(i,false);
}
}
}
if(INI_Exists(Path(playerid)))
{
new INI:file = INI_Open(Path(playerid));
INI_WriteInt(file, "AdminLevel",pInfo[playerid][pAdmin]);
INI_WriteInt(file, "VipLevel",pInfo[playerid][pVip]);
INI_WriteInt(file, "Money",GetPlayerMoney(playerid));
INI_WriteInt(file, "Score",GetPlayerScore(playerid));
INI_WriteInt(file, "Muted", pInfo[playerid][pMute]);
INI_WriteInt(file, "Frozen", pInfo[playerid][pFrozen]);
INI_WriteInt(file, "Warnings", pInfo[playerid][pWarns]);
INI_WriteInt(file, "Duty", pInfo[playerid][pDuty]);
INI_WriteInt(file, "NoPM", pInfo[playerid][pNoPM]);
INI_WriteInt(file, "Kills", pInfo[playerid][pKills]);
INI_WriteInt(file, "Deaths", pInfo[playerid][pDeaths]);
INI_Close(file);
return 1;
}
return 1;
}
Do you use any kind of saving systems? Please show OnPlayerDisconnect too.
|
if(Team1Kills > Team2Kills)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(gTeam[i] == TEAM1)
{
GameTextForPlayer(i, "You Won! When is the party?", 4000, 3);
SetPlayerScore(i, GetPlayerScore(i) + 10);
GivePlayerMoney(i, 10000);
SetTimer("LoadingandRound", 4000, false);
Team1Kills = 0;
Team2Kills = 0;
}
else
{
GameTextForPlayer(i, "You brought Disgrace!You LOST!", 4000, 3);
SetTimer("LoadingandRound", 4000, false);
Team1Kills = 0;
Team2Kills = 0;
}
}
}
else if(Team2Kills > Team1Kills)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(gTeam[i] == TEAM2)
{
GameTextForPlayer(i, "You Won! When is the party?", 4000, 3);
SetPlayerScore(i, GetPlayerScore(i) + 10);
GivePlayerMoney(i, 10000);
SetTimer("LoadingandRound", 4000, false);
Team1Kills = 0;
Team2Kills = 0;
}
else
{
GameTextForPlayer(i, "You brought Disgrace!You LOST!", 4000, 3);
SetTimer("LoadingandRound", 4000, false);
Team1Kills = 0;
Team2Kills = 0;
}
}
}