Car Spawn
#1

I want a script of car spawn and auto destroy unused cars
Reply
#2

PHP код:
#include <YSI\y_iterate>
#define CreateVehicle S_CreateVehicle
#define AddStaticVehicle S_AddStaticVehicle
#define AddStaticVehicleEx S_AddStaticVehicleEx
#define DestroyVehicle S_DestroyVehicle
new
        
Iterator:Vehicle,
        
bool:used[MAX_VEHICLES];
stock S_CreateVehicle(modelidFloat:xFloat:yFloat:zFloat:acol1col2respawn_delay)
{
      new 
vid CreateVehicle(modelidxyzacol1col2respawn_delay);
      
Iter_Add(Vehiclevid);
      return 
vid;
}
stock S_AddStaticVehicle(modelidFloat:spawn_xFloat:spawn_yFloat:spawn_zFloat:anglecolor1color2)
{
      new 
vid AddStaticVehicle(modelidspawn_xspawn_yspawn_zanglecolor1color2);
      
Iter_Add(Vehiclevid);
      return 
vid;
}
stock S_AddStaticVehicleEx(modelidFloat:spawn_xFloat:spawn_yFloat:spawn_zFloat:anglecolor1color2respawn_delay)
{
      new 
vid AddStaticVehicleEx(modelidspawn_xspawn_yspawn_zanglecolor1color2respawn_delay);
      
Iter_Add(Vehiclevid);
      return 
vid;
}
stock S_DestroyVehicle(vehicleid)
{
      if(
DestroyVehicle(vehicleid)) Iter_Remove(Vehiclevehicleid);
      else return 
0;
}
public 
OnPlayerEnterVehicle(playeridvehicleidbool:isapassenger)
{
      
used[vehicleid] = true;
      return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
      foreach(new 
Player)
      {
            if(
GetPlayerVehicleID(i) == vehicleid) return 1;
      }
      
used[vehicleid] = false;
}
CMD:destroyunused(playeridparams[])
{
      foreach(new 
Vehicle)
      {
            if(
used[v]) continue;
            else 
DestroyVehicle(v));
      }
      return 
1;
}
CMD:carspawn(playeridparams[])
{
      new 
vidmodelidcol1col2delayFloat:pos[4];
      if(
sscanf(params"dDDD"vidcol1col2delay)) return SendClientMessage(playerid, -1"SYNTAX : /carspawn [Modelid] [Color 1] [Color 2] [Respawn delay]");
      
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
      
GetPlayerFacingAngle(playeridpos[4]);
      
vid CreateVehicle(modelidpos[0], pos[1], pos[2], pos[3], col1col2delay);
      
PutPlayerInVehicle(playeridvid);
      return 
1;

Reply
#3

Soorry ! i don't mean that!
i want : When a player spawn a car and he left it and if anyone take it (!ifvehicleoccupied) after a minute automaticcly destroyed !!
Reply
#4

Reply
#5

Help ME !!!!!!!!!
Reply
#6

check this

https://sampforum.blast.hk/showthread.php?tid=506543
Reply
#7

I tried you FS but when i select Airplanes or cars or ..... The Dialog Close !
Plzz Fix it in your FS !
Reply
#8

1- so easy just make a car selection dialog (car spawner)
2- then do like that new temp[MAX_VEHICLES];
3- when player spawns a vehicle set it temp value to 1
4- under onplayerexitvehicle create this:
pawn Код:
if(VehicleInfo[vehicleid][Temp] == 1) SetTimerEx("EraseVehicle", 5000,0,"i",vehicleid);
a timer to erase a vehicle hope its helped .
Reply
#9

Quote:
Originally Posted by satafinix
Посмотреть сообщение
Airplans are for rcon admins

do /rcon login yourpassword and try it!
Reply
#10

Can Someone Plzz Help ME !!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)