25.09.2013, 17:57
ZCMD cannot get space in the command's name. Basically, it's: cmd_%s (%s = command's name).
pawn Код:
CMD:play( playerid, params[ ] )
{
if( isnull( params ) ) return SendClientMessage( playerid, -1, "Usage: /play <1-N>" );
if( !IsNumeric( params ) ) return SendClientMessage( playerid, -1, "You need to enter a number" );
new
song = strval( params )
;
if( song < 0 || song > N ) return SendClientMessage( playerid, -1, "between 1 and N" ); // CHANGE N
switch( song )
{
case 1: // play the song 1
case 2: // play the song 2
// ..
// case N: // play the song N
}
return 1;
}
pawn Код:
stock IsNumeric( const string[ ] )
{
for( new i = 0, j = strlen( string ); i < j; i++ ) if( string[ i ] > '9' || string[ i ] < '0' ) return 0;
return 1;
}