19.12.2013, 21:44
Quote:
If you use sscanf the paramter 's' will get the whole string if no other parameter is passed
That would be the solution stated in the sscanf topic pawn Код:
|
I suggest you use y_stringhash it's easier and faster, also not suggesting you to use isnull but it's only a string there's no integer or float so I'd rather use isnull anyways, try this command, make sure sure have #include <YSI\y_stringhash>
pawn Код:
CMD:faction(playerid, params[])
{
new
string[ 128 ], pID, rank, msgbox[128];
if( PlayerInfo[ playerid ][ Faction ] == 0 )
return SendClientMessage( playerid, COLOR_ADMIN_GM, "You aren't in any faction!" );
if( isnull( params ) )
return SendClientMessage( playerid, COLOR_ADMIN_GM, "USAGE: /faction [params]" );
switch( YHash( params ) )
{
case _H< invite >:
{
if( sscanf ( params, "u", pID ) )
return SendClientMessage(playerid, COLOR_ADMIN_GM, "USAGE: /faction invite [Player Name/ID]" );
if( !IsPlayerConnected( pID ) )
return SendClientMessage(playerid, COLOR_ADMIN_GM, "Error: 65535 Invalid playerid!" );
print( "Invite" );
printf( "Debug, 'invite' pID: %s", pID );
}
case _H< uninvite >:
{
if( sscanf( params, "u", pID ) )
return SendClientMessage( playerid, COLOR_ADMIN_GM, "USAGE: /faction uninvite [Player Name/ID]" );
if( !IsPlayerConnected( pID ) )
return SendClientMessage( playerid, COLOR_ADMIN_GM, "Error: 65535 Invalid playerid!" );
print( "Uninvite" );
printf( "DEBUG 'uninvite' ID: %d", pID );
}
}
return true;
}