Help With Player Chat
#1

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

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);
}
Reply
#3

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

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.
Reply
#5

Код:
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.
Reply
#6

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
Reply
#7

wat is da range most servers use
Reply
#8

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
Reply
#9

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.
Reply
#10

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)