HELP -
DoVaH - 22.02.2012
Can someone tell me how to make players spawn to nearest hospital when they die.
Re: HELP -
niels44 - 22.02.2012
use OnPlayerDeath... and put under there a random spawn at each hospital
wait let me check wiki for more explaination
EDIT:
for the onplayerdeath function:
https://sampwiki.blast.hk/wiki/OnPlayerDeath
for random spawn:
https://sampwiki.blast.hk/wiki/Random
you have to place the last piece of the random spawn under onplayerdeath and place your own coordinates in the new float:....
(DO NOT COPY THE ONPLAYERSPAWN FUNCTION IN THE ONPLAYERDEATH FUNCTION!!)
greets niels
Re: HELP -
DoVaH - 22.02.2012
thanks this helped me a lot.
Re: HELP -
[ABK]Antonio - 22.02.2012
pawn Код:
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;
}
Is a much simpler method instead of randomizing it
Re: HELP -
DoVaH - 22.02.2012
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
Re: HELP -
[ABK]Antonio - 22.02.2012
Quote:
Originally Posted by DoVaH
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
|
that's completely different from what you're original question was asking...The problem is you created a variable named Random instead of rand