2 in 1 commands
#6

pawn Код:
new bool:bIsGoEnabled; // top


CMD:go( playerid, params[ ] )
{
    if( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "You have to be an admin to enable/disable go" );
   
    new goid;
    if( sscanf( params, "u", goid ) )
    {
        if( bIsGoEnabled )
        {
            bIsGoEnabled = false;
            SendClientMessage( playerid, -1, "GO: Disabled" );
        }
        else
        {
            bIsGoEnabled = true;
            SendClientMessage( playerid, -1, "GO: Enabled" );
        }
    }
    else
    {
        if( IsPlayerConnected( goid ) || goid == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Error: Player not connected or invalid id" );

        if( !bIsGoEnabled ) return SendClientMessage( playerid, -1, "Error: GO is disabled." );

        new Float:X, Float:Y, Float:Z;
        GetPlayerPos( goid, X, Y, Z );
        SetPlayerPos( playerid, X, Y, Z );

        SendClientMessage( playerid, -1, "GO: You have been teleported." );
    }
    return 1;
}
Sorry for a big bump - I've been away from SA-MP forums from few days but I thought to help you out if you are still active here.

Regards,
FalconX
Reply


Messages In This Thread
2 in 1 commands - by kbalor - 25.06.2012, 18:25
Re: 2 in 1 commands - by dowster - 25.06.2012, 18:51
Re: 2 in 1 commands - by kbalor - 25.06.2012, 18:56
Re: 2 in 1 commands - by FalconX - 25.06.2012, 19:01
Re: 2 in 1 commands - by kbalor - 25.06.2012, 19:24
Re: 2 in 1 commands - by FalconX - 13.07.2012, 07:41

Forum Jump:


Users browsing this thread: 2 Guest(s)