command error 035: argument type mismatch (argument 2)
#1

I keep getting an error over if(GetVehiclePos(vehicleid, 0,0,0)).
I wanted to make if the vehicle is spawned, then if the pos is at X:0 Y:0 Z:0( that means that the vehicle is not there anymore) then the [isvehiclespawned] will be 0 once again after the vehicle is not there anymore.
Heres the code.
Код:
public vehiclepos()
{
	if(isvehiclespawned == 1)
	{	        
		if(GetVehiclePos(vehicleid, 0, 0, 0))
		{
			isvehiclespawned = 0;			
  		}
	}
}
Can someone help :/
or can someone help me to make anothere code that can make the [isvehiclespawned] become 0 after the vehicle is not there anymore.
Thanks.
Reply
#2

GetVehicleModel could do that job

pawn Код:
//
    if(isvehiclespawned == 1)
    {
        if(GetVehicleModel(vehicleid) == 0)
        {
            isvehiclespawned = 0;
        }
    }
but isvehiclespawned is only one variable so its only for one vehicle, right ?

You could set isvehiclespawned to 0 if you destroy the vehicle
Reply
#3

GetVehicleModel(vehicleid) is not the thing i need...
actually when my vehicle is suddenly disapearred i cant spawn it back becuz its still isvehiclespawned = 1
but i have a override command that spawns the car even when its spawned the command is for rcon so the other admins cant use the rcon right.

so what i want to do is
[CODE]
if isvehiclespawned == 1
{
if(VehicleDestroyed(carnamehere)) // or if(VehiclePos(carnamehere , 0, 0, 0))
{
isvehiclespawned = 0;
}
}
[CODE]
Reply
#4

For as far i know GetVehiclePos only stores it into the given variables, so you must use it like this:

pawn Код:
new Float:x,Float:y,Float:z;
        GetVehiclePos(vehicleid, x,y,z);
        if(x == 0 && y == 0 && z == 0)
        {
            isvehiclespawned = 0;
        }
Goodluck
Reply
#5

Quote:
Originally Posted by gamer931215
Посмотреть сообщение
For as far i know GetVehiclePos only stores it into the given variables, so you must use it like this:

pawn Код:
new Float:x,Float:y,Float:z;
        if(GetVehiclePos(vehicleid, x,y,z))
        {
            if(x == 0 && y == 0 && z == 0)
            {
                isvehiclespawned = 0;
            }
        }
Goodluck
Thanks man, i will give it a try and see what will come out and if it works
Reply
#6

Try it this way,
If you have a command that spawns a selected car like a car that has components in it. and it is only spawned to only one player. and an admin ejects you out of the car and the (isvehiclespawned) is still 1. and then the admin decided to reset all unused cars and your car gone. and the server is still holding isvehiclespawned 1.
and you wanted to use /yourcarcommandhere. and it says that the car is being used by anothere player.
so the isvehiclespawned doesnt have a "(playerid)" or a "(vehicleid)" behind it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)