How To Make OnPlayerTakeDamage.
#1

Hello everyone? I Need your help now!! Guys i've making a command for police and there are no problem but i need your help for OnPlayerTakeDamage If someone had shooted police and he were wanted +4wanted level Police cannot arrest him Because he shooting police And if he are not shot police The cop can arrest him. how to do that? Convert?!

Can you do that pls ?
PHP код:
CMD:ar(playeridparams[])
{
    new 
pskin GetPlayerSkin(playerid);
    if(
pskin == 265 || pskin == 266 || pskin == 267 || pskin == 280 || pskin == 281 || pskin == 284 || pskin == 285 || pskin == 286 || pskin == 287 || pskin == 288)
    {
         return 
SendClientMessage(playerid0xFF0000AA"{FF0017}[ERROR]{FFFFFF}: Only Cops can use this command.");
    }
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[128];
    new 
Float:targetidpos[3];
    if(
GetPlayerInterior(targetid) > 0) return SendClientMessage(playeridred"ERROR: You can't arrest players inside an interior.");
    if(
sscanf(params"ui"targetid)) SendClientMessage(playeridCOLOR_WHITE"USAGE: /ar <playerid> / <PlayerName>");
    if(
GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"Please wait 5 seconds before arresting a suspect again.");
    if(
PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playeridred"This player is already in jail,you can't arrest him.");
    if(
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle.");
    if(
GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playeridred"{FF0000}ERROR: {FFFFFF}[ERROR]: No eligible players are in range to receive a ticket.");
    if(
GetPlayerWantedLevel(targetid) <= 2) return SendClientMessage(playeridred"{FF0000}ERROR: {FFFFFF}[ERROR]: No eligible players are in range to receive a ticket.");
    if(
GetPlayerWantedLevel(targetid) <= 1) return SendClientMessage(playeridred"{FF0000}ERROR: {FFFFFF}[ERROR]: No eligible players are in range to receive a ticket.");
    if(
GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playeridred"This player is not wanted,you can't arrest him");
    if(
playerid == targetid) return SendClientMessage(playerid,red"You can't arrest yourself,you stupid or what?");
    if(
gTeam[playerid] == TEAM_COP && gTeam[targetid] == TEAM_COP) return SendClientMessage(playerid,red"You can't arrest who is in your team.");
    
GetPlayerPos(playeridtargetidpos[0], targetidpos[1], targetidpos[2]);
    if (!
IsPlayerInRangeOfPoint(playerid5.0targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1"Nobody close enough to arrest.");
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(targetidtNamesizeof(tName));
        if(
IsPlayerConnected(targetid))
        {
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                
format(stringsizeof(string), "You have been arrested by %s (%d)."pNameplayerid);
                
SendClientMessage(targetidredstring);
                
ShowDescriptionText(targetidstring);
                
SetPlayerAttachedObject(targetid9194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
format(stringsizeof(string), "~b~Arrested by %s (%d)"pNameplayerid);
                
GameTextForPlayer(targetidstring40005);
                
format(stringsizeof(string), "You have arrested %s (%d) and recieved $5000 as a bonus!"tNametargetid);
                
SendClientMessage(playeridredstring);
                
ShowDescriptionText(playeridstring);
                new 
current_zone player_zone[targetid];
                
format(stringsizeof(string), "Suspect %s (%d) has been arrested by %s (%d) - Location: %s"tNametargetidpNameplayerid,zones[current_zone][zone_name]);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~b~%s (%d) arrested, Well Done! You have recieved $5000 as a bonus."tNametargetid);
                
GameTextForPlayer(playeridstring40005);
                
GivePlayerMoney(playerid5000);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"1000true"i"targetid);
                
pJailCount[targetid] = 20 random(41);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][3]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
                for(new 
i=0;i<MAX_PLAYERS;i++)
                {
                if(!
IsPlayerConnected(i))continue;
                if(
gTeam[i] == TEAM_COP)
                {
                new 
copmsg[170];
                
format(copmsgsizeof(copmsg), "%s (%d) has arrested %s (%d)",pName,playerid,tName,targetid);
                
SendClientMessage(iCOLOR_BLUEcopmsg);
                }
                }
                }
                }
                return 
1;

Reply
#2

How to do that?
Reply
#3

None known how to do that?? pls
Reply
#4

I don't really understand what you're trying to say but if someone shoots a TEAM_COP player their wanted level is +4?

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
hittype == BULLET_HIT_TYPE_PLAYER)
    {
        if(
gTeam[hitid] == TEAM_COP && gTeam[playerid] != TEAM_COP)
        {
            
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 4); 
        }
    }
    return 
1;

Reply
#5

Thank you for reply my problem is:: When A Player shooted a police man And he were wanted the police man cannot arrest him because The Player shooting him.. understand??
Reply
#6

SO ANYONE?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)