[HELP] simple plz help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] simple plz help (
/showthread.php?tid=277046)
[HELP] simple plz help -
Intoxicated - 16.08.2011
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:
Код:
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;
}
Instead of showing the fuel for ALL the cars, it only shows the fuel for the damaged cars. How do I fix this?
Re: [HELP] simple plz help -
sansko - 16.08.2011
i cant see the problem in this code, but i do see that you try to make a player uncontrollable and then ask them to exit the vehicle
Re: [HELP] simple plz help -
Intoxicated - 22.08.2011
Okay apparently sa-mp doesn't like calling OnPlayerSpawn in FS and by debugging with print I managed to find that the problem was caused by ABSOLUTELY NOTHING and the only fix was moving it to my main gamemode.