[Help] Foreach - 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: [Help] Foreach (
/showthread.php?tid=478249)
[Help] Foreach -
RooK1e - 28.11.2013
hello,
ProxDetectorS don't work , player can look message everywhere. How to fix that?
Код:
Chat(random, color, string[])
{
foreach(Player, i)
{
if(GetPVarInt(i, "IDT") == random)
{
new Float:X, Float:Y, Float:Z;
new playerid,giveplyerid;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerPos(giveplayerid, X, Y, Z);
if (ProxDetectorS(3.0, playerid, giveplayerid))
{
SendClientMessage(i, color, string);
}
else SendClientMessage(playerid,COLOR_VBl,"Error");
}
}
}
Re: [Help] Foreach -
Lynet - 28.11.2013
Could you eventually explain what's wrong?
Re: [Help] Foreach -
RooK1e - 28.11.2013
player has to see the message only if is in radius,but he see message everywhere
Re: [Help] Foreach -
Jstylezzz - 28.11.2013
Please post your ProxDetectorS code between pawn tags. The code you posted seems to do what it should.
Re: [Help] Foreach -
RooK1e - 28.11.2013
Код:
ProxDetectorS(Float:radi, playerid, targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
{
new Float:posx,
Float:posy,
Float:posz,
Float:oldposx,
Float:oldposy,
Float:oldposz,
Float:tempposx,
Float:tempposy,
Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
GetPlayerPos(targetid, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
}
return 0;
}
Re: [Help] Foreach -
Joe_Goro - 28.11.2013
RooK1e
type
Код:
[pawn ]
your code
[/pawn ]
Edit : sorry i dont know much about proxdetect