Help With GetVehicleModelInfo ... -
OTACON - 23.01.2013
Hi all,
quero create a command to detect a vehicle position with GetVehicleModelInfo function and its parameters.
but I've done everything and it does not work: S: (.
Here I give a test of what I did:
pawn Код:
COMMAND:test(playerid, params[])
{
new newid=0, count=0, Float:pos[3];
for(new v = 0; v <= MAX_VEHICLES; v++)
{
newid= v;
GetVehicleModelInfo(GetVehicleModel(newid), VEHICLE_MODEL_INFO_PETROLCAP, pos[0], pos[1], pos[2]);
if(IsPlayerInRangeOfPoint(playerid, 5.0, pos[0],pos[1],pos[2]))
{
count++;
break;
}
}
switch(count)
{
case 0:
{
SendClientMessage(playerid, -1, "PETROLCAP No Detected");
}
case 1:
{
SendClientMessage(playerid, -1, "PETROLCAP Yes Detected");
}
default:
{
SendClientMessage(playerid, -1, "PETROLCAP Over 1 Detected");
}
}
return 1;
}
Thanks in advance.
sorry for my English.
Re: Help With GetVehicleModelInfo ... -
FUNExtreme - 23.01.2013
GetVehicleModelInfo has NOTHING to do with vehicle position. It returns the position of parts of the vehicle in relation to the vehicle, not in relation to the GTA SA world.
You need to use GetVehiclePos
Re: Help With GetVehicleModelInfo ... -
Roach_ - 23.01.2013
Try this:
pawn Код:
COMMAND:test(playerid)
{
new count = 0, Float:pos[3];
for(new v = 0; v <= MAX_VEHICLES; v++)
{
GetVehicleModelInfo(GetVehicleModel(v), VEHICLE_MODEL_INFO_PETROLCAP, pos[0], pos[1], pos[2]);
if(IsPlayerInRangeOfPoint(playerid, 5.0, pos[0],pos[1],pos[2]))
{
count++;
break;
}
}
switch(count)
{
case 0:
{
SendClientMessage(playerid, -1, "PETROLCAP No Detected");
}
case 1:
{
SendClientMessage(playerid, -1, "PETROLCAP Yes Detected");
}
case 2..MAX_VEHICLES:
{
SendClientMessage(playerid, -1, "PETROLCAP Over 1 Detected");
}
}
return 1;
}
Respuesta: Re: Help With GetVehicleModelInfo ... -
OTACON - 23.01.2013
Quote:
Originally Posted by Roach_
Try this:
pawn Код:
COMMAND:test(playerid) { new count = 0, Float:pos[3]; for(new v = 0; v <= MAX_VEHICLES; v++) { GetVehicleModelInfo(GetVehicleModel(v), VEHICLE_MODEL_INFO_PETROLCAP, pos[0], pos[1], pos[2]); if(IsPlayerInRangeOfPoint(playerid, 5.0, pos[0],pos[1],pos[2])) { count++; break; } } switch(count) { case 0: { SendClientMessage(playerid, -1, "PETROLCAP No Detected"); } case 1: { SendClientMessage(playerid, -1, "PETROLCAP Yes Detected"); } case 2..MAX_VEHICLES: { SendClientMessage(playerid, -1, "PETROLCAP Over 1 Detected"); } } return 1; }
|
returns always in SendClientMessage(playerid, -1, "PETROLCAP No Detected"); :S
@ FUNExtreme GetVehicleModelInfo Returns the position of the part.
Re: Respuesta: Re: Help With GetVehicleModelInfo ... -
FUNExtreme - 23.01.2013
Quote:
Originally Posted by bytytus
@ FUNExtreme GetVehicleModelInfo Returns the position of the part.
|
It returns the position of the part from the center of the vehicle.
Respuesta: Re: Respuesta: Re: Help With GetVehicleModelInfo ... -
OTACON - 23.01.2013
Quote:
Originally Posted by FUNExtreme
It returns the position of the part from the center of the vehicle.
|
¬¬
https://sampwiki.blast.hk/wiki/GetVehicleModelInfo
https://sampwiki.blast.hk/wiki/Vehicle_information_types
Here I am doing the same but I give it to instead of IsPlayerInRangeOfPoint Attach3DTextLabelToVehicle
pawn Код:
COMMAND:testing(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid), Float:pos[3];
GetVehicleModelInfo(GetVehicleModel(vehicleid), VEHICLE_MODEL_INFO_PETROLCAP, pos[0], pos[1], pos[2]);
new Text3D:texto = Create3DTextLabel("PETROLCAP", -1, 0.0, 0.0, 0.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(texto, vehicleid, pos[0], pos[1], pos[2]);
return 1;
}
It tests it in a vehicle.
Re: Respuesta: Re: Respuesta: Re: Help With GetVehicleModelInfo ... -
FUNExtreme - 23.01.2013
Quote:
Originally Posted by bytytus
|
Read the asterix (*)
Positions are calculated from the center of the vehicle so you have to use GetPlayerVehiclePos in combination with the GetVehicleModelInfo