16.08.2011, 08:34
Since my title now lured you into this thread, please take some time to answer..
I have a problem of Callbacks not calling in my filterscripts if they are in use by the main gamemode. The 2 callbacks seem to collide somehow and the code get's messed up.
Let me show you an example:
Instead of showing the fuel for ALL the cars, it only shows the fuel for the damaged cars. How do I fix this?
I have a problem of Callbacks not calling in my filterscripts if they are in use by the main gamemode. The 2 callbacks seem to collide somehow and the code get's messed up.
Let me show you an example:
Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if ((newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER))
{
new
vid;
vid = GetPlayerVehicleID(playerid);
for(new i=0; i<9; i++)
{
if(vid == DMGcars[i])
{
TogglePlayerControllable(playerid, 0);
GameTextForPlayer(playerid, "~r~This car is to badly damaged! Press ~k~~VEHICLE_ENTER_EXIT~ to exit.", 3000, 5);
indamagedcar[playerid]=1;
}
}
}
return 1;
}
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
new vid = GetPlayerVehicleID(playerid);
if(VehicleFuel[vid] > 20)
{
new
fstring[128];
format(fstring,sizeof fstring,"~w~Fuel: ~g~%i%%",VehicleFuel[vid]);
TextDrawSetString(Textdraw0[playerid],fstring);
TextDrawShowForPlayer(playerid,Textdraw0[playerid]);
}
else if(VehicleFuel[vid] <= 20)
{
new
fstring[125];
format(fstring,sizeof fstring,"~w~Fuel: ~r~%i%%",VehicleFuel[vid]);
TextDrawSetString(Textdraw0[playerid],fstring);
TextDrawShowForPlayer(playerid,Textdraw0[playerid]);
}
}
else
{
TextDrawHideForPlayer(playerid,Textdraw0[playerid]); //hiding if a player isnt driving/or an passenger
}
return 1;
}

