Adding more than one location to a 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: Adding more than one location to a command (
/showthread.php?tid=400952)
Adding more than one location to a command -
nLs - 21.12.2012
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;
}
Re: Adding more than one location to a command -
Joshman543 - 21.12.2012
PHP код:
if(!IsPlayerInRangeOfPoint(playerid, 10, 376.4745,-67.4357,1001.5078)) || if(!IsPlayerInRangeOfPoint(playerid, COORDS MUMBO JUMBO)) return SendClientMessage(playerid, COLOR_RED, "You're not at a restaurant!");
Re: Adding more than one location to a command -
EAsT-OAK_510 - 21.12.2012
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;
}