14.12.2011, 14:58
Yeah you've made an error with defining what vehicle you want.
vehicle id pasv = vehicle id pasv
That won't work xD
Try this
UNTESTED:
vehicle id pasv = vehicle id pasv
That won't work xD
Try this
UNTESTED:
pawn Код:
stock IsPlayerInRangeOfVehicle(Float:radius, playerid, vehicleid)
{
if(IsPlayerConnected(playerid))
{
new Float:PX;
new Float:PY;
new Float:PZ;
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid, PX, PY, PZ);
GetVehiclePos(vehicleid, X, Y, Z);
new Float:Distance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
if(Distance <= radius * radius)
{
return 1;
}
}
return 0;
}
if(strcmp( cmd, "/getin", true ) == 0 )
{
new Float:X, Float:Y, Float:Z;
new pasv = 99999;
for(new i=0; i<MAX_VEHICLES; i++)
{
if(IsPlayerInRangeOfVehicle(3, playerid, i))
{
pasv = i;
}
}
if (pasv == 99999) return 1;
PutPlayerInVehicle(playerid, pasv, 1);
return 1;
}

