Death Timer Help please
#1

Okay when i go to compile this peace of code i get these Errors IDK what to do i been searching for about 2 hours and cant find nun
Код:
 public AfterDeath(playerid)
{

   	for(new i=0;i<MAX_PLAYERS;i++)
    {
   	    SetPlayerPos(playerid, DeathPosX[playerid], DeathPosY[playerid], DeathPosZ[playerid]);
        ApplyAnimation(playerid,"CRACK","crckdeth1",4.1,1,1,1,1,1,1);
	}
		GameTextForPlayer(playerid, "~r~Injured~n~~w~Please Call the EMS /service EMS", 5000, 3);
		new Float:HISCHP;
        GetPlayerHealth(playerid, HISCHP);
        SetPlayerHealth(playerid, HISCHP-5);
        if(HISCHP < 12.0)
        {
          PlayerInfo[playerid][pHospital] = 1;
          KillTimer(death_timer[playerid]);
          SetPlayerSpawn(playerid);
		}

    }
   	return 1;
}
if(newstate == PLAYER_STATE_WASTED) //PLAYER DIES
	{
	    if(PlayerInfo[playerid][pJailed] == 0)
	    {


                           new Float:DX;
			   new Float:DY;
			   new Float:DZ;
			   GetPlayerPos(playerid, DX, DY, DZ);
			   DeathPosX[playerid] = DX;
                           DeathPosY[playerid] = DY;
                           DeathPosZ[playerid] = DZ;

             death_timer[playerid] = SetTimer("AfterDeath", 7000, 1);



	    }
	}
	return 1;
}
Код:
C:\Users\User\Desktop\Server Stuff\PLA work\gamemodes\LAC.pwn(19268) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\Server Stuff\PLA work\gamemodes\LAC.pwn(19268) : warning 215: expression has no effect
C:\Users\User\Desktop\Server Stuff\PLA work\gamemodes\LAC.pwn(19268) : error 001: expected token: ";", but found "]"
C:\Users\User\Desktop\Server Stuff\PLA work\gamemodes\LAC.pwn(19268) : error 029: invalid expression, assumed zero
C:\Users\User\Desktop\Server Stuff\PLA work\gamemodes\LAC.pwn(19268) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

Which line?
Reply
#3

Quote:
Originally Posted by ChuckyBabe
Посмотреть сообщение
Which line?
sorry forgot to add this aha thanks for fast reply
Код:
 SetPlayerPos(playerid, DeathPosX[playerid], DeathPosY[playerid], DeathPosZ[playerid]);
this is the line that has errors
Reply
#4

They MUST be declared as variables:
pawn Код:
// global:
new Float: DeathPosX[MAX_PLAYERS], Float: DeathPosY[MAX_PLAYERS], Float: DeathPosZ[MAX_PLAYERS];
Also:

- The loop through all the players in AfterDeath is pointless since you never use it for anything + it sets the position and applies the animation as many times as MAX_PLAYERS is defined.
- You have extra closed bracket in AfterDeath public function.
- I hope you have the rest of the code about newstate IN OnPlayerStateChange callback.
Reply
#5

This is what i have now and its not coming back any errors on pawno but it still dont do anything in game.. When my health reach 0 there is no wait time and no animation, I just go strait to the hospital. This is what i have now.
Код:
 public AfterDeath(playerid)
{

   	for(new i=0;i<MAX_PLAYERS;i++)
    {
   	    SetPlayerPos(playerid, DeathPosX(playerid), DeathPosY(playerid), DeathPosZ(playerid));
        ApplyAnimation(playerid,"CRACK","crckdeth1",4.1,1,1,1,1,1,1);
	}
		GameTextForPlayer(playerid, "~r~Injured~n~~w~Please Call the EMS /service EMS", 5000, 3);
		new Float:HISCHP;
        GetPlayerHealth(playerid, HISCHP);
        SetPlayerHealth(playerid, HISCHP-5);
        if(HISCHP < 12.0)
	{
		PlayerInfo[playerid][pHospital] = 1;
		KillTimer(death_timer(playerid));
        SetPlayerSpawn(playerid);
    }
	return 1;

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)