17.12.2013, 15:19
There's a lot of error in your code for example you created a variable called Death and a callback called Death that will give you an error error 021: symbol already defined: "Death" and error 010: invalid function or declaration
This code should work.
This code should work.
pawn Код:
//macro
#define function:%0(%1) \
forward%0(%1); public%0(%1)
#define DEATH_TIME \
25
//variable
new
SecsToGo[ MAX_PLAYERS ] , DeathTimer[ MAX_PLAYERS char ];
public OnPlayerDeath( playerid, killerid, reason )
{
SecsToGo[ playerid ] = DEATH_TIME;
DeathTimer{ playerid } = SetTimerEx( "Death", 1000, true, "i", playerid ); //timer
return true;
}
function: Death( playerid )
{
if(0 < SecsToGo[playerid]) //Yoda Conditions
SecsToGo[playerid]--; // decrease the timer per second if it's more than 0 .
if(0 > SecsToGo[playerid]) //Yoda Conditions
KillTimer( DeathTimer{playerid} ), SpawnPlayer(playerid); //stops the timer and spawns the player
}