11.10.2017, 06:29
Hello, I am trying to execute the / autofix command that automatically repairs the vehicles without having to type it again, then I leave the code.
What I need is to see and optimize it in the best way so that it does not cause lag, what would be the best option? I listen to comments and / or codes, thank you.
What I need is to see and optimize it in the best way so that it does not cause lag, what would be the best option? I listen to comments and / or codes, thank you.
PHP код:
new AutoFix[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
if(AutoFix[playerid] == 1 && IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
}
return 1;
}
CMD:autofix(playerid,params[])
{
if (AutoFix[playerid] == 0)
{
AutoFix[playerid] = 1;
}
else if (AutoFix[playerid] == 1)
{
AutoFix[playerid] = 0;
}
return 1;
}