SA-MP Forums Archive
OnPlayerDeath Scenarios. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDeath Scenarios. (/showthread.php?tid=598603)



OnPlayerDeath Scenarios. - yvoms - 14.01.2016

I'm having a few issues with my OnPlayerDeathScenario.

Код:
		if(gTeam[killerid] == TEAM_CIVIL)
		{
		SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 6);
		}

		if(gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIVIL)
		{
			if(GetPlayerWantedLevel(playerid) == 0)
			{
			SetPlayerScore(killerid, GetPlayerScore(killerid)-5);
			SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed an innocent player and have been fined with 7.5K and -5 score.");
			GivePlayerMoney(killerid, -7500);
			}
		}
		if(gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIVIL)
		{
			if(GetPlayerWantedLevel(playerid) >= 1 && GetPlayerWantedLevel(playerid) <= 3)
			{
			SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
			SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a Low Suspect Player, You got fined 2.5k and -1 score, /ticket them in the future.");
			GivePlayerMoney(killerid, -2500);
			}
		}
		if(gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIVIL)
		{
			if(GetPlayerWantedLevel(playerid) >= 4 && GetPlayerWantedLevel(playerid) <= 5)
			{
			SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
			SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a Suspected Player, You got 2.5k and +1 score.");
			GivePlayerMoney(killerid, 2500);
			}
		}
		if(gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIVIL)
		{
			if(GetPlayerWantedLevel(playerid) >= 6 && GetPlayerWantedLevel(playerid) <= 255)
			{
			SetPlayerScore(killerid, GetPlayerScore(killerid)+5);
			SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a High suspect player, you got 10K and 5 Score.");
			GivePlayerMoney(killerid, 1000);
			}
		}
The only thing working right now is when a civillian kills a civillian, or when a cop shoots an innocent player.
The other If scenarios do not work, so i was hoping someone see's something im not seeing.


Re: OnPlayerDeath Scenarios. - Eth - 14.01.2016

pawn Код:
if(gTeam[killerid] == TEAM_CIVIL)
        {
        SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 6);
        }

        if((gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY) && gTeam[playerid] == TEAM_CIVIL)
        {
            if(GetPlayerWantedLevel(playerid) == 0)
            {
            SetPlayerScore(killerid, GetPlayerScore(killerid)-5);
            SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed an innocent player and have been fined with 7.5K and -5 score.");
            GivePlayerMoney(killerid, -7500);
            }
        }
        if((gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY) && gTeam[playerid] == TEAM_CIVIL)
        {
            if(GetPlayerWantedLevel(playerid) >= 1 && GetPlayerWantedLevel(playerid) <= 3)
            {
            SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
            SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a Low Suspect Player, You got fined 2.5k and -1 score, /ticket them in the future.");
            GivePlayerMoney(killerid, -2500);
            }
        }
        if((gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY) && gTeam[playerid] == TEAM_CIVIL)
        {
            if(GetPlayerWantedLevel(playerid) >= 4 && GetPlayerWantedLevel(playerid) <= 5)
            {
            SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
            SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a Suspected Player, You got 2.5k and +1 score.");
            GivePlayerMoney(killerid, 2500);
            }
        }
        if((gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY) && gTeam[playerid] == TEAM_CIVIL)
        {
            if(GetPlayerWantedLevel(playerid) >= 6 && GetPlayerWantedLevel(playerid) <= 255)
            {
            SetPlayerScore(killerid, GetPlayerScore(killerid)+5);
            SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a High suspect player, you got 10K and 5 Score.");
            GivePlayerMoney(killerid, 1000);
            }
        }



Re: OnPlayerDeath Scenarios. - yvoms - 14.01.2016

oh derp, how could i miss that..
Thank you. + rep.


Re: OnPlayerDeath Scenarios. - yvoms - 14.01.2016

Unfortunately this was not causing it, it still serves me the innocent player message.


Re: OnPlayerDeath Scenarios. - Eth - 14.01.2016

pawn Код:
if(gTeam[killerid] == TEAM_CIVIL)
        {
        SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 6);
        }
        else if((gTeam[killerid] == TEAM_COP || gTeam[killerid] == TEAM_FBI || gTeam[killerid] == TEAM_CIA || gTeam[killerid] == TEAM_ARMY) && gTeam[playerid] == TEAM_CIVIL)
        {
            if(GetPlayerWantedLevel(playerid) == 0)
            {
            SetPlayerScore(killerid, GetPlayerScore(killerid)-5);
            SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed an innocent player and have been fined with 7.5K and -5 score.");
            GivePlayerMoney(killerid, -7500);
            }
            else if(GetPlayerWantedLevel(playerid) >= 1 && GetPlayerWantedLevel(playerid) <= 3)
            {
            SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
            SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a Low Suspect Player, You got fined 2.5k and -1 score, /ticket them in the future.");
            GivePlayerMoney(killerid, -2500);
            }          
                        else if(GetPlayerWantedLevel(playerid) >= 4 && GetPlayerWantedLevel(playerid) <= 5)
            {
            SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
            SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a Suspected Player, You got 2.5k and +1 score.");
            GivePlayerMoney(killerid, 2500);
            }
            else if(GetPlayerWantedLevel(playerid) >= 6 && GetPlayerWantedLevel(playerid) <= 255)
            {
            SetPlayerScore(killerid, GetPlayerScore(killerid)+5);
            SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Warning]{FFFFFF}: You have killed a High suspect player, you got 10K and 5 Score.");
            GivePlayerMoney(killerid, 1000);
            }
        }
