sscanf "u" and "s[126]" specifier bug
#1

Hi guys,
I when use command that has "u" or "s[126]" not show the how to usage the command
example:
pawn Code:
CMD:w(playerid, params[])
{
    LoginCheck(playerid);
    new string[256],pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(sscanf(params,"s[356]",params)) return Usage(playerid,"w <matn> - Baray Chat Dargooshi");
    format(string,sizeof(string),""white"[DarGooshi]%s: %s",pname,params);
    SendNearMessage( playerid, 0xFFFFFFF, string, 12.1);

    format(sb_string, sizeof(sb_string),"{FF9000}[DarGooshi] {FFFFFF}%s", params);
    SetPlayerChatBubble(playerid, sb_string, 0xFFFFFFFF, 16.0,4000);
    return 1;
}
I typed /w not show the Usage(playerid,"w <matn> - Baray Chat Dargooshi");
But send the pm: [DarGooshi]PlayerName: /1
Most of my commands when use send the /1 .

I tested all sscanf versions but not solved.
And I'm likely that there is no problem in my codes but in sscanf bug..


sorry for my bad english..
Reply
#2

You do not need sscanf for a text only parameter.
pawn Code:
if (isnull(params)) return Usage(playerid,"w <matn> - Baray Chat Dargooshi");
Client message can be up to 144 characters + \0

If params is empty, \1 is passed in CallLocalFunction to avoid server crash. Is the include modified? Try re-download it.
Reply
#3

I've tried isnull but this also send /1
Reply
#4

Try using "if (isnull (params)) return Usage (playerid," w <matn> - Bago Chat Dargooshi ");" first

PHP Code:
CMD:w(playeridparams[])
{
    if(
isnull(params)) return Usage(playerid"w <matn> - Bago Chat Dargooshi ");
    
LoginCheck(playerid);
    new 
string[256], pname[MAX_PLAYER_NAME];
    
GetPlayerName(playerid ,pnamesizeof(pname));
    
format(string,sizeof(string), ""white"[DarGooshi]%s: %s"pnameparams);
    
SendNearMessage(playerid0xFFFFFFFstring12.1);
    
format(sb_stringsizeof(sb_string),"{FF9000}[DarGooshi] {FFFFFF}%s"params);
    
SetPlayerChatBubble(playeridsb_string0xFFFFFFFF16.0,4000);
    return 
1;

By the way, as defined "Usage"?
Reply
#5

If player logged in again send [DarGooshi]PlayerName: /1
Or player not loggedin send "you not logged in." And not show Usage..
Reply
#6

Might be something in one of your filterscripts? Maybe? Im super new to scripting but I had a similar issue with my script yesterday. I would type almost any cmd and it would give me an error message from a different filterscript regardless of if the cmd worked or not.

I disabled the filterscript through the server.cfg and I stopped getting that error message. As for why its not showing your usage cmd I have no idea. But try this maybe?
PHP Code:
if(sscanf(params"us[356]"pnamestring)) return Usage(playerid,"w <matn> - Baray Chat Dargooshi"); 
Reply
#7

Quote:
Originally Posted by aKnoxx
View Post
Might be something in one of your filterscripts? Maybe? Im super new to scripting but I had a similar issue with my script yesterday. I would type almost any cmd and it would give me an error message from a different filterscript regardless of if the cmd worked or not.

I disabled the filterscript through the server.cfg and I stopped getting that error message. As for why its not showing your usage cmd I have no idea. But try this maybe?
PHP Code:
if(sscanf(params"us[356]"pnamestring)) return Usage(playerid,"w <matn> - Baray Chat Dargooshi"); 
This cmd no need "u" because just send pm to near players..



--No anyone can helps me?
Reply
#8

Try this:

PHP Code:
CMD:w(playeridparams[])
{
    
LoginCheck(playerid);
    new 
string[256],pname[MAX_PLAYER_NAME],matn[356];
    
GetPlayerName(playerid,pname,sizeof(pname));
    if(
sscanf(params,"s[356]",matn)) return Usage(playerid,"w <matn> - Baray Chat Dargooshi");
    
format(string,sizeof(string),""white"[DarGooshi]%s: %s",pname,matn);
    
SendNearMessageplayerid0xFFFFFFFstring12.1);
    
format(sb_stringsizeof(sb_string),"{FF9000}[DarGooshi] {FFFFFF}%s"matn);
    
SetPlayerChatBubble(playeridsb_string0xFFFFFFFF16.0,4000);
    return 
1;

Works for me...




If that doesn't work try using SendClientMessage instead of Usage(playerid,...);

PHP Code:
if(sscanf(params,"s[356]",matn)) return SendClientMessage(playerid, -1"w <matn> - Baray Chat Dargooshi"); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)