Pick People in the range of a player - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Pick People in the range of a player (
/showthread.php?tid=73379)
Pick People in the range of a player -
Trooper[Y] - 14.04.2009
In the Function:
Код:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if((newkeys & KEY_FOOT_FIRE) == (KEY_FOOT_FIRE))
{
if(GetPlayerWeapon(playerid) == 17)
{
new Float:x, Float:y, Float:z, Float:a;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, a);
x += (15 * floatsin(-a, degrees));
y += (15 * floatcos(-a, degrees));
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInRangeOfPoint(15, playerid, x, y, z) )
{
SendClientMessage(playerid,0x000000,"Testmsg");
ApplyAnimation(playerid,"PED","Drown",4.1,0,1,1,1,1);
lookatx = -1000;
lookaty = -1000;
lookatz = -1000;
return 1;
}
}
}
return 0;
}
, just the Player, who trigger the
Код:
OnPlayerKeyStateChange
get the Testmessage..
So i want to pick every player in a defined range to the acting player....
But the script doesn`t ...
[Probably its because var "playerid" is all the Func defined as the triggerer of OnPlayerKeyStateChange, so "if people are close to me,show me the message, if not,do not".
I just want to show the message to the people in range...
Probably someone can explain my mistake to me, fix the issue or something like that?
Would be nice and you will get "Done very well" from me

,
Trooper
Re: Pick People in the range of a player -
OmeRinG - 14.04.2009
pawn Код:
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerInRangeOfPoint(15, i, x, y, z) )
{
SendClientMessage(playerid,0x000000,"Testmsg");
ApplyAnimation(playerid,"PED","Drown",4.1,0,1,1,1,1);
lookatx = -1000;
lookaty = -1000;
lookatz = -1000;
return 1;
}
}
}