#1

When I use /w(hisper) it goes e.g [WHISPER]Testbot: hi, but when someone else uses it it will still do [WHISPER]Testbot: theremessage, it wont load there name, why?

PHP код:
CMD:whisper(playeridparams[])
{
    new 
string[250];
    if (
sscanf(params"s[250]"string))return SendClientMessage(playeridCOLOR_YELLOW"[COMMAND] {FFFFFF}Usage: /w(hisper) [message]");
    new 
Float:x,Float:y,Float:z;
    
GetPlayerPos(playerid,x,y,z);
    new 
string2[250];
     new 
name[MAX_PLAYER_NAME];
    new 
id;
    
GetPlayerName(id,name,sizeof(name));
    
format(string2sizeof(string2), "{D526D9}[WHISPER] {FFFFFF}%s(%i): %s"nameplayeridstring);
    for(new 
0<= MAX_PLAYERSi++)
    {
        if(
IsPlayerInRangeOfPoint(i15.0xyz))
        {
        
SendClientMessage(iCOLOR_WHITEstring2);
        }
    }
    return 
1;

Reply
#2

Cause...the parameter should be sth like
PHP код:
/[playerid playername] [message
If..the player dont send an playerid..it goes to id 0...and this is the bot i think
Reply
#3

PHP код:
GetPlayerName(id,name,sizeof(name)); 
change it to
PHP код:
GetPlayerName(playerid,name,sizeof(name)); 
Reply
#4

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
PHP код:
GetPlayerName(id,name,sizeof(name)); 
change it to
PHP код:
GetPlayerName(playerid,name,sizeof(name)); 
thanks
Reply
#5

You should remove this:
Код:
new string[250]; 
    if (sscanf(params, "s[250]", string))return SendClientMessage(playerid, COLOR_YELLOW, "[COMMAND] {FFFFFF}Usage: /w(hisper) [message]");
And use this:
Код:
if (isnull(params)) return SendClientMessage(playerid, COLOR_YELLOW, "[COMMAND] {FFFFFF}Usage: /w(hisper) [message]");
Because 'params' is already a string. It's a waste of memory to make a new array and store in what's already available in params.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)