Onplayerdeath help
#1

How can i make when cops kill player and cops will get money
This is my code but cant works

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
SendDeathMessage(killerid,playerid,reason);
    
GivePlayerMoney(playerid,-1000);
    
SetPlayerWantedLevel(playerid,0);
    if(!
civ[killerid] == TEAM_Cops)
    {
    
SetPlayerScore(killerid,GetPlayerScore(killerid)+2);
    
GivePlayerMoney(playerid, -1000);
    
SetPlayerWantedLevel(killeridGetPlayerWantedLevel(killerid) +12);
    }
    if(
civ[killerid] == TEAM_Cops)
     {
         if(
GetPlayerWantedLevel(playerid) == 0)
         {
        
SetPlayerScore(killeridGetPlayerScore(killerid)-5);
        
SendClientMessage(killeridCOLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent.You have -5000$ and -5 score for punishment.");
        
GivePlayerMoney(killerid, -5000);
        return 
1;
        }
        if(
GetPlayerWantedLevel(playerid) >= )
        {
        
SendClientMessage(killeridCOLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent suspects.You have -1000$ and -1 score for punishment.");
        
SetPlayerScore(killeridGetPlayerScore(killerid)-1);
        
GivePlayerMoney(killerid, -1000);
        return 
1;
        }
        if(
GetPlayerWantedLevel(playerid) >= )
        {
        new 
string2000[200];
        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
format(string2000sizeof(string2000), "[POLICE]:{FFFFFF}%s[%d] has been taken down by Law Officer %s[%d] with %i wanted level.",GetPlayerName(playerid),playerid,GetPlayerName(killerid),killerid,GetPlayerWantedLevel(playerid));
        
SendClientMessageToAll(COLOR_BLUE,string2000);
        
GivePlayerMoney(killerid,GetPlayerWantedLevel(playerid)*100);
        return 
1;
        }
        if(
GetPlayerWantedLevel(playerid) >= 12 )
        {
        new 
string2000[200];
        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
format(string2000sizeof(string2000), "[POLICE]:{FFFFFF}%s[%d] has been taken down by Law Officer %s[%d] with %i wanted level.",GetPlayerName(playerid),playerid,GetPlayerName(killerid),killerid,GetPlayerWantedLevel(playerid));
        
SendClientMessageToAll(COLOR_BLUE,string2000);
        
GivePlayerMoney(killerid,GetPlayerWantedLevel(playerid)*200);
        return 
1;
        }
     }
    return 
1;

Reply
#2

pawn Код:
if(!civ[killerid] == TEAM_Cops)
is wrong ! use:
pawn Код:
if(civ[killerid] != TEAM_Cops)
Reply
#3

can't works still same problem.
Reply
#4

try that:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid,playerid,reason);
    GivePlayerMoney(playerid,-1000);
    if(!civ[killerid] == TEAM_Cops)
    {
    SetPlayerScore(killerid,GetPlayerScore(killerid)+2);
    GivePlayerMoney(playerid, -1000);
    SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) +12);
    }
    if(civ[killerid] == TEAM_Cops)
     {
         if(GetPlayerWantedLevel(playerid) == 0)
         {
        SetPlayerScore(killerid, GetPlayerScore(killerid)-5);
        SendClientMessage(killerid, COLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent.You have -5000$ and -5 score for punishment.");
        GivePlayerMoney(killerid, -5000);
        return 1;
        }
        if(GetPlayerWantedLevel(playerid) >= 1 )
        {
        SendClientMessage(killerid, COLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent suspects.You have -1000$ and -1 score for punishment.");
        SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
        GivePlayerMoney(killerid, -1000);
        return 1;
        }
        if(GetPlayerWantedLevel(playerid) >= 6 )
        {
        new string2000[200];
        SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
        format(string2000, sizeof(string2000), "[POLICE]:{FFFFFF}%s[%d] has been taken down by Law Officer %s[%d] with %i wanted level.",GetPlayerName(playerid),playerid,GetPlayerName(killerid),killerid,GetPlayerWantedLevel(playerid));
        SendClientMessageToAll(COLOR_BLUE,string2000);
        GivePlayerMoney(killerid,GetPlayerWantedLevel(playerid)*100);
        return 1;
        }
        if(GetPlayerWantedLevel(playerid) >= 12 )
        {
        new string2000[200];
        SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
        format(string2000, sizeof(string2000), "[POLICE]:{FFFFFF}%s[%d] has been taken down by Law Officer %s[%d] with %i wanted level.",GetPlayerName(playerid),playerid,GetPlayerName(killerid),killerid,GetPlayerWantedLevel(playerid));
        SendClientMessageToAll(COLOR_BLUE,string2000);
        GivePlayerMoney(killerid,GetPlayerWantedLevel(playerid)*200);
        return 1;
        }
       SetPlayerWantedLevel(playerid,0);
     }
    return 1;
}
Reply
#5

Still cant works
Reply
#6

Quote:
Originally Posted by JawsPlus
Посмотреть сообщение
Still cant works
What is the problem exactly?
Reply
#7

When i use cops and kill a player it just use this even the player has wanted level

PHP код:
SetPlayerScore(killeridGetPlayerScore(killerid)-5); 
 
SendClientMessage(killeridCOLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent.You have -5000$ and -5     score for punishment."); 
  
GivePlayerMoney(killerid, -5000); 
Reply
#8

Quote:
Originally Posted by JawsPlus
Посмотреть сообщение
How can i make when cops kill player and cops will get money
This is my code but cant works

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
SendDeathMessage(killerid,playerid,reason);
    
GivePlayerMoney(playerid,-1000);
    
SetPlayerWantedLevel(playerid,0);
    if(!
civ[killerid] == TEAM_Cops)
    {
    
SetPlayerScore(killerid,GetPlayerScore(killerid)+2);
    
GivePlayerMoney(playerid, -1000);
    
SetPlayerWantedLevel(killeridGetPlayerWantedLevel(killerid) +12);
    }
    else if(
civ[killerid] == TEAM_Cops)
     {
         if(
GetPlayerWantedLevel(playerid) == 0)
         {
        
SetPlayerScore(killeridGetPlayerScore(killerid)-5);
        
SendClientMessage(killeridCOLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent.You have -5000$ and -5 score for punishment.");
        
GivePlayerMoney(killerid, -5000);
        return 
1;
        }
        if(
GetPlayerWantedLevel(playerid) >= )
        {
        
SendClientMessage(killeridCOLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent suspects.You have -1000$ and -1 score for punishment.");
        
SetPlayerScore(killeridGetPlayerScore(killerid)-1);
        
GivePlayerMoney(killerid, -1000);
        return 
1;
        }
        if(
GetPlayerWantedLevel(playerid) >= )
        {
        new 
string2000[200];
        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
format(string2000sizeof(string2000), "[POLICE]:{FFFFFF}%s[%d] has been taken down by Law Officer %s[%d] with %i wanted level.",GetPlayerName(playerid),playerid,GetPlayerName(killerid),killerid,GetPlayerWantedLevel(playerid));
        
SendClientMessageToAll(COLOR_BLUE,string2000);
        
GivePlayerMoney(killerid,GetPlayerWantedLevel(playerid)*100);
        return 
1;
        }
        if(
GetPlayerWantedLevel(playerid) >= 12 )
        {
        new 
string2000[200];
        
SetPlayerScore(killeridGetPlayerScore(killerid)+1);
        
format(string2000sizeof(string2000), "[POLICE]:{FFFFFF}%s[%d] has been taken down by Law Officer %s[%d] with %i wanted level.",GetPlayerName(playerid),playerid,GetPlayerName(killerid),killerid,GetPlayerWantedLevel(playerid));
        
SendClientMessageToAll(COLOR_BLUE,string2000);
        
GivePlayerMoney(killerid,GetPlayerWantedLevel(playerid)*200);
        return 
1;
        }
     }
    return 
1;

Try this ! Maybe
Reply
#9

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid,playerid,reason);
    GivePlayerMoney(playerid,-1000);
    //SetPlayerWantedLevel(playerid,0); Problem is here.. You are setting his Wanted level to 0 and then using it later on..
	//So player will get i*0 = 0$..
    if(!civ[killerid] == TEAM_Cops)
    {
	    SetPlayerScore(killerid,GetPlayerScore(killerid)+2);
	    GivePlayerMoney(playerid, -1000);
	    SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) +12);
    }
    if(civ[killerid] == TEAM_Cops)
	{
        if(GetPlayerWantedLevel(playerid) == 0)
		{
	        SetPlayerScore(killerid, GetPlayerScore(killerid)-5);
	        SendClientMessage(killerid, COLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent.You have -5000$ and -5 score for punishment.");
	        GivePlayerMoney(killerid, -5000);
	        return 1;
        }
        if(GetPlayerWantedLevel(playerid) >= 1 )
        {
	        SendClientMessage(killerid, COLOR_LIGHTBLUE,"[POLICE]:{FFFFFF}You kill an innocent suspects.You have -1000$ and -1 score for punishment.");
	        SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
	        GivePlayerMoney(killerid, -1000);
	        return 1;
        }
        if(GetPlayerWantedLevel(playerid) >= 6 )
        {
	        new string2000[200];
	        SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
	        format(string2000, sizeof(string2000), "[POLICE]:{FFFFFF}%s[%d] has been taken down by Law Officer %s[%d] with %i wanted level.",GetPlayerName(playerid),playerid,GetPlayerName(killerid),killerid,GetPlayerWantedLevel(playerid));
	        SendClientMessageToAll(COLOR_BLUE,string2000);
	        GivePlayerMoney(killerid,GetPlayerWantedLevel(playerid)*100);
	        return 1;
        }
        if(GetPlayerWantedLevel(playerid) >= 12 )
        {
			new string2000[200];
			SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
			format(string2000, sizeof(string2000), "[POLICE]:{FFFFFF}%s[%d] has been taken down by Law Officer %s[%d] with %i wanted level.",GetPlayerName(playerid),playerid,GetPlayerName(killerid),killerid,GetPlayerWantedLevel(playerid));
			SendClientMessageToAll(COLOR_BLUE,string2000);
			GivePlayerMoney(killerid,GetPlayerWantedLevel(playerid)*200);
			return 1;
		}
	}
    SetPlayerWantedLevel(playerid,0);
	return 1;
}
Reply
#10

Still the same problems.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)