OnPlayerDeath Bug
#1

Hello,

I was just moving some codes over from an old script into my new GM. When I went into the server to test it, for some reason when the player dies it won't set the player's wanted level back to 0.

But Now if another player kills me, then its able to set my wantedlevel back to 0. But not if I died from falling or being blown up in a vehicle.

As if the GM is not reading through the whole script...

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128];
    Spawned[playerid] = 0;

	if(killerid == INVALID_PLAYER_ID)
	{
	    SendDeathMessage(INVALID_PLAYER_ID, playerid, reason);
    }
    
	if(pStats[killerid][Class] == CLASS_CIVIL && Spawned[killerid] == 1 && pStats[playerid][Class] != CLASS_MIB)
	{
        SetPlayerWantedStars(killerid, pStats[killerid][WantedLevel]+6);
	    format(string,sizeof(string), "MURDER(LEVEL: %d): The police will be looking for you.", pStats[killerid][WantedLevel]);
        SendClientMessage(killerid, 0xA9A9A9AA, string);
        SendDeathMessage(killerid, playerid, reason);
	}
	
	if(pStats[killerid][Class] <=3 && pStats[playerid][Class] == CLASS_CIVIL)
	{
	    if(pStats[playerid][WantedLevel] == 0)
	    {
            SendClientMessage(killerid,0xA9A9A9AA,"Killing an innocent civilian will get you Kicked/Banned.");
	        SendDeathMessage(killerid,playerid,reason);
        }
	    if(pStats[playerid][WantedLevel] >= 1 && pStats[playerid][WantedLevel] <= 3)
	    {
	        SendClientMessage(killerid,0xA9A9A9AA,"You just killed a low wanted suspect, next time use /fine [id] or you will be kicked/banned.");
            SendDeathMessage(killerid,playerid,reason);
        }
	    if(pStats[playerid][WantedLevel] >= 4 && pStats[playerid][WantedLevel] <= 9)
	    {
	        format(string,sizeof(string),"Officer %s has taken down suspect %s.",GetName(killerid),GetName(playerid));
	        SendClientMessageToAll(0xA9A9A9AA,string);
            SendDeathMessage(killerid,playerid,reason);
	    }
        if(pStats[playerid][WantedLevel] >= 10)
	    {
	        format(string,sizeof(string),"Officer %s has taken down Most Wanted %s.",GetName(killerid),GetName(playerid));
	        SendClientMessageToAll(0xA9A9A9AA,string);
	        SendDeathMessage(killerid,playerid,reason);

	    }
	}

	SetPlayerWantedStars(playerid, 0);
	SetPlayerColor(playerid,COLOR_GRAY);
	
    return 1;
}
This never happened in my old gamemode and its was written the same way as it is here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)