Carspawning - 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: Carspawning (
/showthread.php?tid=109303)
Carspawning -
RedFusion - 19.11.2009
Hey..
i got a carspawning filterscript, but when i spawn a vehicle, leave it, and spawn another one, the old vehicle stays.
any ideas to only have one vehicle spawned at time?
the code looks like this..
Код:
stock aCreateThing(playerid, thingid, orderid)
{
new pVeh[MAX_PLAYERS] = -1;
if(pVeh[playerid] != -1)
DestroyVehicle(pVeh[playerid]);
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
if(thingid != 597)
{
Vehicle[orderid] = CreateVehicle(thingid, X, Y, Z + 3, Angle, random(126), random(126), 30);
}
else
{
Vehicle[orderid] = CreateVehicle(thingid, X, Y, Z + 3, Angle, 0, 1, 30);
}
PutPlayerInVehicle(playerid, Vehicle[orderid], 0);
TogglePlayerControllable(playerid, true);
return 1;
}
If someone got a solution for this, please copy the code and add your sulution and post it. thanks.
Re: Carspawning -
LarzI - 19.11.2009
You should stick to your old topic...
But anyways, as I tried to explain, the var definition should be global, not inside the command...
pawn Код:
//Under includes
new pVeh[playerid] = -1;
//function
stock aCreateThing(playerid, thingid, orderid)
{
if(pVeh[playerid] != -1)
DestroyVehicle(pVeh[playerid]);
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
if(thingid != 597)
{
pVeh[playerid] = CreateVehicle(thingid, X, Y, Z + 3, Angle, random(126), random(126), 30);
}
else
{
pVeh[playerid] = CreateVehicle(thingid, X, Y, Z + 3, Angle, 0, 1, 30);
}
PutPlayerInVehicle(playerid, pVeh[playerid], 0);
TogglePlayerControllable(playerid, true);
return 1;
}
That should work
Re: Carspawning -
RedFusion - 19.11.2009
Код:
C:\Users\Simon\Desktop\Samp server\filterscripts\Vehiclespawner.pwn(47) : error 017: undefined symbol "playerid"
C:\Users\Simon\Desktop\Samp server\filterscripts\Vehiclespawner.pwn(739) : warning 203: symbol is never used: "orderid"
C:\Users\Simon\Desktop\Samp server\filterscripts\Vehiclespawner.pwn(778) : warning 203: symbol is never used: "Vehicle"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.

lol i am such a noob..
Re: Carspawning -
LarzI - 19.11.2009
Upload complete script at ampaste.net pls
Re: Carspawning -
RedFusion - 19.11.2009
http://ampaste.net/d719bc23
Re: Carspawning -
LarzI - 19.11.2009
http://ampaste.net/m65056d17
Try that
Re: Carspawning -
RedFusion - 19.11.2009
The cars still stays..
Re: Carspawning -
RedFusion - 19.11.2009
Can somebody link a good Filterscript carspawner?
oh.. sorry for doublepost..