#7

Take this code and place it somewhere down your script. I keep all my admin commands in one group and all my player commands in a separate group to keep it tidy.
pawn Код:
CMD:veh(playerid,params[])
    {
        new ModelID, color[2],Float:VehPos[4], vehicleid;
        if(GetPlayerState(playerid)!=PLAYER_STATE_ONFOOT) return SendClientMessage(playerid,0xB0AFB0FF,"You cannot spawn vehicles if you are already inside a vehicle!");
        if(sscanf(params, "ddd",ModelID,color[0],color[1])) return SendClientMessage(playerid,0xB0AFB0FF, "/veh [vehicleid] [color1] [color2]");
        if(ModelID < 400 || ModelID > 611) return SendClientMessage(playerid,0xB0AFB0FF, "The vehicle id must be between 400 - 611");
        if(color[0] < 0 || color[0] > 255 || color[1] < 0 || color[1] > 255) return SendClientMessage(playerid,0xB0AFB0FF, "The colorid must be between  0 - 126");
        if(IsPlayerAdmin(playerid))
            {
                GetPlayerPos(playerid, VehPos[0],VehPos[1],VehPos[2]);
                GetPlayerFacingAngle(playerid, VehPos[3]);
                vehicleid = CreateVehicle(ModelID,VehPos[0],VehPos[1],VehPos[2],VehPos[3],color[0],color[1],-1);
                LinkVehicleToInterio(vehicleid,GetPlayerInterior(playerid));
                SetVehicleVirtualWorld(vehicleid,GetPlayerVirtualWorld(playerid));
                PutPlayerInVehicle(playerid, vehicleid, 0);
            }
            SendClientMessage(playerid,RED,"[AcC] You do not have enough Admin Permissions to execute this Command!");
            return 1;
    }
ZCMD doesn't require the code to be in OnPlayerCommandText.

EDIT: Also; this line will execute if someone is actually allowed to do it.
pawn Код:
SendClientMessage(playerid,RED,"[AcC] You do not have enough Admin Permissions to execute this Command!");
Add 'else' to the beginning of the line. So:
pawn Код:
else SendClientMessage(playerid,RED,"[AcC] You do not have enough Admin Permissions to execute this Command!");
Reply


Messages In This Thread
/Veh - by Pilip93 - 09.07.2013, 01:52
Re: /Veh - by EiresJason - 09.07.2013, 01:57
Re: /Veh - by Pilip93 - 09.07.2013, 01:58
Re: /Veh - by Pilip93 - 09.07.2013, 02:00
Re: /Veh - by EiresJason - 09.07.2013, 02:02
Re: /Veh - by Pilip93 - 09.07.2013, 02:04
Re: /Veh - by EiresJason - 09.07.2013, 02:08
Re: /Veh - by Pilip93 - 09.07.2013, 02:14
Re: /Veh - by EiresJason - 09.07.2013, 02:15
Re: /Veh - by Pilip93 - 09.07.2013, 02:20

Forum Jump:


Users browsing this thread: 1 Guest(s)