Hallo Brotfische,
Ich bin momentan dabei ein Krankenhaussystem zu scripten, also so dass man am nähesten Krankenhaus spawnt, aber leider spawn ich immer nur am gleichen
Codes:
public OnPlayerSpawn(playerid)
{
if(tot[playerid] == 1)
{
new
Float: KrankenhausDistance[8],
closest = -1,
Float: tmp_distance = -1.0;
KrankenhausDistance[0] = GetPlayerDistanceFromPoint(playerid, 2034.1149,-1414.9154,16.9922);
KrankenhausDistance[1] = GetPlayerDistanceFromPoint(playerid, 1182.1077,-1324.0918,13.5815);
KrankenhausDistance[2] = GetPlayerDistanceFromPoint(playerid, 1244.3423,331.9934,19.5547);
KrankenhausDistance[3] = GetPlayerDistanceFromPoint(playerid, 1607.6090,1821.0934,10.8280);
KrankenhausDistance[4] = GetPlayerDistanceFromPoint(playerid, -317.0090,1056.6217,19.7422);
KrankenhausDistance[5] = GetPlayerDistanceFromPoint(playerid, -1514.7358,2527.0601,55.7455);
KrankenhausDistance[6] = GetPlayerDistanceFromPoint(playerid, -2661.2441,633.7098,14.4531);
KrankenhausDistance[7] = GetPlayerDistanceFromPoint(playerid, -2198.7803,-2306.5793,30.6250);
for (new i; i != sizeof (HospitalDistance); ++i)
{
if (KrankenhausDistance[i] > tmp_distance)
{
tmp_distance = KrankenhausDistance[i];
closest = i;
}
}
// set player's pos
switch (closest)
{
case 0:
{
SetPlayerPos(playerid, 2034.1149,-1414.9154,16.9922);
SetPlayerFacingAngle(playerid, 133.3335);
tot[playerid] = 0;
}
case 1:
{
SetPlayerPos(playerid, 1182.1077,-1324.0918,13.5815);
SetPlayerFacingAngle(playerid, 270.4434);
tot[playerid] = 0;
}
case 2:
{
SetPlayerPos(playerid, 1244.3423,331.9934,19.5547);
SetPlayerFacingAngle(playerid, 335.6859);
tot[playerid] = 0;
}
case 3:
{
SetPlayerPos(playerid, 1607.6090,1821.0934,10.8280);
SetPlayerFacingAngle(playerid, 0.7354);
tot[playerid] = 0;
}
case 4:
{
SetPlayerPos(playerid, -317.0090,1056.6217,19.7422);
SetPlayerFacingAngle(playerid, 358.9579);
tot[playerid] = 0;
}
case 5:
{
SetPlayerPos(playerid, -1514.7358,2527.0601,55.7455);
SetPlayerFacingAngle(playerid, 359.0611);
tot[playerid] = 0;
}
case 6:
{
SetPlayerPos(playerid, -2661.2441,633.7098,14.4531);
SetPlayerFacingAngle(playerid, 180.1544);
tot[playerid] = 0;
}
case 7:
{
SetPlayerPos(playerid, -2198.7803,-2306.5793,30.6250);
SetPlayerFacingAngle(playerid, 320.6338);
tot[playerid] = 0;
}
}
return 1;
}
}
Ich hoffe es kann mir jemand helfen
MFG German_ScriperHD