16.08.2016, 17:35
So actually i made a medkit system which heals the player in specific area.
here is the script, the problem is that the object does not get destroyed when the timer ends.
script:-
at the top-
the command script :-
the timer ending :-
Need help ASAP.
here is the script, the problem is that the object does not get destroyed when the timer ends.
script:-
at the top-
Код:
new OMedkit;
Код:
CMD:medkit(playerid, parmas[])
{
new Float:x,
Float:y,
Float:z;
new Float:ox,
Float:oy,
Float:oz;
new Float:MHealth;
GetPlayerPos(playerid, x, y, z);
if(Medkit[playerid] == 0) return SendClientMessage(playerid, -1, "You are not carrying any medkit! Please visit the shop to one.");
Medkit[playerid] = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
OMedkit = CreateObject(11738, x, y, z, 0, 0, 0);
SetTimerEx("mdestroy", 15000, false, "i", objectid);
GetObjectPos(OMedkit, ox,oy, oz);
GetPlayerHealth(i, MHealth);
if(gTeam[i] == gTeam[playerid])
{
if(IsPlayerInRangeOfPoint(i, 10.0, ox, oy, oz))
{
if(MHealth < 60.0)
{
SetPlayerHealth(i, 100.0);
SendClientMessage(i, -1, "You have been healed by a deployed medkit!");
}
}
}
}
return 1;
}
Код:
forward mdestroy(playerid);
public mdestroy(playerid)
{
DestroyObject(OMedkit);
return 1;
}


I don't know how to fix it.