CAR command help - 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: CAR command help (
/showthread.php?tid=374918)
CAR command help -
Dare Devil..... - 04.09.2012
Guys this is my vehicle command I want that if player spawns a new car old one despawn can I do so?
pawn Код:
YCMD:veh(playerid, params[])
{
if(gPlayerLoggedIn[playerid] == 0) return 1;
if(PlayerInfo[playerid][Admin] >= 4) {
new model[128], color1, color2;
if(sscanf( params, "s[128]dd", model, color1, color2)) return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /veh [Vehicle name] [Color1] [Color2]");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
new car = ReturnVehicleModelID(model);
if(!car) return SendClientMessage(playerid, COLOR_WHITE, "Unable to find that Vehicle name.");
new carid = CreateVehicle(car, X,Y,Z,A, color1, color2, 0);
PutPlayerInVehicle(playerid,carid,0);
LinkVehicleToInterior(carid,GetPlayerInterior(playerid));
for(new i = 0; i < sizeof(CreatedCars); i++)
{
if(CreatedCars[i] == INVALID_VEHICLE_ID)
{
CreatedCars[i] = carid;
break;
}
}
SendClientMessage(playerid, COLOR_WHITE, "You have spawned a vehicle.");
}
return 1;
}
Re: CAR command help -
MarinacMrcina - 04.09.2012
Yes,save the vehicle that the player has spawned and destroy it when he uses the command again.
Re: CAR command help -
RanSEE - 04.09.2012
Rather i suggest,
1.Create A variable like Unused[carid] or something like that
2.Create a timer of your choice , the time will be in how much time the vehicle becomes "unused"
3.In the timer function , set the unused variable to 1.
4.Go to OnPlayerExitVehicle and call the timer here.
5.Make command that will respawn all the vehicles that are unused
So like that vehicles without a driver will become unused after some time ( time defined by the timer )
Re: CAR command help -
denNorske - 04.09.2012
But that will make the car respawn, even if he enters the same car again... any solution to that ?