Proper /me system
#1

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

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

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

Nearby players.
Reply
#5

Bump
Reply
#6

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

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

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

Bump
Reply
#10

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

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

bump
Reply
#13

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 :/
Reply
#14

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


Forum Jump:


Users browsing this thread: 4 Guest(s)