17.08.2016, 09:29
try this sir
PHP код:
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", OMedkit);
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(My_objectID);
public mdestroy(My_objectID)
{
DestroyObject(My_objectID);
return 1;
}