Can someone teach me this. - 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: Can someone teach me this. (
/showthread.php?tid=544029)
Can someone teach me this. -
kingcrome - 30.10.2014
Can someone teach me about the IfPlayerIsInRangeOfPoint code and how to put in in use in command so the player has to be near a certain point to use the command.
Re: Can someone teach me this. -
M4D - 30.10.2014
IsPlayerInRangeOfPoint(playerid, range, X, Y, Z)
check playerid in range of X , Y , Z coordinates with radius range.
for example you want to make a " /heal " command that work just near hospital. (max distance is 10)
hospital coord is :
1212.258, -1326.565, 15.0
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/heal", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid,10.0,1212.258, -1326.565, 15.0))
{
SetPlayerHealth(playerid,100.0);
}
else
{
SendClientMessage(playerid,-1,"{FF0000}you should near hospital to use this command.");
}
return 1;
}
return 0;
}
Re: Can someone teach me this. -
Rudy_ - 30.10.2014
And use Zcmd instead.
pawn Код:
CMD:heal(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, 10, 1212.258, -1326.565, 15.0) return SendClientMessage(playerid, -1, "You should be near hospital to use this command.");
SetPlayerHealth(playerid, 100.0);
return 1;
}