Lock/Unlock Car from outside
#1

As title says i need function that checks if player is near car.. (searched on forums non of them worked :/) Anyway i realy need this.

And other thing would be how to chek if player is near cars boot? <---Searched this aswell with n working results.
Reply
#2

http://pastebin.com/4p3c0wba
Reply
#3

And how do i use it?I am a bit confused now
Reply
#4

The function that was given returns the ID of the closest vehicle within a certain range.
For example this:

pawn Код:
new carid = GetClosestVehicle(playerid, 5.0);
Reply
#5

What i am doing wrong
Код:
command(vehtest, playerid, params[])
{
	new carid = GetClosestVehicle(playerid, 5.0);
	new Float:cx, Float:cy, Float:cz;
	GetVehiclePos(carid, cz, cy, cz);
	GetPlayerPos
	if(IsPlayerInRangeOfPoint(playerid, 5.0, cx,cy,cz))
	{
		SendClientMessage(playerid, WHITE, "YMessage.");
	}
	return 1;
}
Reply
#6

First remove GetPlayerPos.
Second use this:
GetVehiclePos(carid, cx, cy, cz);
Be careful.
Reply
#7

Getplayerpos wasnt finished.
Anyway still isnt working
Код:
command(vehtest, playerid, params[])
{
	new carid = GetClosestVehicle(playerid, 5.0);
	new Float:cx, Float:cy, Float:cz;
        GetVehiclePos(carid, cx, cy, cz);
	if(IsPlayerInRangeOfPoint(playerid, 5.0, cx,cy,cz))
	{
		SendClientMessage(playerid, WHITE, "Y.");
	}
	return 1;
}
Reply
#8

Quote:
Originally Posted by Steve1312
Посмотреть сообщение
Getplayerpos wasnt finished.
Anyway still isnt working
Код:
command(vehtest, playerid, params[])
{
	new carid = GetClosestVehicle(playerid, 5.0);
	new Float:cx, Float:cy, Float:cz;
        GetVehiclePos(carid, cx, cy, cz);
	if(IsPlayerInRangeOfPoint(playerid, 5.0, cx,cy,cz))
	{
		SendClientMessage(playerid, WHITE, "Y.");
	}
	return 1;
}
Are you sure that you are near a vehicle ?
Код:
command(vehtest, playerid, params[])
{
	new carid = GetClosestVehicle(playerid, 5.0),
		Float:cx, Float:cy, Float:cz;

	GetVehiclePos(carid, cx, cy, cz);

	if(carid == INVALID_VEHICLE_ID)
		return SendClientMessage(playerid, WHITE, "You aren't close to any vehicle !");

	if(IsPlayerInRangeOfPoint(playerid, 5.0, cx,cy,cz))
	{
		SendClientMessage(playerid, WHITE, "Y.");
	}
	return 1;
}
Reply
#9

Jup standing near my car. Spawned another one and still no result.
Reply
#10

I don't know the code is alright nothing is wrong in it!..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)