22.03.2014, 21:06
Quote:
Hello, how can I do on and off funkcion for this callback?:
pawn Код:
|
pawn Код:
new bool:CB_Status;//global bool
//now some cmd to turn it on and off
YCMD:vehcb(playerid,params[],help)
{
if(help) SendClientMessage(playerid,-1,"/vehcb Is used to turn the OnVehicleDamageStatusUpdate callback 'on' and 'off'");
//if(... doing some admin check here would be good ...)
if(!CB_Status) CB_Status = true;//turn it on when it was off
else CB_Status = false;//turn it off when it was on
return 1;
}
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
if(!CB_Status) return 1;//stop here if <-- equals false
RepairVehicle(GetPlayerVehicleID(playerid));
return 1;
}
if it's not, it'll just stop at the first line, our control structure