#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
new PlayerHospital[MAX_PLAYERS];
new Float:someArray[8][3] = {
{1172.8717,-1323.2656,15.3995},
{2036.4738,-1411.0497,17.1641},
{1607.0693,1819.1843,10.8280},
{-322.1866,1050.9784,20.3403},
{-1515.0483,2521.4893,55.8556},
{-2658.1541,631.2337,14.4531},
{-2201.3555,-2307.5193,30.6250},
{1241.8477,327.6182,19.7555}
};
#define COLOR_MESSAGE 0xFFEE9FAA
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("LocalHospital by ComplexValue");
print("thanks to yom,MidoBan and !damo!spiderman");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
return floatsqroot(floatpower(x1 - x2, 2) + floatpower(y1 - y2, 2) + floatpower(z1 - z2, 2));
}
stock Float:GetClosestPoint( Float:pointsArray[][], sizeofArray, &Float:x, &Float:y, &Float:z )
{
new Float:pdist;
new Float:dist;
new cellP;
pdist = GetDistanceBetweenPoints( pointsArray[0][0], pointsArray[0][1], pointsArray[0][2], x, y, z );
cellP = 0;
for( new i = 1; i < sizeofArray; i++ )
{
dist = GetDistanceBetweenPoints( pointsArray[i][0], pointsArray[i][1], pointsArray[i][2], x, y, z );
if( dist < pdist )
{
pdist = dist;
cellP = i;
}
}
x = pointsArray[cellP][0];
y = pointsArray[cellP][1];
z = pointsArray[cellP][2];
return pdist;
}
public OnPlayerSpawn(playerid)
{
new MedicalBill = random(450)+50;
if (PlayerHospital[playerid] == 1)
{
SendClientMessage(playerid,COLOR_MESSAGE,"(Hospital):If your health reaches zero, you will pass out and you will be treated at the local medical center");
SendClientMessage(playerid,COLOR_MESSAGE,"to help put your health back up to normal you can eat food,use health pickups");
SendClientMessage(playerid,COLOR_MESSAGE,"or you can protect yourself by wearing body armor");
SendClientMessage(playerid,COLOR_MESSAGE,"before you are discharged, hospital staff will confiscate your weapons and bill you for the healthcare");
SendClientMessage(playerid,COLOR_MESSAGE,"you received.");
GivePlayerMoney(playerid,-MedicalBill);
PlayerHospital[playerid]--;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:x, Float:y, Float:z, Float:ang;
GameTextForPlayer(playerid,"Wasted!",4000,2);
GetPlayerPos( playerid, x, y, z );
GetClosestPoint( someArray, 8, x, y, z );
SetSpawnInfo(playerid,GetPlayerTeam(playerid),GetPlayerSkin(playerid),x,y,z,GetPlayerFacingAngle(playerid,Float:ang),0,0,0,0,0,0);
PlayerHospital[playerid]++;
return 1;
}