Eat Command not working properly
#1

Fixed.
Reply
#2

Why do you have IsPlayerInRangeOfPoint but not check the result? Secondly, it will always display you are no longer hungry because it's not told to do so otherwise(assuming you have the knife).

Also, knifes are weaponID 4 not 8.
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Why do you have IsPlayerInRangeOfPoint but not check the result? Secondly, it will always display you are no longer hungry because it's not told to do so otherwise(assuming you have the knife).

Also, knifes are weaponID 4 not 8.
Thanks for poiting out the ID of the knife and other issues.What do you mean with "not check the results"? like what any example? Thanks!
Reply
#4

Check if the player is in range of the point.
pawn Код:
CMD:eat(playerid) {
    if(GetPlayerWeapon(playerid) != 4) return SendClientMessage(playerid, -1, "You must be holding a knife to eat the human meat!");
    if(!IsPlayerInRangeOfPoint (playerid, 8.0, 2695.6880, -1704.6300, 11.8438)) return SendClientMessage(playerid,COLOR_RED,"You are not near eating place!");
    ApplyAnimation(playerid, "PED", "BOM_Plant ", 4.1, 0, 1, 1, 0, 1, 1);
    SetPlayerHealth(playerid, 100);
    SetTimerEx("needFood",needFoodTimer,1,"i",playerid);
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are no longer hungry");
    return 1;
}

Using IF you are checking if they are near the point. Having IsPlayerInRangeOfPoint wouldnt make any sort of sense to the script.
Reply
#5

Quote:
Originally Posted by TwinkiDaBoss
Посмотреть сообщение
Check if the player is in range of the point.
pawn Код:
CMD:eat(playerid) {
    if(GetPlayerWeapon(playerid) != 4) return SendClientMessage(playerid, -1, "You must be holding a knife to eat the human meat!");
    if(!IsPlayerInRangeOfPoint (playerid, 8.0, 2695.6880, -1704.6300, 11.8438)) return SendClientMessage(playerid,COLOR_RED,"You are not near eating place!");
    ApplyAnimation(playerid, "PED", "BOM_Plant ", 4.1, 0, 1, 1, 0, 1, 1);
    SetPlayerHealth(playerid, 100);
    SetTimerEx("needFood",needFoodTimer,1,"i",playerid);
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are no longer hungry");
    return 1;
}

Using IF you are checking if they are near the point. Having IsPlayerInRangeOfPoint wouldnt make any sort of sense to the script.
Thanks!
That's what I was missing ;/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)