How to fix this!!
#1

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[125];
    if(
gTeam[playerid] == PoliceTeam(GetPlayerSkin(playerid)))
        {
            if(
GetPlayerWantedLevel(playerid) <= && GetPlayerWantedLevel(playerid) >= 30)
            {
                
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(playerid)-1);
                
                
format(stringsizeof(string), "{E6FD00}%s[%d] has been {00E6FD}Taken Down {ffffff}by Officer %s[%d]!"killerid,pName,playerid);
                
SendClientMessageToAll(-1,string);
                
format(stringsizeof(string), "~b~Taken Down ~W~%s(%d)"pNameplayerid);
                
GameTextForPlayer(killeridstring70005);
                new 
Randomm random(sizeof(RandommJailSpawns));
                
SetPlayerPos(playeridRandommJailSpawns[Randomm][0], RandommJailSpawns[Randomm][1], RandommJailSpawns[Randomm][2]);
                
SetPlayerFacingAngle(playeridRandommJailSpawns[Randomm][2]);
                
SetPlayerInterior(playerid3);
                
pJailTimerID[playerid] = SetTimerEx("pJailTimer"1000true"i"playerid);
                
pJailCount[playerid] = 80 random(100);
                
ResetPlayerWeapons(playerid);
                
SetPlayerColor(playeridCOLOR_WHITE);
                
SetPlayerWantedLevel(playerid,0);
                
SetPlayerHealth(playerid5000000);
                return 
1;
            }
        }
      return 
1;

After The cop killed wanted player They are not given any message for Players why!!
Reply
#2

Post proper topics, and don't post repeat topics just because you don't like what you are being told...

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
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?
Reply
#3

Hi

try-
PHP код:
//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) <= && GetPlayerWantedLevel(playerid) >= 30)
            {
                
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(playerid)-1);
                
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
                
GetPlayerName(killerid,tName,MAX_PLAYER_NAME);
                
                
format(stringsizeof(string), "{E6FD00}Officer %s[%d] has {00E6FD}Taken Down {E6FD00}%s[%d] which is at wanted level of %d!"tNamekilleridpNameplayeridGetPlayerWantedLevel(playerid));
                
SendClientMessageToAll(-1,string);
                
format(stringsizeof(string), "~b~Taken Down ~W~%s(%d)"pNameplayerid);
                
GameTextForPlayer(killeridstring70005);
                new 
Randomm random(sizeof(RandommJailSpawns));
                
SetPlayerPos(playeridRandommJailSpawns[Randomm][0], RandommJailSpawns[Randomm][1], RandommJailSpawns[Randomm][2]);
                
SetPlayerFacingAngle(playeridRandommJailSpawns[Randomm][2]);
                
SetPlayerInterior(playerid3);
                
pJailTimerID[playerid] = SetTimerEx("pJailTimer"1000true"i"playerid);
                
pJailCount[playerid] = 80 random(100);
                
ResetPlayerWeapons(playerid);
                
SetPlayerColor(playeridCOLOR_WHITE);
                
SetPlayerWantedLevel(playerid,0);
                
SetPlayerHealth(playerid5000000);       
            }
        } 
Reply
#4

Can you guys stop posting up blind shit ffs....


Quote:
Originally Posted by Lokii
Посмотреть сообщение
because you check if cop killed cop

PHP код:
if(gTeam[playerid] == PoliceTeam(GetPlayerSkin(playerid))) 
change to

PHP код:
if(gTeam[playerid] != PoliceTeam(GetPlayerSkin(playerid))) 
Whilst part of that is true, your fix isn't a fix in this instance... He's checking if the player is of the 'team', then checking if the player is also a cop... Nothing to do with the killer.


After all, do you see killerid?
Reply
#5

Hey it's still not worked why?
Reply
#6

Quote:
Originally Posted by Thanks
Посмотреть сообщение
Hey it's still not worked why?
Have you read and try to understand what people wrote instead of copying/pasting some random codes?
Reply
#7

EDITED MY PREV CODE:

PHP код:
if(gTeam[killerid] == PoliceTeam(GetPlayerSkin(killerid)) && gTeam[playerid] != PoliceTeam(GetPlayerSkin(playerid)) 
Reply
#8

Now if Lokiis code doesn't work, then you need to fix what we told you was the issue in the other thread, and stop hoping that copy pasting is going to fix your underlying issues that are really causing this.
Reply
#9

Quote:
Originally Posted by Lokii
Посмотреть сообщение
EDITED MY PREV CODE:

PHP код:
if(gTeam[killerid] == PoliceTeam(GetPlayerSkin(killerid)) && gTeam[playerid] != PoliceTeam(GetPlayerSkin(playerid)) 
Should be like this:

PHP код:
if(gTeam[killerid] == PoliceTeam(GetPlayerSkin(killerid)) && gTeam[playerid] != PoliceTeam(GetPlayerSkin(playerid))) 
You must add there of this " ) " for no errors! at the last " PoliceTeam(GetPlayerSkin(playerid))) "
Reply
#10

Hello again, I've trying to edit the code!! you can do like this too

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
            if(
gTeam[killerid] == PoliceTeam(GetPlayerSkin(killerid)) && gTeam[playerid] == Civilian(GetPlayerSkin(playerid)))
            {
                switch(
GetPlayerWantedLevel(playerid))
                {
                    case 
.. 30:
                    {
                        new 
string2[170],tName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
                        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
                        
SetPlayerScore(playeridGetPlayerScore(playerid)-1);

                        
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
                        
GetPlayerName(killerid,tName,MAX_PLAYER_NAME);

                        
format(string2sizeof(string2), "{E6FD00}Officer %s[%d] has {00E6FD}Taken Down {E6FD00}%s[%d] which is at wanted level of %d!"tNamekilleridpNameplayeridGetPlayerWantedLevel(playerid));
                        
SendClientMessageToAll(-1,string2);

                        
format(string2sizeof(string2), "~b~Taken Down ~W~%s(%d)"pNameplayerid);
                        
GameTextForPlayer(killeridstring270005);
                    }
                }
            }
      return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)