spawn at hospital when die
#1

Hello, how i can spawn at hospital someone when die?
Reply
#2

Something like this:

pawn Code:
Under OnPlayerDeath

HasDied[playerid] = 1;

Under OnPlayerSpawn

if(HasDied[playerid] == 1)
{
    SetPlayerPos..etc
}
Reply
#3

Under OnPlayerDeath callback.
pawn Code:
SetPlayerPos(playerid, Float:x , Float:y, Float:z);
Replace your co-ordinates with the floats.

EDIT : Infamous was faster.
Reply
#4

Quote:

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.

pawn Code:
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;
}
Reply
#5

Top of your script, under the includes etc:

new HasDied[MAX_PLAYERS];
Reply
#6

Thanks
Reply
#7

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:
// 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;
}
Reply
#8

UPDATE: Not working Sorry for double post but i dunno to edit :/
Reply
#9

Make sure it's the same as my above post pal.
Reply
#10

Quote:
Originally Posted by Infamous
View Post
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:
// 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;
}
I think there's no need for the variables.

Quote:
Originally Posted by Gooday
View Post
UPDATE: Not working Sorry for double post but i dunno to edit :/
What actually is the problem.Did you tried my code ?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)