SA-MP Forums Archive
Proper /me system - 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: Proper /me system (/showthread.php?tid=249671)



Proper /me system - Andregood - 19.04.2011

How to actually create a proper /me system? Please elaborate further than just saying; InRange blabla




I'm currently using this, which tells all players about the /me


Код:
 new string[128];
    if(strlen(params) < 5) return SendClientMessage(playerid, 0xAFAFAFAA, "Your action has to contain at least 5 chars.");
    format(string, sizeof(string), "( ( %s [ %d ] ) : %s )", GetName(playerid), playerid, params);
    SendClientMessageToAll(GetPlayerColor(playerid), string);
    return 1;
}
Thanks!


Re: Proper /me system - xir - 19.04.2011

https://sampforum.blast.hk/showthread.php?tid=211599


Re: Proper /me system - admantis - 19.04.2011

Ok but should the command message sent to all or only nearby players?


Re: Proper /me system - Andregood - 20.04.2011

Nearby players.


Re: Proper /me system - Andregood - 20.04.2011

Bump


Re: Proper /me system - s0nic - 20.04.2011

Did you even take the time to check out xir's link..it has a function in which it will send a msg to the players near-by the player that typed it with different ranges of colors that you set.


Re: Proper /me system - mitosking - 20.04.2011

Create a function that send a message to all player in range of player. Mmmm call it "SendRangeMessage". Copy this function into your GM/FS.

Код:
stock SendRangeMessage(playerid, color, const string[], Float: range)
{
new Float: Pos[3]; GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i, range, Pos[0], Pos[1], Pos[2]) SendClientMessage(i, color, string);
}
Now you have your function for send message. You choose range... In example, I choose "15.0".

Код:
if(!strcmp("/hello", cmdtext, true))
{
SendRangeMessage(playerid, white, "Hello!!!", 15.0);
return 1;
}
I don't test my Function "SendRangeMessage", but I think that works!


Re: Proper /me system - Andregood - 20.04.2011

Both of the snippets you gave me are not working, both giving errors with other words.

@CNR, I honestly don't know what's up with that snippet there but it didn't work somehow.

@Mitosking, I'm currently getting those errors..

Код:
D:\SAMP Server\gamemodes\Vampires.pwn(216) : error 010: invalid function or declaration
D:\SAMP Server\gamemodes\Vampires.pwn(218) : error 021: symbol already defined: "SendRangeMessage"
D:\SAMP Server\gamemodes\Vampires.pwn(219) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase



Re: Proper /me system - Andregood - 22.04.2011

Bump


Re: Proper /me system - captainjohn - 22.04.2011

Why have you defined this twice?
Код:
D:\SAMP Server\gamemodes\Vampires.pwn(218) : error 021: symbol already defined: "SendRangeMessage"



Re: Proper /me system - Andregood - 22.04.2011

I believe this part
Код:
 if(!strcmp("/hello", cmdtext, true))
{
SendRangeMessage(playerid, white, "Hello!!!", 15.0);
return 1;
}
is the problem, it all compiles fine until just this snippet. Could you please convert it into sscanf? Thanks.


Re: Proper /me system - Andregood - 22.04.2011

bump


Re: Proper /me system - alpha500delta - 22.04.2011

Quote:
Originally Posted by Andregood
Посмотреть сообщение
I believe this part
Код:
 if(!strcmp("/hello", cmdtext, true))
{
SendRangeMessage(playerid, white, "Hello!!!", 15.0);
return 1;
}
is the problem, it all compiles fine until just this snippet. Could you please convert it into sscanf? Thanks.
You can't convert that code into sscanf :/


Re: Proper /me system - Andregood - 22.04.2011

Quote:
Originally Posted by alpha500delta
Посмотреть сообщение
You can't convert that code into sscanf :/
Alright, thanks.