How to make this go a certain range -
JoeDaDude - 21.01.2010
How can i make this message
pawn Код:
SendClientMessageToAll(COLOR_YELLOW, "Officer [name will go here eventually], Pull your car over to the side of the road");
Go a certain range, So not everyone can see it, Just within a certain range,
And how would i do it if i said, /megaphone [MESSAGE HERE] so like, /megaphone Pull Over
It would say,
Officer Torran, Pull Over,
Like that? Also within a certain range
Also i dont wanna know how to make it say my name, Just how to make it say whatever i type
Re: How to make this go a certain range -
¤Adas¤ - 21.01.2010
Try to use format and IsPlayerInRangeOfPoint. Good luck.
Re: How to make this go a certain range -
JoeDaDude - 21.01.2010
Dont think that will work tbh
Re: How to make this go a certain range -
Correlli - 21.01.2010
Quote:
Originally Posted by JoeDaDude
Dont think that will work tbh
|
Indeed it will, you just need to know how to use it. Make a loop for all players (except the player who sent a message) and check if they're in range of point of the player who sent the message.
Re: How to make this go a certain range -
Miguel - 21.01.2010
pawn Код:
dcmd_megaphone(playerid, params[])
{
new
string[128],
message[104];
if(sscanf(params, "s", message))
{
SendClientMessage(playerid, COLOR, "Usage: /megaphone [message]");
}
else
{
format(string, sizeof(string), "Officer [%s]: %s!", GetPlayerName(playerid), message);
SendClientMessage(playerid, COLOR, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
while(GetDistanceBetweenPlayers(playerid, i) < range) // change range for distance
{
SendClientMessage(i, COLOR, string);
}
}
}
return 1;
}
Re: How to make this go a certain range -
JoeDaDude - 21.01.2010
How to know how far like 1.0 range is, and 2.0, ect
Re: How to make this go a certain range -
Miguel - 21.01.2010
Quote:
Originally Posted by JoeDaDude
How to know how far like 1.0 range is, and 2.0, ect
|
Same units when getting player pos, and btw, i changed something in that code.
You can also use
IsPlayerInRangeOfPoint and
GetPlayerPos.
Re: How to make this go a certain range -
JoeDaDude - 21.01.2010
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(376) : warning 202: number of arguments does not match definition
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(376) : warning 202: number of arguments does not match definition
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(380) : error 017: undefined symbol "GetDistanceBetweenPlayers"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Also id appreciate it if someone could reply here too:
http://forum.sa-mp.com/index.php?topic=147542.0
The latest reply, I need help on that also, Shouldnt be too hard to fix
Re: How to make this go a certain range -
Correlli - 21.01.2010
GetDistanceBetweenPlayers is a custom function, you'll need to search for it on this forum.
Re: How to make this go a certain range -
JoeDaDude - 21.01.2010
Ok done and thats done,
Now left is 2 more errors
Код:
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(376) : warning 202: number of arguments does not match definition
C:\Program Files\Rockstar Games\GTA San Andreas\sa-mp\gamemodes\gamemode.pwn(376) : warning 202: number of arguments does not match definition