11.08.2012, 19:56
Quote:
You misunderstood me. I can do those normal commands easy, but i want to do a command as this:
/give key (playerid) /give money (playerid) (amount) /give phone (playerid) /give... /give... You see, /give is one command. I hope you understand what do i mean. |
pawn Код:
CMD:give(playerid, params[ ])
{
if( !strcmp( "key", params, true, 3 ) )
{
if( !strlen( params[ 4 ] ) ) return SendClientMessage( playerid, -1, "/give key [playerid]" );
new targetid = strval( params[ 4 ] );
if( !IsPlayerConnected( targetid ) ) return SendClientMessage(playerid, -1, "The target ID is not connected" );
if( targetid == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Invalid player" );
if( targetid == playerid ) return SendClientMessage( playerid, -1, "You can't give yourself a key!" );
// your code
}
else if( !strcmp( "money", params, true, 5 ) )
{
if( !strlen( params[ 6 ] ) ) return SendClientMessage( playerid, -1, "/give money [playerid]" );
new targetid = strval( params[ 6 ] );
if( !IsPlayerConnected( targetid ) ) return SendClientMessage(playerid, -1, "The target ID is not connected" );
if( targetid == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Invalid player" );
if( targetid == playerid ) return SendClientMessage( playerid, -1, "You can't give money to yourself!" );
// your code
}
// so on
/*else if( !strmp( "shit", params, true, NUMBER ) )
{
}*/
else
{
SendClientMessage( playerid, -1, "/give [key/money/phone]" );
}
return 1;
}