SA-MP Forums Archive
command error 035: argument type mismatch (argument 2) - 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: command error 035: argument type mismatch (argument 2) (/showthread.php?tid=260077)



command error 035: argument type mismatch (argument 2) - Silent_Rainstorm - 07.06.2011

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.


AW: command error 035: argument type mismatch (argument 2) - Nero_3D - 07.06.2011

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


Re: command error 035: argument type mismatch (argument 2) - Silent_Rainstorm - 07.06.2011

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]


Re: command error 035: argument type mismatch (argument 2) - gamer931215 - 07.06.2011

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


Re: command error 035: argument type mismatch (argument 2) - Silent_Rainstorm - 07.06.2011

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


Re: command error 035: argument type mismatch (argument 2) - Silent_Rainstorm - 07.06.2011

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.