Hi, how to check whether the player on the machine hood -
Karolukas123 - 05.04.2015
Hi, how to check whether the player on the machine hood
Re: Hi, how to check whether the player on the machine hood -
izeatfishz - 05.04.2015
what?
Re: Hi, how to check whether the player on the machine hood -
Karolukas123 - 05.04.2015
I need a function that player back-loaded to the front of the machine ( hood )
Re: Hi, how to check whether the player on the machine hood -
Jimmy0wns - 05.04.2015
In order to use this, you need
this include.
pawn Код:
CMD:isonhood(playerid, params[])
{
new Float:posX, Float:posY, Float:posZ;
GetVehicleHood(vehicleid, posX, poxY, posZ);
if(IsPlayerInRangeOfPoint(playerid, 3.0, posX, poxY, posZ));
print("player is on hood of vehicle");
return 1;
}
Just think the command stuff away.
Re: Hi, how to check whether the player on the machine hood -
Karolukas123 - 05.04.2015
how to get include ?
Re: Hi, how to check whether the player on the machine hood -
SickAttack - 05.04.2015
Same as above, get this include:
https://sampforum.blast.hk/showthread.php?tid=486060
Then this is for general use (all vehicles):
pawn Код:
CMD:isonhood(playerid, params[])
{
new Float:x, Float:y, Float:z, bool:found = false;
for(new i = 1; i < MAX_VEHICLES; i ++)
{
GetVehicleHood(i, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
{
found = true;
break;
}
}
if(found) SendClientMessage(playerid, -1, "You're by a vehicle's hood!")
else SendClientMessage(playerid, -1, "You're NOT by a vehicle's hood!")
return 1;
}
Re: Hi, how to check whether the player on the machine hood -
Jimmy0wns - 05.04.2015
Quote:
Originally Posted by SickAttack
Same as above, get this include: https://sampforum.blast.hk/showthread.php?tid=486060
Then this is for general use (all vehicles):
pawn Код:
CMD:isonhood(playerid, params[]) { new Float:x, Float:y, Float:z, bool:found = false; for(new i = 1; i < MAX_VEHICLES; i ++) { GetVehicleHood(i, x, y, z); if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z)) { found = true; break; } }
if(found) SendClientMessage(playerid, -1, "You're by a vehicle's hood!") else SendClientMessage(playerid, -1, "You're NOT by a vehicle's hood!") return 1; }
|
I totally forgot to check the vehicle id, oops!
But in your case, it isn't necessary to loop through all vehicles, just use a function that gets the nearest vehicle ID.
Re: Hi, how to check whether the player on the machine hood -
Abagail - 05.04.2015
Quote:
Originally Posted by Jimmy0wns
I totally forgot to check the vehicle id, oops!
But in your case, it isn't necessary to loop through all vehicles, just use a function that gets the nearest vehicle ID.
|
But most nearest vehicle functions do use loops, rendering your statement quite illogical.
Re: Hi, how to check whether the player on the machine hood -
Sellize - 06.04.2015
Quote:
Originally Posted by Jimmy0wns
In order to use this, you need this include.
pawn Код:
CMD:isonhood(playerid, params[]) { new Float:posX, Float:posY, Float:posZ; GetVehicleHood(vehicleid, posX, poxY, posZ); if(IsPlayerInRangeOfPoint(playerid, 3.0, posX, poxY, posZ));
print("player is on hood of vehicle"); return 1; }
Just think the command stuff away.
|
Wouldn't this also tell you the player is on the hood when he is standing beside the vehicle?
Re: Hi, how to check whether the player on the machine hood -
Jimmy0wns - 06.04.2015
Quote:
Originally Posted by Sellize
Wouldn't this also tell you the player is on the hood when he is standing beside the vehicle?
|
I'm not sure how the range is in GTA:SA, so OP can change it himself, my post wasn't very accurate either since I forgot to do a few things.