12.03.2012, 17:07
Hello, how i can spawn at hospital someone when die?
Under OnPlayerDeath
HasDied[playerid] = 1;
Under OnPlayerSpawn
if(HasDied[playerid] == 1)
{
SetPlayerPos..etc
}
SetPlayerPos(playerid, Float:x , Float:y, Float:z);
C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1369) : error 017: undefined symbol "HasDied" C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1369) : warning 215: expression has no effect C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1369) : error 001: expected token: ";", but found "]" C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1369) : error 029: invalid expression, assumed zero C:\Users\Luca\Desktop\BaseScript\gamemodes\base.pw n(1369) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |
public OnPlayerSpawn(playerid)
{
SetPlayerColor(playerid, COLOR_GREY);
SetPlayerPos(playerid, -88.0029, 1222.8109, 19.7422);
SetPlayerInterior(playerid, 0);
TogglePlayerClock(playerid, 1);
SetPlayerVirtualWorld(playerid, 0);
if(HasDied[playerid] == 1)
{
SetPlayerPos(id, -2208.3994140625, -2329.599609375, 30.200000762939);
}
return 1;
}
// Top of script
new HasDied[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
HasDied[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(HasDied[playerid] == 1)
{
SetPlayerPos(..
SetPlayerFacingAngle(..
HasDied[playerid] = 0;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
HasDied[playerid] = 1;
return 1;
}
Might be an idea to set HasDied[playerid] = 0; under the SetPlayerPos bit in OnPlayerSpawn and under OnPlayerConnect HasDied[playerid] = 0; just to ensure nothing goes wrong.
pawn Code:
|