Not spawning correctly after death
#1

So here you see what I want people to do after they die, and then you see my player class shit.
I want people to spawn there when they die, but instead when someone dies, they go to the hospital, then their health is set to O and they automatically spawn again on the spawn of team they origanally chose.

how do I fix this


pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    SetPlayerPos(playerid,1178.7999,-1325.9056,14.1379); //hosp
    SendClientMessage(playerid, COLOR_RED, "You have been killed, you will respawn at the hospital.");
    SetPlayerFacingAngle(playerid,269.8335);
}
public OnPlayerRequestClass(playerid, classid)
{
    if(classid >= 0 && classid <= 2)
    {
        gTeam[playerid] = BALLAS;
        GameTextForPlayer(playerid,"~w~Ballas",3000,5); // This will show up an Text , when you select your class
        SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
        SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
        SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
        SetPlayerFacingAngle(playerid,122.4500);
        SetPlayerColor(playerid,COLOR_PINK); // Teamcolor
    }
    else if(classid >= 3 && classid <= 5)
    {
        gTeam[playerid] = GROVES;
        GameTextForPlayer(playerid,"~w~Grove Street Famlilys",3000,5);
        SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerFacingAngle(playerid,252.4717);
        SetPlayerColor(playerid,COLOR_GREEN);
    }
    else if(classid >= 6 && classid <= 8)
    {
        gTeam[playerid] = POLICE;
        GameTextForPlayer(playerid,"~w~Police Department",3000,5);
        SetPlayerPos(playerid,1568.4847,-1692.2544,5.8906);
        SetPlayerCameraPos(playerid,1568.3635,-1699.9193,5.8906);
        SetPlayerCameraLookAt(playerid,1568.4847,-1692.2544,5.8906);
        SetPlayerFacingAngle(playerid,182.0096);
        SetPlayerColor(playerid,COLOR_BLUE);
    }
    return 1;
}
Reply
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
}
public OnPlayerRequestClass(playerid, classid)
{
    if(classid >= 0 && classid <= 2)
    {
        gTeam[playerid] = BALLAS;
        GameTextForPlayer(playerid,"~w~Ballas",3000,5); // This will show up an Text , when you select your class
        SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
        SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
        SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
        SetPlayerFacingAngle(playerid,122.4500);
        SetPlayerColor(playerid,COLOR_PINK); // Teamcolor
    }
    else if(classid >= 3 && classid <= 5)
    {
        gTeam[playerid] = GROVES;
        GameTextForPlayer(playerid,"~w~Grove Street Famlilys",3000,5);
        SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerFacingAngle(playerid,252.4717);
        SetPlayerColor(playerid,COLOR_GREEN);
    }
    else if(classid >= 6 && classid <= 8)
    {
        gTeam[playerid] = POLICE;
        GameTextForPlayer(playerid,"~w~Police Department",3000,5);
        SetPlayerPos(playerid,1568.4847,-1692.2544,5.8906);
        SetPlayerCameraPos(playerid,1568.3635,-1699.9193,5.8906);
        SetPlayerCameraLookAt(playerid,1568.4847,-1692.2544,5.8906);
        SetPlayerFacingAngle(playerid,182.0096);
        SetPlayerColor(playerid,COLOR_BLUE);
    }
    return 1;
}
Is that what you want, or what? That they just spawn where they should instead of going to hospital?
Reply
#3

No. I want them to spawn at the hospital coords
Reply
#4

I can't see anything wrong in the code..

