11.04.2012, 14:48
So when a player is sent to jail for wanted level, it's supposed to send GameTextForPlayer (the player in jail) and it's supposed to say on his screen "JAIL TIME: (#)" But when he's in jail, he has to kill himself first and then the GameTextForPlayer will show up. How can I make it where it will just show up when he teleports to jail? Here is my code:
And also, when player gets wanted and he/she is in jail, they have to kill themselves to show the timer and then they spawn back in jail. When the timer then goes to 0, they are automatically released but when they get wanted again, the wanted stars will show on their screen but not the other people's so therefore the player cannot be arrest. Can someone help me on this too? Thanks +REP
Код:
command(ar, playerid, params[]) { new ID; new pname[24]; new opname[24]; GetPlayerName(playerid, pname, 24); new string[200]; if(gTeam[playerid] ==Team_Civi || gTeam[playerid] == Team_Rape || gTeam[playerid] == Team_Terror || gTeam[playerid] == Team_Steal || gTeam[playerid] == Team_PrvtMed) { return SendClientMessage(playerid, COLOR_ERROR, "You are not a Law Enforcement officer."); } if(IsPlayerInAnyVehicle(playerid)) { return SendClientMessage(playerid, COLOR_ERROR, "You cannot be in a vehicle to use this command."); } if(sscanf(params, "u", ID)) { return SendClientMessage(playerid, COLOR_ERROR, "Usage: /ar (ID)"); } if(!IsPlayerConnected(ID)) { return SendClientMessage(playerid, COLOR_ERROR, "Invalid ID."); } GetPlayerName(ID, opname, 24); if(ID == playerid) { return SendClientMessage(playerid, COLOR_ERROR, "You cannot arrest yourself."); } if(IsPlayerInAnyVehicle(ID)) { return SendClientMessage(playerid, COLOR_ERROR, "You cannot arrest a player inside a vehicle."); } if(GetPVarInt(ID, "Jailed") == 1) { return SendClientMessage(playerid, COLOR_ERROR, "You cannot arrest a jailed person."); } if(GetPVarInt(ID, "Cuffed") ==0) { return SendClientMessage(playerid, COLOR_ERROR, "You must cuff the player before arresting."); } if(GetDistanceBetweenPlayers(playerid, ID) > 3) { return SendClientMessage(playerid, COLOR_ERROR, "That player is too far away to arrest."); } if(GetPlayerWantedLevel(ID) <= 1) { return SendClientMessage(playerid, COLOR_ERROR, "The player must have a warrant before you arrest."); } new pwl = GetPlayerWantedLevel(ID); if(pwl == 3) { format(string, sizeof(string), "Police Officer %s(%d) has arrested wanted suspect %s(%d)", pname, playerid, opname, ID); SendClientMessageToAll(COLOR_BLUE, string); format(string, sizeof(string), "[POLICE RADIO] Suspect %s(%d) has been sent to jail", opname, ID); SendCopMessage(string); GivePlayerMoney(playerid, 3000); IncreaseScore(playerid, 1); SetPVarInt(ID, "JailTime", 45); SetPlayerInterior(ID, 10); new rnd = random(sizeof(PrisonSpawn)); SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]); SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon."); TogglePlayerControllable(ID, 1); SetPlayerWantedLevel(ID, 0); return 1; } if(pwl == 4) { format(string, sizeof(string), "Police Officer %s(%d) has arrested wanted suspect %s(%d)", pname, playerid, opname, ID); SendClientMessageToAll(COLOR_BLUE, string); format(string, sizeof(string), "[POLICE RADIO] Suspect %s(%d) has been sent to jail", opname, ID); SendCopMessage(string); GivePlayerMoney(playerid, 4000); IncreaseScore(playerid, 1); SetPVarInt(ID, "JailTime", 70); SetPlayerInterior(ID, 10); new rnd = random(sizeof(PrisonSpawn)); SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]); SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon."); TogglePlayerControllable(ID, 1); SetPlayerWantedLevel(ID, 0); return 1; } if(pwl == 5) { format(string, sizeof(string), "Police Officer %s(%d) has arrested most wanted suspect %s(%d)", pname, playerid, opname, ID); SendClientMessageToAll(COLOR_BLUE, string); format(string, sizeof(string), "[POLICE RADIO] Suspect %s(%d) has been sent to jail", opname, ID); SendCopMessage(string); GivePlayerMoney(playerid, 10000); IncreaseScore(playerid, 2); SetPVarInt(ID, "JailTime", 80); SetPlayerInterior(ID, 10); new rnd = random(sizeof(PrisonSpawn)); SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]); SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon."); TogglePlayerControllable(ID, 1); SetPlayerWantedLevel(ID, 0); return 1; } if(pwl == 6) { format(string, sizeof(string), "Police Officer %s(%d) has arrested most wanted suspect %s(%d)", pname, playerid, opname, ID); SendClientMessageToAll(COLOR_BLUE, string); format(string, sizeof(string), "[POLICE RADIO] Suspect %s(%d) has been sent to jail", opname, ID); SendCopMessage(string); GivePlayerMoney(playerid, 10000); IncreaseScore(playerid, 2); SetPVarInt(ID, "JailTime", 100); SetPlayerInterior(ID, 10); new rnd = random(sizeof(PrisonSpawn)); SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]); SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon."); TogglePlayerControllable(ID, 1); SetPlayerWantedLevel(ID, 0); return 1; } return 1; }
And also, when player gets wanted and he/she is in jail, they have to kill themselves to show the timer and then they spawn back in jail. When the timer then goes to 0, they are automatically released but when they get wanted again, the wanted stars will show on their screen but not the other people's so therefore the player cannot be arrest. Can someone help me on this too? Thanks +REP