SA-MP Forums Archive
Heal Command - 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: Heal Command (/showthread.php?tid=468550)



Heal Command - AnonScripter - 08.10.2013

well i did heal command and everything works perfect, but:
i put:


pawn Код:
if(targetstate == PLAYER_STATE_ONFOOT && playerstate == PLAYER_STATE_ONFOOT  || targetstate == PLAYER_STATE_DRIVER && playerstate == PLAYER_STATE_PASSENGER || targetstate == PLAYER_STATE_PASSENGER && playerstate == PLAYER_STATE_DRIVER ||targetstate == PLAYER_STATE_PASSENGER && playerstate == PLAYER_STATE_PASSENGER)
{
    //heal the player
}
else
{
    if(playerstate == PLAYER_STATE_ONFOOT && targetstate == PLAYER_STATE_DRIVER || playerstate == PLAYER_STATE_ONFOOT && targetstate == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid, COLOR_WHITE, "Error: This player is in a vehicle, you must be in his vehicle to be able to heal him.");
    }
    else
    {
        if(playerstate == PLAYER_STATE_DRIVER && targetstate == PLAYER_STATE_ONFOOT || playerstate == PLAYER_STATE_PASSENGER && targetstate == PLAYER_STATE_ONFOOT)
        {
            SendClientMessage(playerid, COLOR_WHITE, "Error: This player is onfoot, you must be in the same state to be able to heal him.");
        }
    }
    return 1;
}
But i found a problem:
example:
playerid is in a car
targetid is in another car

if playerid came in range of point of targetid and type /heal
he will heal the targetid even if the targetid in another car, so my script depends on if player and target in same states, not same car -.-

so how to make the command works only if the target and player in same car.



Re: Heal Command - EiresJason - 08.10.2013

pawn Код:
if(GetPlayerVehicleID(playerid) == GetPlayerVehicleID(targetid))
{
    //heal the player
}



Re: Heal Command - AnonScripter - 09.10.2013

thanks


Re: Heal Command - EiresJason - 09.10.2013

Np