Help with a death/spawn system[Not yet Resolved] -
Joshman543 - 20.02.2013
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:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
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.0, 0, 0, 0, 1, 0);
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, "~r~Injured~n~~w~/accept death or /call 911", 5000, 3);
SetPlayerHealth(playerid, 50);
}
else
{
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetCameraBehindPlayer(playerid);
SetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
// HP and Armor
if(PlayerInfo[playerid][pHealth] <= 0) PlayerInfo[playerid][pHealth] = 1;
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]);
}
I need this fixed ASAP, you will be given REP if you assist me at all.
Re: Help with a death/spawn system -
Alternative112 - 20.02.2013
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?
Re: Help with a death/spawn system -
Joshman543 - 20.02.2013
I'll try that and see if it works, although I already set it to set pDead to equal 0 OnPlayerDisconnect
Re: Help with a death/spawn system -
Joshman543 - 20.02.2013
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.
Re: Help with a death/spawn system -
Joshman543 - 20.02.2013
Anyone?
Re: Help with a death/spawn system -
Joshman543 - 20.02.2013
bump
Re: Help with a death/spawn system -
Godzilla8957 - 20.02.2013
do you want them to just be frozen or do you want them to have a certain animation while they wait?
Re: Help with a death/spawn system -
Joshman543 - 21.02.2013
a certain animation. That's not the problem. Read ^
Re: Help with a death/spawn system -
PabloDiCostanzo - 21.02.2013
You get an error? if yes tell us what error.
Re: Help with a death/spawn system -
Joshman543 - 21.02.2013
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.