Adding more than one location to a command
#1

Hey! Sorry if this is a dumb question, but I have been struggling to add more than one location (coordinates) to one command.

Heres my command:
Код:
CMD:eat(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 10, 376.4745,-67.4357,1001.5078)) return SendClientMessage(playerid, COLOR_RED, "You're not at a restaurant!");
    {
         KillTimer(HungerTimer);
         SendClientMessage(playerid, COLOR_RED, "Thanks for visiting! Enjoy!");
         GivePlayerMoney(playerid, -10);
         HungerTimer = SetTimerEx("NeedToEat",N2E_TIME,1,"i",playerid);
         SetPlayerHealth(playerid, 100);
    }
	return 1;
}
Reply
#2

PHP код:
if(!IsPlayerInRangeOfPoint(playerid10376.4745,-67.4357,1001.5078)) || if(!IsPlayerInRangeOfPoint(playeridCOORDS MUMBO JUMBO)) return SendClientMessage(playeridCOLOR_RED"You're not at a restaurant!"); 
Reply
#3

Instead of using:

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 10, 376.4745,-67.4357,1001.5078)) return SendClientMessage(playerid, COLOR_RED, "You're not at a restaurant!");
You can do:
pawn Код:
if(!IsAtRestaurant(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You're not at a restaurant!");


//bottom of your script

stock IsAtRestaurant(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 10, x,y,z)) return 1;
    else if(IsPlayerInRangeOfPoint(playerid, 10, x,y,z)) return 1;
    else if(IsPlayerInRangeOfPoint(playerid, 10, x,y,z)) return 1;
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)