Heal Command
#1

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.
Reply
#2

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

thanks
Reply
#4

Np
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)