Why wont this work?
#1

public OnPlayerExitVehicle(playerid, vehicleid)
{
for(new i=0; i<MAX_VEHICLES; i++)
{
for(new pl = 0; pl<MAX_PLAYERS; pl++)
{
if(IsPlayerConnected(pl))
{
if(!IsPlayerInVehicle(pl, i))
{
SetVehicleToRespawn(i);
}
}
}
}
}
Reply
#2

can someone please help me out with this one? im trying to make a script that will get rid of the car 5 seconds after u get out of it, but wont get rid of it if u get back in or someone else takes it

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	for(new i=0; i<MAX_VEHICLES; i++)
	{
		for(new pl = 0; pl<MAX_PLAYERS; pl++)
		{
			if(IsPlayerConnected(pl))
			{
				if(!IsPlayerInVehicle(pl, i))
				{
					SetVehicleToRespawn(i);
				}
			}
		}
	}
}
Reply
#3

Just simply use AddStaticVehicleEx:
Код:
AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y,Float:spawn_z, Float:angle, color1, color2, respawn_delay)
It uses a respawn delay which you can set to 5 seconds
Example:
Код:
AddStaticVehicleEx(modelid, 0.0, 0.0, 0.0, 0.0, 0, 1, 5);
Reply
#4

Thanks, so what does that do exactly? Does that mean if a vehicle is not used for 5 seconds it re spawns to where it was?

And I get one error:

C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCarsReset.pwn(3) : error 021: symbol already defined: "AddStaticVehicleEx"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.



what's the difference between this, which is what I have:
AddStaticVehicle(424,407.0562,2437.2500,16.2805,35 8.0372,2,2); // da ground
and this? what does the "ex" do?
AddStaticVehicleEx ( 520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 15 );
Reply
#5

Quote:
Originally Posted by ThePS3Guy
Thanks, so what does that do exactly? Does that mean if a vehicle is not used for 5 seconds it re spawns to where it was?
Yes.

And if you added this to your script:

Код:
AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y,Float:spawn_z, Float:angle, color1, color2, respawn_delay)
then delete it, you don't need it.
Reply
#6

mademan, what do u mean i dont need it? u mean if i copy and paste that into my script, then delete it all the cars that I already placed will behave that way?
im guessing something like this?
Код:
AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y,Float:spawn_z, Float:angle, color1, color2, respawn_delay)
   AddStaticVehicle(424,407.0562,2437.2500,16.2805,358.0372,2,2); // da ground
and then all the vehilces after will behave like that?
Reply
#7

This is SAMP native function so you don't have to define it. Just use it
Reply
#8

Thanks if i can get this running it will help a lot..
but im getting one error:

C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\gam emodes\Sky'sStunts'nStuff.pwn(322) : error 017: undefined symbol "modelid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Can you please give me an example though? Lets say I have 3 vehicles:
Код:
	AddStaticVehicle(424,407.0562,2437.2500,16.2805,358.0372,2,2); // da ground
	AddStaticVehicle(489,411.8165,2437.6257,16.6451,356.9884,14,123); // da ground
	AddStaticVehicle(500,416.1319,2436.9294,16.6022,359.0542,40,84); // da ground
How would I use those with AddStaticVehicleEx? What would I put it under, because right now I have those three vehicles (and many more) under public OnGameModeInit()
Reply
#9

Just change the title's ending to -Ex and add respawn delay (in seconds) at the end.

pawn Код:
AddStaticVehicleEx(424,407.0562,2437.2500,16.2805,358.0372,2,2,5); // da ground
AddStaticVehicleEx(489,411.8165,2437.6257,16.6451,356.9884,14,123,5); // da ground
AddStaticVehicleEx(500,416.1319,2436.9294,16.6022,359.0542,40,84,5); // da ground
Reply
#10

Thanks MadeMan I got it working. Thanks for being patient too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)