PDA

View Full Version : Problem with sscanf2 params command


RoX123
04/02/2018, 09:18 PM
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:

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;
}

Mugala
04/02/2018, 09:22 PM
I have newest, sscanf2 plugin, also there is not any errors or warnings

so what's problem?

Inn0cent
04/02/2018, 09:22 PM
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.

RoX123
04/02/2018, 09:28 PM
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+

Dayrion
04/02/2018, 10:00 PM
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: sscanf(params, "s[24]", player_name)