OnPlayerWeaponShot Help?
#1

Hi. I need your help with OnPlayerWeaponShot How to i can create a When Player Take 1shot From Warrent the Cops cannot arrest him if he were wanted +4star. How to do that? I've adding this but when I push him i'll got +4 but i dont want Like this

Example: YOU CANNOT ARREST THIS PLAYER BECAUSE HE SHOOTING YOU!! Do you know what i mean? If a warrent shooted cops and the cop need arrest him Make it Cannot How?


PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ

    if(
hittype == BULLET_HIT_TYPE_PLAYER
    { 
        if(
gTeam[hitid] == IsPlayerACop
        { 
            
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 4);  
        } 
    } 
    return 
1

Reply
#2

Is there any help?
Reply
#3

On the top of your script add:
PHP код:
new CannotArrest[MAX_PLAYERS]; 
PHP код:
    if(gTeam[playerid] != IsPlayerACop)
    {
        if(
GetPlayerWantedLevel(hitid) == 4)
        {
            
SendClientMessage(playerid, -1"You cannot shoot this player as his wanted level is greater than 4.);
            CannotArrest[hitid] = 1;
            return 0;
        }
    } 
In your /arrest command add so he can only be arrested if CannotArrest = 0.
Reply
#4

Sit in not mean to cops cannot shot wanted level 4 I mean

If a player wanted lecel+4 and heek shoot the cops the policeMan cannot arrest because he took damage how to do that
Thanks for reply
Reply
#5

Just check with your arrest command if the player has 4 wanted levels he she cannot be arrested...
Reply
#6

XD That's my problem i dont know how to do that!!
Reply
#7

No problem, just do this.

On the top of your script add:
PHP код:
new CriminalDamage[MAX_PLAYERS]; 
PHP код:
    if(gTeam[playerid] != IsPlayerACop)
    {
        if(
GetPlayerWantedLevel(playerid) == 4)
        {
            
SendClientMessage(playerid, -1"You shot this police officer, he can no longer arrest you as your wanted level is 4.");
            
CriminalDamage[hitid] = 1;
            return 
0;
        }
    } 
In your /arrest command add this:
PHP код:
CMD:arrest
{
if(
CriminalDamage[playerid] > 0) return SendClientMessage(playerid, -1"You may not arrest this player as you took damage from a wanted suspect who had a wanted level of 4.");

Make a timer etc to remove the global variable.
Reply
#8

A Error:

Код:
error 076: syntax error in the expression, or invalid function call

if(gTeam[playerid] != IsPlayerACop)
Reply
#9

Can you show the code for IsPlayerACop
Reply
#10

This!
Код:
stock IsPlayerACop(skinid)
{
	// includes corrupt cops from singleplayer, SWAT, FBI and Army skin and 0.3.7 cop ones
	switch(skinid)
	{
		case 265..267, 280..288, 300..302, 306, 307, 309..311: return 1;
	    default: return 0;
	}

	return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)