Question about ZCMD & SSCANF
#5

Quote:
Originally Posted by ddnbb
Посмотреть сообщение
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;
}
Reply


Messages In This Thread
Question about ZCMD & SSCANF - by ddnbb - 11.08.2012, 19:23
Re: Question about ZCMD & SSCANF - by leonardo1434 - 11.08.2012, 19:38
Re: Question about ZCMD & SSCANF - by ddnbb - 11.08.2012, 19:49
Re: Question about ZCMD & SSCANF - by leonardo1434 - 11.08.2012, 19:56
Re: Question about ZCMD & SSCANF - by FalconX - 11.08.2012, 19:56
Re: Question about ZCMD & SSCANF - by MeDaKewlDude - 11.08.2012, 20:04
Re: Question about ZCMD & SSCANF - by ddnbb - 11.08.2012, 20:29

Forum Jump:


Users browsing this thread: 1 Guest(s)