09.09.2012, 15:24
When a player is in jail and killed there when it is placed on a normal spaun, not back in jail to serve their time. How can I fix this?
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][Jailed])
{
//Set player's coordinates back to jail
}
else
{
//The rest of your code
}
return 1;
}
CMD:jailplayer(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_RED, "Error Occured: This command is only for admins.");
new targetid, sendername[MAX_PLAYER_NAME], string[128], reason[128], jailtime;
if(sscanf(params,"uis[128]", targetid, jailtime, reason)) return SendClientMessage(playerid, COLOR_RED,"[ADMIN] /jailplayer [PLAYERID/PLAYERNAME] JAILTIME REASON");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"That player is not connected to your server");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string),"%s has put you in jail. Offence:%s -- For about: %i minutes", sendername, reason, jailtime);
SendClientMessage(targetid, COLOR_GREEN, string);
format(string, sizeof(string),"%s has jailed %i, Reason: %s - For: %i minutes", sendername, targetid, reason, jailtime);
SendClientMessageToAll(COLOR_GREEN, string);
SetPlayerPos(targetid, 2131.507812,1600.818481,1008.359375);
SetPlayerInterior(targetid, 1);
PlayerInfo[targetid][pJailed] = 1;
print(string);
return 1;
}
CMD:unjailplayer(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_RED, "Error Occured: This command is only for admins.");
new targetid, sendername[MAX_PLAYER_NAME], string[128];
if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, COLOR_RED,"[ADMIN] /unjailplayer [PLAYERID/PLAYERNAME]");
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string),"%s has set you free.", sendername);
SendClientMessage(targetid, COLOR_GREEN, string);
PlayerInfo[targetid][pJailed] = 0;
SetPlayerInterior(targetid, 0);
SpawnPlayer(targetid);
return 1;
}
//============================================================================== public OnPlayerSpawn(playerid) { if (!GetPVarInt(playerid, "color")) SetPVarInt(playerid, "color", 18643); if(PlayerInfo[playerid][pJailed]) { //Set player's coordinates back to jail } else { //The rest of your code } PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0); FlashZoneForPlayer(playerid); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); SetPlayerScore(playerid, PlayerInfo[playerid][pKills]); SetPlayerSkillLevel(playerid,0,999); SetPlayerSkillLevel(playerid,1,999); SetPlayerSkillLevel(playerid,2,999); SetPlayerSkillLevel(playerid,3,999); SetPlayerSkillLevel(playerid,4,999); SetPlayerSkillLevel(playerid,5,999); SetPlayerSkillLevel(playerid,6,999); SetPlayerSkillLevel(playerid,7,999); SetPlayerSkillLevel(playerid,8,999); SetPlayerSkillLevel(playerid,9,999); SetPlayerSkillLevel(playerid,10,999); for (new i = 0; i < MAX_TURFS; i++) GangZoneShowForPlayer(playerid, turfs[i][turfID], turfs[i][TurfColor]); SetPlayerToTeamColor(playerid); SetPlayerSpawn(playerid); if(PlayerInfo[playerid][pMember] == TEAM_GROVE) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_BALLAS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_VAGOS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_AZTECAS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_TRIADS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_YAKUZA) { GivePlayerGun(playerid, 8); //katana GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_CRIPZ) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_BADBOYS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_POLICE) { GivePlayerGun(playerid, 3); //palka GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_LVPD) { GivePlayerGun(playerid, 3); //palka GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_JIZZY) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_BLOODS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_BIKERBOYS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_ASIANTRIADS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_MIB) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_RUS) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_ARMY) { GivePlayerGun(playerid, 4); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_AFARMY) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_CIA) { GivePlayerGun(playerid, 5); //knife GivePlayerGun(playerid, 24); //Deagle GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32); //Tec9 GivePlayerGun(playerid, 31); //M4 GivePlayerGun(playerid, 34); //SNIPER } else if(PlayerInfo[playerid][pMember] == TEAM_CIVILIAN) { GivePlayerGun(playerid, 26); //Automatic Shotgun GivePlayerGun(playerid, 32);//tec9 GivePlayerGun(playerid, 24);//deagle } if(PlayerInfo[playerid][aDuty] == 1) { SendClientMessage(playerid, COLOR_GREEN,"Ти си на администраторска смяна, използвай командата /aduty за да излезеш от администраторската смяна!"); SetPlayerColor(playerid, COLOR_ADMIN); SetPlayerHealth(playerid, 100); SetPlayerArmour(playerid, 100); } if(PlayerInfo[playerid][pJailed] == 1) { SetPlayerWantedLevel(playerid, 0); SetPlayerInterior(playerid, 3); SetPlayerPos(playerid,974.01,-9.59,1001.14); SendClientMessage(playerid, COLOR_LIGHTRED, "Ти излежа присъдата си в затвора,може да се върнеш към света без решетки."); return 1; } return 1; }
public OnPlayerSpawn(playerid)
{
if (!GetPVarInt(playerid, "color")) SetPVarInt(playerid, "color", 18643);
PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0);
FlashZoneForPlayer(playerid);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
SetPlayerSkillLevel(playerid,0,999);
SetPlayerSkillLevel(playerid,1,999);
SetPlayerSkillLevel(playerid,2,999);
SetPlayerSkillLevel(playerid,3,999);
SetPlayerSkillLevel(playerid,4,999);
SetPlayerSkillLevel(playerid,5,999);
SetPlayerSkillLevel(playerid,6,999);
SetPlayerSkillLevel(playerid,7,999);
SetPlayerSkillLevel(playerid,8,999);
SetPlayerSkillLevel(playerid,9,999);
SetPlayerSkillLevel(playerid,10,999);
for (new i = 0; i < MAX_TURFS; i++) GangZoneShowForPlayer(playerid, turfs[i][turfID], turfs[i][TurfColor]);
SetPlayerToTeamColor(playerid);
SetPlayerSpawn(playerid);
if(PlayerInfo[playerid][pJailed] == 1)
{
SetPlayerWantedLevel(playerid, 0);
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid,974.01,-9.59,1001.14);
SendClientMessage(playerid, COLOR_LIGHTRED, "Ти излежа присъдата си в затвора,може да се върнеш към света без решетки.");
return 1;
}
if(PlayerInfo[playerid][pMember] == TEAM_GROVE)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_BALLAS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_VAGOS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_AZTECAS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_TRIADS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_YAKUZA)
{
GivePlayerGun(playerid, 8); //katana
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_CRIPZ)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_BADBOYS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_POLICE)
{
GivePlayerGun(playerid, 3); //palka
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_LVPD)
{
GivePlayerGun(playerid, 3); //palka
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_JIZZY)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_BLOODS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_BIKERBOYS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_ASIANTRIADS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_MIB)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_RUS)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_ARMY)
{
GivePlayerGun(playerid, 4); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_AFARMY)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_CIA)
{
GivePlayerGun(playerid, 5); //knife
GivePlayerGun(playerid, 24); //Deagle
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32); //Tec9
GivePlayerGun(playerid, 31); //M4
GivePlayerGun(playerid, 34); //SNIPER
}
else if(PlayerInfo[playerid][pMember] == TEAM_CIVILIAN)
{
GivePlayerGun(playerid, 26); //Automatic Shotgun
GivePlayerGun(playerid, 32);//tec9
GivePlayerGun(playerid, 24);//deagle
}
if(PlayerInfo[playerid][aDuty] == 1)
{
SendClientMessage(playerid, COLOR_GREEN,"Ти си на администраторска смяна, използвай командата /aduty за да излезеш от администраторската смяна!");
SetPlayerColor(playerid, COLOR_ADMIN);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
}
return 1;
}