Vehicle spawning -help please - 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: Vehicle spawning -help please (
/showthread.php?tid=357530)
Vehicle spawning -help please -
RedFusion - 07.07.2012
I have this dialogmenu where i spawn cars.
As soon as i have removed a vehicle, and try to spawn a new one it just pops up and dissapears.
How come?
Spawn Code.
Код:
CarSpawner2(playerid,480);
Removal Code.
Код:
CarDeleter2(PlayerInfo[playerid][pCar2]);
Код:
forward CarSpawner2(playerid,model);
public CarSpawner2(playerid,model)
{
if(PlayerInfo[playerid][pCar2] != -1) CarDeleter2(PlayerInfo[playerid][pCar2]);
new vehicleid2=CreateVehicle(model, VehicleX, VehicleY, VehicleZ, VehicleAngle, -1, -1, -1);
ChangeVehicleColor(vehicleid2,0,0);
PlayerInfo[playerid][pCar2] = vehicleid2;
}
forward CarDeleter2(vehicleid);
public CarDeleter2(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(vehicleid,i,0,1);
}
SetTimerEx("VehRes2",500,0,"i",vehicleid);
}
forward VehRes2(vehicleid);
public VehRes2(vehicleid)
{
DestroyVehicle(vehicleid);
}
public OnVehicleSpawn(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(vehicleid==PlayerInfo[i][pCar2])
{
CarDeleter2(vehicleid);
PlayerInfo[i][pCar2]=-1;
}
}
return 1;
}
Re: Vehicle spawning -help please -
zT KiNgKoNg - 07.07.2012
pawn Код:
new vehicleid2;
forward CarSpawner2(playerid,model);
public CarSpawner2(playerid,model)
{
if(PlayerInfo[playerid][pCar2] != -1) CarDeleter2(PlayerInfo[playerid][pCar2]);
vehicleid2 = CreateVehicle(model, VehicleX, VehicleY, VehicleZ, VehicleAngle, -1, -1, -1);
ChangeVehicleColor(vehicleid2,0,0);
PlayerInfo[playerid][pCar2] = vehicleid2;
}
forward CarDeleter2(vehicleid);
public CarDeleter2(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
SetVehicleParamsForPlayer(vehicleid,i,0,1);
}
SetTimerEx("VehRes2",500,0,"i",vehicleid);
}
forward VehRes2(vehicleid);
public VehRes2(vehicleid)
{
DestroyVehicle(vehicleid);
}
public OnVehicleSpawn(vehicleid)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(vehicleid==PlayerInfo[i][pCar2])
{
CarDeleter2(vehicleid);
PlayerInfo[i][pCar2]=-1;
}
}
return 1;
}
Re: Vehicle spawning -help please -
RedFusion - 07.07.2012
Can you tell me what you did?
Re: Vehicle spawning -help please -
RedFusion - 08.07.2012
BUMP. Still the same.
EDIT: I figured it out.