SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/12/2018, 01:46 PM   #1
xRadical3
Gangsta
 
Join Date: May 2017
Location: Iran
Posts: 643
Reputation: 47
Default sscanf "u" and "s[126]" specifier bug

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..
xRadical3 is online now   Reply With Quote
Old 24/12/2018, 03:00 PM   #2
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,227
Reputation: 205
Default Re: sscanf "u" and "s[126]" specifier bug

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.
Calisthenics is offline   Reply With Quote
Old 24/12/2018, 03:50 PM   #3
xRadical3
Gangsta
 
Join Date: May 2017
Location: Iran
Posts: 643
Reputation: 47
Default Re: sscanf "u" and "s[126]" specifier bug

I've tried isnull but this also send /1
xRadical3 is online now   Reply With Quote
Old 24/12/2018, 04:22 PM   #4
SapMan
Banned
 
Join Date: Jul 2017
Posts: 140
Reputation: 12
Flowers Re: sscanf "u" and "s[126]" specifier bug

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"?
SapMan is offline   Reply With Quote
Old 25/12/2018, 07:56 AM   #5
xRadical3
Gangsta
 
Join Date: May 2017
Location: Iran
Posts: 643
Reputation: 47
Default Re: sscanf "u" and "s[126]" specifier bug

If player logged in again send [DarGooshi]PlayerName: /1
Or player not loggedin send "you not logged in." And not show Usage..
xRadical3 is online now   Reply With Quote
Old 25/12/2018, 09:17 AM   #6
aKnoxx
Big Clucker
 
aKnoxx's Avatar
 
Join Date: Dec 2018
Location: United States Discord: ABC#6701
Posts: 76
Reputation: 0
Default Re: sscanf "u" and "s[126]" specifier bug

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"); 
aKnoxx is offline   Reply With Quote
Old 25/12/2018, 12:53 PM   #7
xRadical3
Gangsta
 
Join Date: May 2017
Location: Iran
Posts: 643
Reputation: 47
Default Re: sscanf "u" and "s[126]" specifier bug

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?
xRadical3 is online now   Reply With Quote
Old 26/12/2018, 07:39 AM   #8
aKnoxx
Big Clucker
 
aKnoxx's Avatar
 
Join Date: Dec 2018
Location: United States Discord: ABC#6701
Posts: 76
Reputation: 0
Default Re: sscanf "u" and "s[126]" specifier bug

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"); 
aKnoxx is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sscanf "u" specifier makes problems maximthepain Scripting Help 12 22/06/2015 09:42 AM
error: undefine symbol "j" and expected token ";" but found "]" JEkvall95 Scripting Help 9 27/07/2013 10:09 AM
5 Dialog errors - Input line too long, undefined symbol "t","is" and "only" Deal-or-die Scripting Help 6 01/05/2012 12:08 PM
Admin script requires "ReturnUser", "strtok" and "IsNumeric" Rubennnnn Help Archive 1 02/12/2009 06:08 PM
"Bots", "AI", "NPCs"... Computer-controlled pedestrians and traffic! ssflsnoob General 2 23/11/2008 06:06 PM


All times are GMT. The time now is 11:52 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.