SA-MP Forums Archive
Bug - 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: Bug (/showthread.php?tid=611640)



Bug - Godly - 09.07.2016

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;




Re: Bug - Kaliber - 09.07.2016

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


Re: Bug - SyS - 09.07.2016

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



Re: Bug - Godly - 09.07.2016

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


Re: Bug - Stinged - 09.07.2016

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.