09.02.2014, 13:56
Hi
I face many problens with destroy old vehicle (unused)
Now when i drive a vehicle after 5 seconds my car is gone.. now can i make currentvehicle and old vehicle so when player spawn new vehicle delete the old and when he death destroy both? I hope some 1 can help because im suffering from this problem!
Underonplayerdeath
Under command cars for example
my codes:
I face many problens with destroy old vehicle (unused)
Now when i drive a vehicle after 5 seconds my car is gone.. now can i make currentvehicle and old vehicle so when player spawn new vehicle delete the old and when he death destroy both? I hope some 1 can help because im suffering from this problem!
Underonplayerdeath
Код:
if(CurrentSpawnedVehicle[playerid] != -1) { DestroyVehicle(CurrentSpawnedVehicle[playerid]); }
Код:
CreateVehicleEx(playerid,582, X,Y,Z+1, Angle, random(126), random(126), -1);
Код:
stock CreateVehicleEx(playerid, modelid, Float:posX, Float:posY, Float:posZ, Float:angle, Colour1, Colour2, respawn_delay) { new world = GetPlayerVirtualWorld(playerid); new interior = GetPlayerInterior(playerid); if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { DestroyVehicle(GetPlayerVehicleID(playerid)); GetPlayerPos(playerid, posX, posY, posZ); GetPlayerFacingAngle(playerid, angle); if(CurrentSpawnedVehicle[playerid] != -1) { DestroyVehicle(CurrentSpawnedVehicle[playerid]); } CurrentSpawnedVehicle[playerid] = CreateVehicle(modelid, posX, posY, posZ, angle, Colour1, Colour2, respawn_delay); LinkVehicleToInterior(CurrentSpawnedVehicle[playerid], interior); SetVehicleVirtualWorld(CurrentSpawnedVehicle[playerid], world); SetVehicleZAngle(CurrentSpawnedVehicle[playerid], angle); PutPlayerInVehicle(playerid, CurrentSpawnedVehicle[playerid], 0); SetPlayerInterior(playerid, interior); } if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { if(IsVehicleOccupied(CurrentSpawnedVehicle[playerid])) {} else DestroyVehicle(CurrentSpawnedVehicle[playerid]); GetPlayerPos(playerid, posX, posY, posZ); GetPlayerFacingAngle(playerid, angle); if(CurrentSpawnedVehicle[playerid] != -1) { DestroyVehicle(CurrentSpawnedVehicle[playerid]); } CurrentSpawnedVehicle[playerid] = CreateVehicle(modelid, posX, posY, posZ, angle, Colour1, Colour2, respawn_delay); LinkVehicleToInterior(CurrentSpawnedVehicle[playerid], interior); SetVehicleVirtualWorld(CurrentSpawnedVehicle[playerid], world); SetVehicleZAngle(CurrentSpawnedVehicle[playerid], angle); PutPlayerInVehicle(playerid, CurrentSpawnedVehicle[playerid], 0); SetPlayerInterior(playerid, interior); } return 1; }