A bit help in zcmd.
#1

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-
Код:
new OMedkit;
the command script :-
Код:
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;
}
the timer ending :-
Код:
forward mdestroy(playerid);
public mdestroy(playerid)
{
   DestroyObject(OMedkit);
return 1;
}
Need help ASAP.
Reply


Messages In This Thread
A bit help in zcmd. - by DeeadPool - 16.08.2016, 17:35
Re: A bit help in zcmd. - by DeeadPool - 17.08.2016, 09:21
Re: A bit help in zcmd. - by jlalt - 17.08.2016, 09:29
Re: A bit help in zcmd. - by Vince - 17.08.2016, 09:56
Re: A bit help in zcmd. - by DeeadPool - 17.08.2016, 10:05
Re: A bit help in zcmd. - by DeeadPool - 17.08.2016, 10:19
Re: A bit help in zcmd. - by jlalt - 17.08.2016, 14:30
Re: A bit help in zcmd. - by DeeadPool - 17.08.2016, 15:03
Re: A bit help in zcmd. - by jlalt - 17.08.2016, 16:06

Forum Jump:


Users browsing this thread: 2 Guest(s)