SA-MP Forums Archive
Problem with sscanf2 params command - 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: Problem with sscanf2 params command (/showthread.php?tid=649220)



Problem with sscanf2 params command - RoX123 - 04.02.2018

Hello to all,

I have next problem,
Example: I have command /askq, but when i type /askq example: come to me, it send me return with message "/askq [Text]"

I have newest, sscanf2 plugin, also there is not any errors or warnings

COMMAND:
PHP код:
CMD:askq( playerid, params[] ) {
    if( 
PlayerCuffed[ playerid ] >= 1 ) return GRESKA( playerid, "Ne mozes koristiti komandu kad si cuffovan ili tazovan.");
    if( 
PlayerInfo[ playerid ][ pJailed ] != 0 ) return GRESKA( playerid, "Ne mozes da koristis ovu komandu dok si u zatvoru." );
    if( 
PlayerInfo[ playerid ][ pMuted ] != 0) return GRESKA( playerid, "Ne mozete pricati, usutkani ste.");
    if( 
askqInfo[ playerid ][ askqSended ] == true ) return GRESKA( playerid, "Vec si poslao pitanje, nije vam odgovoreno ili nisi pogledao." );
    new 
textic[ 128 ];
    if( 
sscanf( params, "d", textic )) return SendClientMessage( playerid, "/askq[ Text ]" );
    new 
askQ = -1;
    for( new 
id = 1; id < MAX_ASKQS; id++ ) {
        if( 
askqList[ id ][ askqSend ] == false ) {
            
askQ = id;
            break;
        }
    }
    if( 
askQ == -1 ) return GRESKA( playerid, "Vec ima maksimalan broj poslatih pitanja." );
    
askqList[ askQ ][ askqSend ] = true;
    
askqList[ askQ ][ askqID ] = playerid;
    
askqInfo[ playerid ][ askqSended ] = true;
    
askqInfo[ playerid ][ askqAnswered ] = false;
    
strmid( askqList[ askQ ][ askqOwner ], GetName( playerid ), 0, strlen( GetName( playerid ) ), 32 );
    
strmid( askqList[ askQ ][ askqQuestion ], textic, 0, strlen( textic ), 128 );
    
SendInfoMessage( playerid, "Poslao si pitanje Adminima i Helperima." );
    new 
stringic[ 128 ];
    
format( stringic, sizeof( stringic ), ""COL_RED"|P| %s je poslao pitanje.( /lp )", GetName(playerid) );
    
RPTChat( -1, stringic );
    return 
1;
} 



Re: Problem with sscanf2 params command - Mugala - 04.02.2018

Quote:
Originally Posted by RoX123
Посмотреть сообщение
I have newest, sscanf2 plugin, also there is not any errors or warnings
so what's problem?


Re: Problem with sscanf2 params command - Inn0cent - 04.02.2018

PHP код:
if( sscanf( params, "d", textic )) return SendClientMessage( playerid, "/askq[ Text ]" ); 
"d" is for integers and s is for strings, You have to use s there as text is not only integer.


Re: Problem with sscanf2 params command - RoX123 - 04.02.2018

Quote:
Originally Posted by Inn0cent
Посмотреть сообщение
PHP код:
if( sscanf( params, "d", textic )) return SendClientMessage( playerid, "/askq[ Text ]" ); 
"d" is for integers and s is for strings, You have to use s there as text is not only integer.
Fixed! Thank you, rep+


Re: Problem with sscanf2 params command - Dayrion - 04.02.2018

Quote:
Originally Posted by Inn0cent
Посмотреть сообщение
PHP код:
if( sscanf( params, "d", textic )) return SendClientMessage( playerid, "/askq[ Text ]" ); 
"d" is for integers and s is for strings, You have to use s there as text is not only integer.
And don't forget to add between "[]" the string's size. Example:
PHP код:
sscanf(params, "s[24]", player_name)