Help with a death/spawn system
#1

Hello everyone well here is my problem. I created a death system so that when a user dies they spawn where they die and are frozen until paramedics arrive. The problem is that when a player logs in they automatically freeze and spawn at 0.000,0.000,0.000. Here is the code for OnPlayerDeath:

PHP код:
        {
                new 
Float:XFloat:YFloat:Z;
                
GetPlayerPos(playeridXYZ);
                
DeathPosX[playerid] = X;
                
DeathPosY[playerid] = Y;
                
DeathPosZ[playerid] = Z;
                
PlayerInfo[playerid][pArmor] = 0;
                
PlayerInfo[playerid][pDead] = 1;
            } 
Now here is the SpawnChar() function part:

PHP код:
if(PlayerInfo[playerid][pDead] == 1)
        {
             
SetPlayerPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]);
              
SetPlayerCameraPos(playerid,DeathPosX[playerid],DeathPosY[playerid],DeathPosZ[playerid]+5);
             
ClearAnimations(playerid);
              
ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE"4.000010);
              
TogglePlayerControllable(playerid0);
              
GameTextForPlayer(playerid"~r~Injured~n~~w~/accept death or /call 911"50003);
              
SetPlayerHealth(playerid50);
        }
        else
        {
            
SetPlayerVirtualWorld(playeridPlayerInfo[playerid][pVW]);
            
SetPlayerInterior(playeridPlayerInfo[playerid][pInt]);
            
SetCameraBehindPlayer(playerid);
            
SetPlayerPos(playeridPlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
            
// HP and Armor
            
if(PlayerInfo[playerid][pHealth] <= 0PlayerInfo[playerid][pHealth] = 1;
            
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
            
SetPlayerArmour(playeridPlayerInfo[playerid][pArmor]);
        } 
I need this fixed ASAP, you will be given REP if you assist me at all.
Reply
#2

Make sure that in OnPlayerConnect, you set their PlayerInfo[playerid][pDead] equal to 0, and only set it to 0 during OnPlayerDeath.

When are you calling SpawnChar, and it DOES take playerid as an argument, correct?
Reply
#3

I'll try that and see if it works, although I already set it to set pDead to equal 0 OnPlayerDisconnect
Reply
#4

Alright now the initial login part is fine, but when a player dies they spawn at where they log in and it says the gametext etc.
Reply
#5

Anyone?
Reply
#6

bump
Reply
#7

do you want them to just be frozen or do you want them to have a certain animation while they wait?
Reply
#8

a certain animation. That's not the problem. Read ^
Reply
#9

You get an error? if yes tell us what error.
Reply
#10

I'm not receiving any errors at all. The thing is when a user dies, they spawn where they were first spawned upon login. Anyways, I have teamviewer. All help is greatly appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)