Carspawning
#1

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.
Reply
#2

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
Reply
#3

Код:
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..
Reply
#4

Upload complete script at ampaste.net pls
Reply
#5

http://ampaste.net/d719bc23
Reply
#6

http://ampaste.net/m65056d17

Try that
Reply
#7

The cars still stays..
Reply
#8

Can somebody link a good Filterscript carspawner?

oh.. sorry for doublepost..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)