SA-MP Forums Archive
Coding 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: Coding Help (/showthread.php?tid=300171)



Coding Help - Thresholdold - 29.11.2011

Does anyone know what the code is for:
Ejecting a player from a vehicle (which I have named 'threshcar' which is AddstaticVehicle etc.) if they are not an RCON admin?

Destroying a previously spawned car if the player tries to spawn another one. Example: I spawn a remington and drive it for a bit, then I want to spawn a landstalker, when my landstalker spawns, the remington disappears. Can someone help me with these 2 codes?


Re: Coding Help - =WoR=Varth - 29.11.2011

Ejecting
pawn Код:
//Global
new threshcar;

//OnGameModeInit
threshcar = AddStaticVehicle(................

//OnPlayerStateChange
if(GetPlayerVehicleID(playerid) == threshcar && !IsPlayerAmin(playerid)) RemovePlayerFromVehicle(playerid);



Re: Coding Help - TaMeD - 29.11.2011

pawn Код:
new CurrentCar[MAX_PLAYERS];

..

public OnPlayerConnect(playerid) {
   CurrentCar[playerid] = -1;
}

..

//When spawning a car:
if(CurrentCar[playerid] != -1) DestroyVehicle(CurrentCar[playerid]);
CurrentCar[playerid] = CreateVehicle(.......);



Re: Coding Help - Thresholdold - 29.11.2011

I want it to destroy the previous car if they spawn ANY vehicle.

PS: Whenever I respawn the car or it gets blown up, all the components are gone... how can I fix this?