On and Off funkcion for this callback
#5

Quote:
Originally Posted by Tadas
Посмотреть сообщение
Hello, how can I do on and off funkcion for this callback?:
pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    RepairVehicle(GetPlayerVehicleID(playerid));
    return 1;
}
you could do it like this

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;
}
like this, the callback will be fullly executed when CB_Status equals true.
if it's not, it'll just stop at the first line, our control structure
Reply


Messages In This Thread
On and Off funkcion for this callback - by Tadas - 22.03.2014, 10:59
Re: On and Off funkcion for this callback - by Tadas - 22.03.2014, 18:35
Re: On and Off funkcion for this callback - by MP2 - 22.03.2014, 19:29
Re: On and Off funkcion for this callback - by Tadas - 22.03.2014, 20:54
AW: On and Off funkcion for this callback - by CutX - 22.03.2014, 21:06
Re: AW: On and Off funkcion for this callback - by Tadas - 22.03.2014, 21:09

Forum Jump:


Users browsing this thread: 2 Guest(s)