public OnPlayerDeath(playerid, killerid, reason)
{
new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[125];
if(gTeam[playerid] == PoliceTeam(GetPlayerSkin(playerid)))
{
if(GetPlayerWantedLevel(playerid) <= 4 && GetPlayerWantedLevel(playerid) >= 30)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
format(string, sizeof(string), "{E6FD00}%s[%d] has been {00E6FD}Taken Down {ffffff}by Officer %s[%d]!", killerid,pName,playerid);
SendClientMessageToAll(-1,string);
format(string, sizeof(string), "~b~Taken Down ~W~%s(%d)", pName, playerid);
GameTextForPlayer(killerid, string, 7000, 5);
new Randomm = random(sizeof(RandommJailSpawns));
SetPlayerPos(playerid, RandommJailSpawns[Randomm][0], RandommJailSpawns[Randomm][1], RandommJailSpawns[Randomm][2]);
SetPlayerFacingAngle(playerid, RandommJailSpawns[Randomm][2]);
SetPlayerInterior(playerid, 3);
pJailTimerID[playerid] = SetTimerEx("pJailTimer", 1000, true, "i", playerid);
pJailCount[playerid] = 80 + random(100);
ResetPlayerWeapons(playerid);
SetPlayerColor(playerid, COLOR_WHITE);
SetPlayerWantedLevel(playerid,0);
SetPlayerHealth(playerid, 5000000);
return 1;
}
}
return 1;
}
This is where you need to learn, as even if the code is made for you, it's not going to teach you anything.
As mentioned, if you've got this 'everywhere' in your script, you may be better off starting over. Using skins to ID factions, is a terrible practice, where you should be using an array, or an enum. Your first issue was that you had the SWAT skin, in the COPS team, where if you look at your code, EVERY SKIN, is listed under civilian, so if you check that 'team' first, it'll ignore ALL other checks, as it got a result from the civilian team. Now again, if this 'practice' has been all through your script, it's high time you got a better script and started reading, and taking on board what is said. After all, is it not 2 years you've been trying to edit this gamemode? |
//Under OnPlayerDeath
new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[125];
if(gTeam[killerid] == PoliceTeam(GetPlayerSkin(playerid)) && gTeam[playerid] != RobberTeam(GetPlayerSkin(playerid)))
{
if(GetPlayerWantedLevel(playerid) <= 4 && GetPlayerWantedLevel(playerid) >= 30)
{
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
GetPlayerName(killerid,tName,MAX_PLAYER_NAME);
format(string, sizeof(string), "{E6FD00}Officer %s[%d] has {00E6FD}Taken Down {E6FD00}%s[%d] which is at wanted level of %d!", tName, killerid, pName, playerid, GetPlayerWantedLevel(playerid));
SendClientMessageToAll(-1,string);
format(string, sizeof(string), "~b~Taken Down ~W~%s(%d)", pName, playerid);
GameTextForPlayer(killerid, string, 7000, 5);
new Randomm = random(sizeof(RandommJailSpawns));
SetPlayerPos(playerid, RandommJailSpawns[Randomm][0], RandommJailSpawns[Randomm][1], RandommJailSpawns[Randomm][2]);
SetPlayerFacingAngle(playerid, RandommJailSpawns[Randomm][2]);
SetPlayerInterior(playerid, 3);
pJailTimerID[playerid] = SetTimerEx("pJailTimer", 1000, true, "i", playerid);
pJailCount[playerid] = 80 + random(100);
ResetPlayerWeapons(playerid);
SetPlayerColor(playerid, COLOR_WHITE);
SetPlayerWantedLevel(playerid,0);
SetPlayerHealth(playerid, 5000000);
}
}
because you check if cop killed cop
PHP код:
PHP код:
|
if(gTeam[killerid] == PoliceTeam(GetPlayerSkin(killerid)) && gTeam[playerid] != PoliceTeam(GetPlayerSkin(playerid))
EDITED MY PREV CODE:
PHP код:
|
if(gTeam[killerid] == PoliceTeam(GetPlayerSkin(killerid)) && gTeam[playerid] != PoliceTeam(GetPlayerSkin(playerid)))
public OnPlayerDeath(playerid, killerid, reason)
{
if(gTeam[killerid] == PoliceTeam(GetPlayerSkin(killerid)) && gTeam[playerid] == Civilian(GetPlayerSkin(playerid)))
{
switch(GetPlayerWantedLevel(playerid))
{
case 4 .. 30:
{
new string2[170],tName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
SetPlayerScore(playerid, GetPlayerScore(playerid)-1);
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
GetPlayerName(killerid,tName,MAX_PLAYER_NAME);
format(string2, sizeof(string2), "{E6FD00}Officer %s[%d] has {00E6FD}Taken Down {E6FD00}%s[%d] which is at wanted level of %d!", tName, killerid, pName, playerid, GetPlayerWantedLevel(playerid));
SendClientMessageToAll(-1,string2);
format(string2, sizeof(string2), "~b~Taken Down ~W~%s(%d)", pName, playerid);
GameTextForPlayer(killerid, string2, 7000, 5);
}
}
}
return 1;
}