Try this :P

EDIT:
also make sure that you don't set the player's wanted level to 0 before these statements


Re: OnPlayerDeath Scenarios. - yvoms - 14.01.2016

unfortunately that does not work either, it keeps sending me the message "{FF0000}[Warning]{FFFFFF}: You have killed an innocent player and have been fined with 7.5K and -5 score."
Even when the player has 1 | 2 | 3 | 4 | 5 | 6 | 100 wanted levels on him it keeps sending that message.


Re: OnPlayerDeath Scenarios. - Eth - 14.01.2016

I edited the reply above check it out


Re: OnPlayerDeath Scenarios. - yvoms - 15.01.2016

thanks, now it works.
would this work?
Код:
			else if(GetPlayerWantedLevel(playerid) >= 6 && GetPlayerWantedLevel(playerid) <= 255)
			{
				new wantedp, rewardp;
				wantedp = GetPlayerWantedLevel(playerid);
				rewardp = GivePlayerMoney(playerid, wantedp *500);
				SetPlayerScore(killerid, GetPlayerScore(killerid)+5);
				SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Server]:{FFFFFF} You have killed a High suspect player, you got 10K and 5 Score.");
				GivePlayerMoney(killerid, rewardp +1000);
			}
Trying to get the players wantedlevel, wantedlevel X 500 = payment you receive for killing the criminal.


Re: OnPlayerDeath Scenarios. - xTURBOx - 15.01.2016

Quote:
Originally Posted by yvoms
Посмотреть сообщение
thanks, now it works.
would this work?
Код:
			else if(GetPlayerWantedLevel(playerid) >= 6 && GetPlayerWantedLevel(playerid) <= 255)
			{
				new wantedp, rewardp;
				wantedp = GetPlayerWantedLevel(playerid);
				rewardp = GivePlayerMoney(playerid, wantedp *500);
				SetPlayerScore(killerid, GetPlayerScore(killerid)+5);
				SendClientMessage(killerid, COLOR_WHITE, "{FF0000}[Server]:{FFFFFF} You have killed a High suspect player, you got 10K and 5 Score.");
				GivePlayerMoney(killerid, rewardp +1000);
			}
Trying to get the players wantedlevel, wantedlevel X 500 = payment you receive for killing the criminal.
erm, i think i should work( but you need to format the message, and u are giving the money twice)
PHP код:
else if(GetPlayerWantedLevel(playerid) >= && GetPlayerWantedLevel(playerid) <= 255)
            {
                new 
wantedprewardp,string;
                
wantedp GetPlayerWantedLevel(playerid);
                
rewardp GivePlayerMoney(killeridwantedp *500);
                
SetPlayerScore(killeridGetPlayerScore(killerid)+5);
format(string,sizeof(string),"{FF0000}[Server]:{FFFFFF} You have killed a suspect of %i wanted level, you got $%i and 5 Score",wantedp,rewardp);
                
SendClientMessage(killeridCOLOR_WHITEstring);
            } 



Re: OnPlayerDeath Scenarios. - Pottus - 15.01.2016

This is a real shitty way to try and script possibilities you should really use switches and lay out every possible interaction then then call whatever function needs to be called. All of your helpers have babbled you in bullshit but this is the straight goods and eliminates any confusion you might have when it comes to interactions between player teams.

Код:
switch(gTeam[playerid])
{
	case TEAM_COP:
	{
		switch(gTeam[killerid])
		{
		    case TEAM_COP: {}
			case TEAM_CIA: {}
			case TEAM_ARMY: {}
			case TEAM_CIVIL: {}
		}
	}
	case TEAM_CIA:
	{
		switch(gTeam[killerid])
		{
		    case TEAM_COP: {}
			case TEAM_CIA: {}
			case TEAM_ARMY: {}
			case TEAM_CIVIL: {}
		}
	}
	case TEAM_ARMY:
	{
		switch(gTeam[killerid])
		{
		    case TEAM_COP: {}
			case TEAM_CIA: {}
			case TEAM_ARMY: {}
			case TEAM_CIVIL: {}
		}
	}
	case TEAM_CIVIL:
	{
		switch(gTeam[killerid])
		{
		    case TEAM_COP: {}
			case TEAM_CIA: {}
			case TEAM_ARMY: {}
			case TEAM_CIVIL: {}
		}
	}
}