22.02.2012, 14:13
Can someone tell me how to make players spawn to nearest hospital when they die.
new bool:JustDied[MAX_PLAYERS]=false;
public OnPlayerSpawn(playerid)
{
if(JustDied[playerid] == true)
{
new Float:Hosp1 = GetPlayerDistanceFromPoint(playerid, X, Y, Z),
Float:Hosp2 = GetPlayerDistanceFromPoint(playerid, X, Y, Z);
if(Hosp1 > Hosp2)
{
//set their pos to hosp 2
}
else
{
//set their pos to hosp 1
}
JustDied[playerid] = false;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
JustDied[playerid] = true;
return 1;
}
So i put this:
new Float:RandomSpawn[][] = { {2037.8833,-1411.0585,17.1641,125.2140}, {1178.1448,-1323.3326,14.1056,268.0599}, {-2675.1411,627.4380,14.4531,181.5241}, {1579.2161,1768.8231,10.8203,92.1241} }; public OnPlayerSpawn(playerid) { new Random = random(sizeof(RandomSpawn)); SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]); SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]); return 1; } and i get: C:\Users\Tomo\Desktop\SA_MP\gamemodes\mygamemode.p wn(507) : error 020: invalid symbol name "" C:\Users\Tomo\Desktop\SA_MP\gamemodes\mygamemode.p wn(50 : error 029: invalid expression, assumed zero C:\Users\Tomo\Desktop\SA_MP\gamemodes\mygamemode.p wn(50 : error 017: undefined symbol "rand" C:\Users\Tomo\Desktop\SA_MP\gamemodes\mygamemode.p wn(50 : error 029: invalid expression, assumed zero C:\Users\Tomo\Desktop\SA_MP\gamemodes\mygamemode.p wn(50 : fatal error 107: too many error messages on one line im a new to scripting |