SA-MP Forums Archive
Help with car command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with car command (/showthread.php?tid=285836)



Help WITH COMMAND - boyan96 - 25.09.2011

Hello everyone !!! with this command in my server vip player spawn cars
PHP код:
if (strcmp("/sultan"cmdtexttrue10) == 0)
    {
    if(
GetTickCount() - GetPVarInt(playerid"LastFLASH") < 120000) return SendClientMessage(playerid0xFF0000FF"you need to wait ");
    new 
Float:X,Float:Y,Float:Z,Float:Anglecarid;
    
GetPlayerPos(playerid,X,Y,Z);
    
GetPlayerFacingAngle(playerid,Angle);
    
carid GetPlayerVehicleID(playerid);
    
carid CreateVehicle(560,X,Y,Z,Angle,-1,-1,600);
    
AddVehicleComponent(carid,1029);
    
AddVehicleComponent(carid,1033);
    
AddVehicleComponent(carid,1139);
    
AddVehicleComponent(carid,1010);
    
AddVehicleComponent(carid,1073);
    
ChangeVehiclePaintjob(carid,1);
    
PutPlayerInVehicle(playerid,carid,0);
    
TogglePlayerControllable(playerid,true);
    
SetPVarInt(playerid"LastFLASH"GetTickCount());
    return 
SendClientMessage(playerid0x40FF40FF"sultan has been spawned!");
         }
    return 
1;
    } 
but how i can make if the vehicle didn't drive after 2 minutes to destroy automatically


Re: Help with car command - boyan96 - 25.09.2011

did someone know


Re: Help with car command - zombieking - 25.09.2011

Make a timer at OnPlayerExitVehicle what will respawn the car (Well actually destroy it) after 2 minutes (Timers are set in milliseconds so 2 minutes = 120000 milliseconds)


Re: Help with car command - andrew4699 - 25.09.2011

For CreateVehicle, change the 600 to the amount of seconds you want before it respawns if nobody is in it, in this case, change it to 120.


Re: Help with car command - boyan96 - 25.09.2011

Quote:
Originally Posted by zombieking
Посмотреть сообщение
Make a timer at OnPlayerExitVehicle what will respawn the car (Well actually destroy it) after 2 minutes (Timers are set in milliseconds so 2 minutes = 120000 milliseconds)
but how to make it


Re: Help with car command - Kingunit - 25.09.2011

SetTimer


Re: Help with car command - boyan96 - 25.09.2011

thank you


Re: Help with car command - [MWR]Blood - 25.09.2011

You could simply do this:
pawn Код:
carid =CreateVehicle(560,X,Y,Z,Angle,-1,-1,120);//Will respawn after 120 seconds if there is no driver
https://sampwiki.blast.hk/wiki/CreateVehicle


Re: Help with car command - Kingunit - 25.09.2011

Quote:
Originally Posted by [MWR]Blood
Посмотреть сообщение
You could simply do this:
pawn Код:
carid =CreateVehicle(560,X,Y,Z,Angle,-1,-1,120);//Will respawn after 120 seconds if there is no driver
https://sampwiki.blast.hk/wiki/CreateVehicle
He wants to destroy it. CreateVehicle will respawn it.


Re: Help with car command - boyan96 - 25.09.2011

i make this but didn't work
PHP код:
public OnPlayerExitVehicle(playeridvehicleid)
{
   
SetTimer("t"5000true); // Set a timer of 1000 miliseconds (1 second)
    
return 1;