I need help in making Commands
#7

Don't use strcmp for commands, it's slow. Use ZCMD instead. It can be combined with sscanf and it's really easy and fast to make commands. There are many tutorials about how to use zcmd + sscanf for commands.

pawn Код:
CMD:spawn( playerid, params[ ] )
{
    new
        modelid
    ;
    if( sscanf( params, "i", modelid ) ) return SendClientMessage( playerid, -1, "Usage: /spawn <modelid>" );
    if( modelid < 400 || modelid > 611 ) return SendClientMessage( playerid, -1, "Modelids: 400-611" );
   
    new
        Float: p[ 4 ]
    ;
    GetPlayerPos( playerid, p[ 0 ], p[ 1 ], p[ 2 ] );
    GetPlayerFacingAngle( playerid, p[ 3 ] );
   
    switch( GetPlayerState( playerid ) )
    {
        case PLAYER_STATE_DRIVER: DestroyVehicle( GetPlayerVehicleID( playerid ) );
        case PLAYER_STATE_PASSENGER: RemovePlayerFromVehicle( playerid );
    }
   
    new
        vehicleid = CreateVehicle( modelid, p[ 0 ], p[ 1 ] + 2, p[ 2 ] + 2, p[ 3 ], -1, -1, 60 )
    ;
    LinkVehicleToInterior( vehicleid, GetPlayerInterior( playerid ) );
    SetVehicleVirtualWorld( vehicleid, GetPlayerVirtualWorld( playerid ) );
    PutPlayerInVehicle( playerid, vehicleid, 0 );
    return 1;
}
Reply


Messages In This Thread
I need help in making Commands - by MAFIAWARS - 01.09.2013, 08:04
Re : I need help in making Commands - by 1Geek - 01.09.2013, 08:23
Re: I need help in making Commands - by Yashas - 01.09.2013, 09:02
Re: I need help in making Commands - by MAFIAWARS - 01.09.2013, 09:47
Re: I need help in making Commands - by Yashas - 01.09.2013, 10:58
Re: I need help in making Commands - by xganyx - 01.09.2013, 11:11
Re: I need help in making Commands - by Konstantinos - 01.09.2013, 12:40
Re: I need help in making Commands - by MAFIAWARS - 01.09.2013, 13:19

Forum Jump:


Users browsing this thread: 3 Guest(s)