07.06.2008, 15:41
Not all is made by me, but some!
GetObjectToPlayerDistance(playerid, objectid);
pawn Code:
stock GetObjectToPlayerDistance(playerid, objectid) //By me, Credits: Whoever made GetDistanceBetweenPlayers
{
new Float:ox, Float:oy, Float:oz, Float:px, Float:py, Float:pz;
new Float:distance;
GetObjectPos(objectid, ox, oy, oz);
GetPlayerPos(playerid, px, py, pz);
distance = floatsqroot(floatpower(floatabs(floatsub(ox, px)),2)+floatpower(floatabs(floatsub(oy, py)),2)+floatpower(floatabs(floatsub(oz, pz)),2));
return floatround(distance);
}
GetDistanceFromPlayerToVehicle(playerid, vehicleid);
pawn Code:
stock GetDistanceFromPlayerToVehicle(playerid, vehicleid)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetVehiclePos(vehicleid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
GetVehiclePlayerID(vehicleid);
pawn Code:
stock GetVehiclePlayerID(vehicleid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(vehicleid == GetPlayerVehicleID(i))
{
return vehicleid;
}
}
return INVALID_PLAYER_ID;
}
GetDistanceBetweenVehicles(vehicleid, vehicleid2);
pawn Code:
stock GetDistanceBetweenVehicles(vehicleid, vehicleid2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetVehiclePos(vehicleid,x1,y1,z1);
GetVehiclePos(vehicleid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
GetDistanceBetweenPlayers(playerid, playerid2)
pawn Code:
stock GetDistanceBetweenPlayers(playerid, playerid2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
GetPlayerVehicleModel(playerid);
pawn Code:
stock GetPlayerVehicleModel(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
new model = GetVehicleModel(vehicleid);
return model;
}