04.11.2015, 00:23
Algo do tipo, teste e adapte...
PHP код:
enum tInfo {
pCheckInAgua
}
new TimerInfo[MAX_PLAYERS][tInfo];
forward OnPlayerInAgua(playerid);
public OnPlayerConnect(playerid)
{
TimerInfo[playerid][pCheckInAgua] = SetTimerEx("OnPlayerInAgua", 2000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(TimerInfo[playerid][pCheckInAgua]);
return 1;
}
public OnPlayerInAgua(playerid)
{
static Float: vida;
GetPlayerHealth( playerid, vida );
if(vida != 0.0)
{
static anime;
anime = GetPlayerAnimationIndex(playerid);
if ((anime== 1544) || (anime== 1250) || (anime== 1062) || ((anime>= 1538) && (anime<= 1542)))
{
if(pInfo[playerid][SelectedItem] == 1023) // Agua_Cheia
{
GiveItem[playerid][Agua_Cheia]--;
SetPVarInt(playerid,"Sede1",GetPVarInt(playerid,"Sede1")-12);
SetProgressBarValue(Sede, GetPVarInt(playerid,"Sede1"));
UpdateProgressBar(Sede, playerid);
return 1;
}
}
}
return true;
}