Death Timer Help please -
shaquill - 04.05.2015
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.
Re: Death Timer Help please -
ChuckyBabe - 04.05.2015
Which line?
Re: Death Timer Help please -
shaquill - 04.05.2015
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
Re: Death Timer Help please -
Konstantinos - 04.05.2015
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.
Re: Death Timer Help please -
shaquill - 04.05.2015
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;
}