new Float:oldv[MAX_PLAYERS];
new Float:newv[MAX_PLAYERS];
forward health();
forward vhealth();
public health()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1){
if(IsPlayerInAnyVehicle(i))
{
GetVehicleHealth(GetPlayerVehicleID(i),oldv[i]);
SetTimer("vhealth",20000,0);
}
}
}
}
public vhealth()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1){
if(IsPlayerInAnyVehicle(i))
{
GetVehicleHealth(GetPlayerVehicleID(i),newv[i]);
SetTimer("health",1000,0);
if (oldv[i] == newv[i]) RemovePlayerFromVehicle(i);
}
}
}
}
new Float:oldv[MAX_PLAYERS];
new Float:newv[MAX_PLAYERS];
forward health();
forward vhealth();
public health()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1)
{
if(IsPlayerInAnyVehicle(i))
{
new Float:carhp, Float:FinalHP;
new VID = GetPlayerVehicleID(i);
GetVehicleHealth(VID, carhp);
FinalHP = carhp/10;
oldv[i] = floatround(FinalHP, floatround_round);
SetTimer("vhealth",20000,0);
}
}
}
}
public vhealth()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1)
{
if(IsPlayerInAnyVehicle(i))
{
new Float:carhp, Float:FinalHP;
new VID = GetPlayerVehicleID(i);
GetVehicleHealth(VID, carhp);
FinalHP = carhp/10;
newv[i] = floatround(FinalHP, floatround_round);
SetTimer("health",1000,0);
if(oldv[i] == newv[i]) RemovePlayerFromVehicle(i);
}
}
}
}
//top
new timername[MAX_PLAYERS];
//onplayercmdtext
if(strcmp(cmdtext, "/execute", true) == 0)
{
timername[playerid] = SetTimerEx("timerfunction", 50, false, "i", playerid);
}
if(strcmp(cmdtext, "/kill", true) == 0)
{
KillTimer(timername[playerid]);
}
//the function
forward timerfunction(playerid);
public timerfunction(playerid)
{
//do something
}
Originally Posted by cloud9
i dont know how to use it, can u help me a little bit.
|
new Float:oldv[MAX_PLAYERS];
new Float:newv[MAX_PLAYERS];
forward health();
forward vhealth();
public health()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1)
{
if(IsPlayerInAnyVehicle(i))
{
new Float:carhp, Float:FinalHP;
new VID = GetPlayerVehicleID(i);
GetVehicleHealth(VID, carhp);
FinalHP = carhp/10;
oldv[i] = floatround(FinalHP, floatround_round);
SetTimerEx("vhealth",20000,0,i,playerid);
}
}
}
}
public vhealth()
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerDerby[i] == 1)
{
if(IsPlayerInAnyVehicle(i))
{
new Float:carhp, Float:FinalHP;
new VID = GetPlayerVehicleID(i);
GetVehicleHealth(VID, carhp);
FinalHP = carhp/10;
newv[i] = floatround(FinalHP, floatround_round);
SetTimerEx("health",1000,0,i,playerid);
if(oldv[i] == newv[i]) RemovePlayerFromVehicle(i);
}
}
}
}