Chat with range: - 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: Chat with range: (
/showthread.php?tid=502263)
Chat with range: -
LostGaming2014 - 23.03.2014
I am creating a RP script and I am new to scripting so I need to know how to create a chat with range, like for talking Icly.
Re: Chat with range: -
HitterHitman - 23.03.2014
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(w,1,cmdtext)
return 0;
}
dcmd_w(playerid,params[])
{
new Pname[28];
GetPlayerName(playerid,Pname,sizeof(Pname));
new string[128];
if(!strlen(params))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /w (msg)");
return 1;
}
format(string, sizeof(string), "[WHISPER] %s(%d): %s",Pname(playerid),playerid,params);
printf("%s", string);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && GetDistanceBetweenPlayers(playerid,i) < 10)
{
format(string, sizeof(string), "[WHISPER] %s(%d): %s",Pname(playerid),playerid,params);
SendClientMessage(i,COLOR_YELLOW,string);
}
}
return 1;
}
Its just a example try it.
Re: Chat with range: -
ChristianIvann09 - 23.03.2014
Can you script for me ?
Add me at skype : christianivann09
Re: Chat with range: -
Hanuman - 23.03.2014
Код:
CMD:s(playerid,params[]) {
if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /s [text] to talk to nearest person");
new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name));
new string[128], Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
format(string, sizeof(string), "[%s] says: %s", Name, params[0]);
new str[128];
format(str, sizeof(str),"[SAY] %s: %s", Name, params[0]);
printf("%s", string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,50.0, x, y, z) ) SendClientMessage(i, COLOR_RED, string);
}
return 1;
}
Paste this cmd, if u get errors!
Edit: identation is also fixed,ok gshock
Re: Chat with range: -
GShock - 23.03.2014
That identation....