SA-MP Forums Archive
Help With Player Chat - 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: Help With Player Chat (/showthread.php?tid=133141)



Help With Player Chat - Keeboo13 - 11.03.2010

How do i make it so player cant chat from a certain distance...


Re: Help With Player Chat - Backwardsman97 - 11.03.2010

Replace the distance and the coordinates to whatever you need them for.

pawn Код:
public OnPlayerText(playerid,text[])
{
    if(IsPlayerInRangeOfPoint(playerid,distance, X, Y, Z))
    {
      SendClientMessage(playerid,ERROR,"You are too far away from whatever. You may not speak.");
      return 0;
    }
    return 1;
}

stock IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
{
    new
        Float:px,
        Float:py,
        Float:pz;
    GetPlayerPos(playerid, px, py, pz);
    px -= x;
    py -= y;
    pz -= z;
    return ((px * px) + (py * py) + (pz * pz)) < (range * range);
}



Re: Help With Player Chat - Keeboo13 - 11.03.2010

can u set it for me i want it just like other scripts distances


Re: Help With Player Chat - Correlli - 11.03.2010

Quote:
Originally Posted by Backwardsman97
pawn Код:
stock IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
{
    new
        Float:px,
        Float:py,
        Float:pz;
    GetPlayerPos(playerid, px, py, pz);
    px -= x;
    py -= y;
    pz -= z;
    return ((px * px) + (py * py) + (pz * pz)) < (range * range);
}
IsPlayerInRangeOfPoint function is already a sa:mp native.


Re: Help With Player Chat - Keeboo13 - 11.03.2010

Код:
C:\Users\KeeBoo~MR.Xbox.Live\Desktop\GTA Samp\gamemodes\rlrp.pwn(445) : error 017: undefined symbol "distance"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Help With Player Chat - Deat_Itself - 11.03.2010

Quote:
Originally Posted by Keeboo13
Код:
C:\Users\KeeBoo~MR.Xbox.Live\Desktop\GTA Samp\gamemodes\rlrp.pwn(445) : error 017: undefined symbol "distance"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
he just given u an example .He didnt said to write here distance "Its a type of range" put it 10.0 or if u want more range so put it 20.0 what ever u want


Re: Help With Player Chat - Keeboo13 - 14.03.2010

wat is da range most servers use


Re: Help With Player Chat - Deat_Itself - 14.03.2010

Quote:
Originally Posted by Keeboo13
wat is da range most servers use
well thats not depend on others .That depends on you ,if you need large range so no one can chat from it so put 40.0 or 30.0 or if you want small range then put 10.0


Re: Help With Player Chat - Keeboo13 - 14.03.2010

wat is da godfather and when i do add this
Код:
public OnPlayerText(playerid,text[])
{
if(IsPlayerInRangeOfPoint(playerid,10.0,10.0,10.0))
{
  SendClientMessage(playerid,COLOR_GRAD1,"You are too far away from whatever. You may not speak.");
  return 0;
}
return 1;
}
i get this warning
Код:
C:\Users\Boy ifdsg\TA Samp\gamemodes\rlrp.pwn(2436) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.



Re: Help With Player Chat - Correlli - 14.03.2010

Quote:
Originally Posted by Keeboo13
Код:
C:\Users\Boy ifdsg\TA Samp\gamemodes\rlrp.pwn(2436) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
IsPlayerInRangeOfPoint(playerid, Float:range, Float, Float:y, Float:z);