Vehicle Spawning Command Help
#6

here you go sir
PHP код:
new tempveh[MAX_VEHICLES];
CMD:vehicle(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 4)
    {
        new 
msg[128], string[200], vehiclename[30], Float:a;
        new 
Float:xFloat:yFloat:z;
        if(
sscanf(params,"s[30]",vehiclename)) return SendClientMessage(playeridCOLOR_WHITE,"Usage: /vehicle [Name]");
        new 
vehicle GetVehicleModelIDFromName(vehiclename);
        if(
vehicle 400 || vehicle 611) return SendClientMessage(playeridCOLOR_RED"Error: Invalid Vehicle Model");
        
GetPlayerFacingAngle(playerida);
        
GetPlayerPos(playeridx,y,z);
        if(
IsPlayerInAnyVehicle(playerid) == 1)
        {
            
GetXYInFrontOfPlayer(playerid,x,y,8);
        }
        else
        {
            
GetXYInFrontOfPlayer(playerid,x,y,5);
        }
        new 
PlayersVehicle CreateVehicle(vehiclexyz+2a+90, -1, -1, -1); // <- this will return the id of the created vehicle
        
tempveh[PlayersVehicle] = 1;
        
LinkVehicleToInterior(PlayersVehicleGetPlayerInterior(playerid));
        
format(string,sizeof(string), "You have spawned a %s"VehicleNames[vehicle 400]);
        
SendClientMessage(playeridCOLOR_BLUEstring);
        
format(msg,sizeof(msg), "[Admin Log]: %s has used the command /vehicle. Spawning a %s"GetName(playerid), VehicleNames[vehicle 400]);
        
ABroadCast(COLOR_ADMINmsg1);
      }
    else
    {
        return 
0;
    }
       return 
1;
}
public 
OnVehicleDeath(vehicleid,killerid)
{
   if(
tempveh[vehicleid])
   {
      
DestroyVehicle(vehicleid);
      
tempveh[vehicleid] = 0;
   }
   return 
1;

Reply


Messages In This Thread
Vehicle Spawning Command Help - by Tass007 - 05.08.2016, 09:12
Re: Vehicle Spawning Command Help - by Threshold - 05.08.2016, 09:25
Re: Vehicle Spawning Command Help - by Tass007 - 05.08.2016, 09:31
Re: Vehicle Spawning Command Help - by PrO.GameR - 05.08.2016, 10:44
Re: Vehicle Spawning Command Help - by Tass007 - 05.08.2016, 11:38
Re: Vehicle Spawning Command Help - by jlalt - 05.08.2016, 11:42
Re: Vehicle Spawning Command Help - by Threshold - 05.08.2016, 12:36
Re: Vehicle Spawning Command Help - by PrO.GameR - 05.08.2016, 12:43
Re: Vehicle Spawning Command Help - by Threshold - 05.08.2016, 13:41

Forum Jump:


Users browsing this thread: 4 Guest(s)