Deleting the vehicle - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Deleting the vehicle (
/showthread.php?tid=167023)
Deleting the vehicle -
XtremePlanet - 10.08.2010
Hey,
So I have this teleport that puts on you in a NRG immediately. If someone falls down, he gets teleported away, but the NRG spawns at the starting location, so if 10 people come you'll soon have 10 vehicles on each other and lagging all.
pawn Код:
if(strcmp(cmdtext, "/wipeout", true) == 0)
{
if(IsInDM[playerid] ==1)
{
SendClientMessage(playerid,COLOR_RED,"If you want to teleport use /leavedm");
return 1;
}
nojump2[playerid] = 1;
leavenrgwipeout[playerid] = 1;
PutPlayerInVehicle(playerid, AddStaticVehicle(522, -933.0863,-320.8549,9.9999, 120, 2, 2), 0);
SetPlayerHealth(playerid, 100);
SetCameraBehindPlayer(playerid);
ResetPlayerWeapons(playerid);
SetPlayerInterior(playerid, 0);
new string[128], playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
format(string, sizeof(string), "[Teleport] %s has teleported to /wipeout - Win 20.000$ + 1 Score", playerName);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(ReceiveInfo[i] == true)
{
SendClientMessage(i, COLOR_LIGHTBLUE, string);
}
}
}
return 1;
}
I think that fixing is easy but do not know how to. What I would want is that once the player falls from the NRG, and he automatically teleports, the NRG should be destroyed.
Re: Deleting the vehicle -
Mike_Peterson - 10.08.2010
at the putplayerinvehicle line use this: PutPlayerInVehicle(playerid,nrg = CreateVehicle(522, -933.0863,-320.8549,9.9999, 120, 2, 2,0), 0);
@ top of script: new nrg;
then use DestroyVehicle(nrg); to destroy the bike if he falls off..
Is this btw with more players because then maybe if 1 guy falls off and the bike gets destroyed.. all the other bikes gets destroyed aswell.....
Re: Deleting the vehicle -
XtremePlanet - 11.08.2010
Thanks for help, but yes, when 1 person falls down, they all get their NRG destroyed. I hope someone else would know this.