Try this..

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SetPlayerPos(playerid,1178.7999,-1325.9056,14.1379); //hosp
    SendClientMessage(playerid, COLOR_RED, "You have been killed, you will respawn at the hospital.");
    SetPlayerFacingAngle(playerid,269.8335);
    return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
    if(classid >= 0 && classid <= 2)
    {
        gTeam[playerid] = BALLAS;
        GameTextForPlayer(playerid,"~w~Ballas",3000,5); // This will show up an Text , when you select your class
        SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
        SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
        SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
        SetPlayerFacingAngle(playerid,122.4500);
        SetPlayerColor(playerid,COLOR_PINK); // Teamcolor
    }
    else if(classid >= 3 && classid <= 5)
    {
        gTeam[playerid] = GROVES;
        GameTextForPlayer(playerid,"~w~Grove Street Famlilys",3000,5);
        SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerFacingAngle(playerid,252.4717);
        SetPlayerColor(playerid,COLOR_GREEN);
    }
    else if(classid >= 6 && classid <= 8)
    {
        gTeam[playerid] = POLICE;
        GameTextForPlayer(playerid,"~w~Police Department",3000,5);
        SetPlayerPos(playerid,1568.4847,-1692.2544,5.8906);
        SetPlayerCameraPos(playerid,1568.3635,-1699.9193,5.8906);
        SetPlayerCameraLookAt(playerid,1568.4847,-1692.2544,5.8906);
        SetPlayerFacingAngle(playerid,182.0096);
        SetPlayerColor(playerid,COLOR_BLUE);
    }
    return 1;
}
Reply
#5

Show your onplayerspawn.
Reply
#6

Added onplayerspawn and testing that guys idea


That didnt help at all
Reply
#7

You got "SetPlayerHealth(playerid, 0);" anywhere where it should not be? Making your HP 0 whenever you spawn? It might be in filterscript if you have any.
Reply
#8

if(!strcmp(cmdtext, "/kill"))
{
SetPlayerHealth (playerid, 0.0);
return 1;
}




only this
Reply
#9

Try this (i am not 100% sure that will work)

Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    new killed = 1; 

    SendClientMessage(playerid, COLOR_RED, "You have been killed, you will respawn at the hospital.");
    
}
public OnPlayerSpawn.....
{
       if(killed == 1)
       {
                  SetPlayerPos(playerid,1178.7999,-1325.9056,14.1379); //hosp
                  SetPlayerFacingAngle(playerid,269.8335);
       }
}
public OnPlayerRequestClass(playerid, classid)
{
    
    if(classid >= 0 && classid <= 2)
    {
        gTeam[playerid] = BALLAS;
        GameTextForPlayer(playerid,"~w~Ballas",3000,5); // This will show up an Text , when you select your class
        SetPlayerPos(playerid,1975.2399,-1220.0157,25.0779); // position of the player in the class selection
        SetPlayerCameraPos(playerid,1969.5686,-1224.0016,24.9909); // Cameraposition
        SetPlayerCameraLookAt(playerid,1975.2399,-1220.0157,25.0779);
        SetPlayerFacingAngle(playerid,122.4500);
        SetPlayerColor(playerid,COLOR_PINK); // Teamcolor
    }
    else if(classid >= 3 && classid <= 5)
    {
        gTeam[playerid] = GROVES;
        GameTextForPlayer(playerid,"~w~Grove Street Famlilys",3000,5);
        SetPlayerPos(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerCameraPos(playerid,2507.0615,-1674.3574,13.3732);
        SetPlayerCameraLookAt(playerid,2500.6060,-1672.1453,13.3512);
        SetPlayerFacingAngle(playerid,252.4717);
        SetPlayerColor(playerid,COLOR_GREEN);
    }
    else if(classid >= 6 && classid <= 8)
    {
        gTeam[playerid] = POLICE;
        GameTextForPlayer(playerid,"~w~Police Department",3000,5);
        SetPlayerPos(playerid,1568.4847,-1692.2544,5.8906);
        SetPlayerCameraPos(playerid,1568.3635,-1699.9193,5.8906);
        SetPlayerCameraLookAt(playerid,1568.4847,-1692.2544,5.8906);
        SetPlayerFacingAngle(playerid,182.0096);
        SetPlayerColor(playerid,COLOR_BLUE);
    }
    return 1;
}
If you want to:
-- when you go to hospital you are set to "no team" add a new team called Killed, and set their color to white but if you want to when they go to hospital and they are still police or other team dont create the killed team, its your decision.
When you want a player to spawn at a hospital after dead, put setplayerpos IN ONPLAYERSPAWN, not in ONPLAYERDEAD.
Reply
#10

I dont want a team for the dead, I just want to spawn at a hospital on the same team when I die,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)