Quote:
Originally Posted by Troydere
I'd create a function with the hp loss with a player timer of 1 second under OnPlayerEnterDynamicArea.
If you're doing it this way, remember to kill the timer in OnPlayerLeaveDynamicArea and OnPlayerDisconnect, as when someone disconnects inside a Dynamic Area, it does not count as if they left.
PHP код:
new badtimer[MAX_PLAYERS];
new dainameecErea
public OnGameModeInit
{
dainameecErea = CreateDynamicSphere(0,0,0,10);
return 1;
}
public OnPlayerConnect(playerid)
{
if(check if its you) AttachDynamicAreaToPlayer(dainameecErea, playerid, Float:offsetx = 0.0, Float:offsety = 0.0, Float:offsetz = 0.0);
return 1;
}
public OnPlayerEnterDynamicArea(playerid,STREAMER_TAG_AREA areaid)
{
badtimer[playerid] = SetTimerEx("SuckMyBlood",1000,true,"i",playerid);
return 1;
}
SuckMyBlood(playerid)
{
new Float:healtu;
GetPlayerHealth(playerid,healtu);
SetPlayerHealth(playerid,healtu - 15.0);
return 1;
}
public OnPlayerDisconnect // kill the timer
public OnPlayerLeaveDynamicArea // kill the timer
|
Ok thanks i will test it.