ApplyAnimation problem
#2

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(newkeys == KEY_FIRE)
        {
            new Float:health;
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            new string[128];
            new pName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(IsPlayerInRangeOfPoint(i, 1.0, x, y, z))
                {
                    new pHealth = GetPlayerHealth(i, health);
                    SetPlayerHealth(i, pHealth-10);
                    format(string, sizeof(string), "You have been punched by %s", pName);
                    PlayerPlaySound(i, 1130, 0.0, 0.0, 0.0);
                    PlayerPlaySound(playerid, 1130, 0.0, 0.0, 0.0);
                    SendClientMessage(i, 0xFFFF00AA, string);
                }
                else
                {
                      SendClientMessage(i, 0xFFFF00AA, "You are not near a vehicle");
                }
            }
        }
    }
    return 1;
}
Shouldn't you have like an "else" so if they are not close nothing happens and you won't lose health?
Reply


Messages In This Thread
2 problems! - by Mean - 26.12.2010, 20:33
Re: ApplyAnimation problem - by ToPhrESH - 26.12.2010, 22:24
Re: ApplyAnimation problem - by Mean - 26.12.2010, 22:32
Re: ApplyAnimation problem - by ToPhrESH - 26.12.2010, 22:37
Re: ApplyAnimation problem - by JamesC - 26.12.2010, 23:31
Re: ApplyAnimation problem - by Mean - 27.12.2010, 09:28

Forum Jump:


Users browsing this thread: 1 Guest(s)