help - 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 (
/showthread.php?tid=114635)
help -
Mystique - 20.12.2009
So I was wondering if someone could explain to me about how to make a ranged chat like /s for shout. I don't want the whole script ready that it's just copy paste. I want someone to explain in details the parts of the script that I can make my own.
Re: help -
Marcel - 20.12.2009
In your command, first get the position of playerid.
pawn Код:
GetPlayerPos(playerid, X, Y, Z)
Then use a loop.
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
In that loop do a check with IsPlayerInRangeOfPoint.
pawn Код:
if(IsPlayerInRangeOfPoint(i, 10.0, X, Y, Z)
If that is true, send the message, if not, return false. Altough I recommend you to use
foreach.
Re: help -
Mystique - 20.12.2009
Thanks I'll try it

I'll write if I get any problems
Re: help -
Mystique - 21.12.2009
Hey can you post the whole script so that I can study it?
Re: help -
Marcel - 21.12.2009
http://forum.sa-mp.com/index.php?topic=116240.0
I am using that command system and sscanf, which can be found here:
https://sampwiki.blast.hk/wiki/Sscanf
pawn Код:
COMMAND:s(playerid, params[])
{
new
msg[ 128 ];
if (sscanf(params, "s", msg)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /s [message]");
else
{
new
pName[ MAX_PLAYER_NAME ],
string[ 155 ],
Float: X,
Float: Y,
Float: Z;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(playerid, pName, sizeof( pName ) );
format(string, sizeof(string), "%s: %s", pName, msg );
for( new i = 0; i < MAX_PLAYERS; i++ )
{
if(IsPlayerInRangeOfPoint(i, 10.0, X, Y, Z )
{
SendClientMessage(i, 0xFFFF00AA, string );
}
}
}
return 1;
}
Change the 10.0 here: if(IsPlayerInRangeOfPoint(i, 10.0, X, Y, Z ) to whatever you want to be the distance a player can be away from the player who is typing the command.
Re: help -
Mystique - 21.12.2009
ok thanks ill try