30.09.2010, 22:39
Working:
Not Working:
Why is the not-working one causing the server to crash, and how can I fix it. This is really confusing
pawn Код:
public DashUpdate(playerid)
{
new vehid = GetPlayerVehicleID(playerid);
new estring[7];
switch(EngineStatus[vehid])
{
case 0: estring = "Off";
case 1: estring = "On";
default: estring = "Broken";
}
new tstring[300];
format(tstring,sizeof(tstring),"Engine: %s~n~Fuel: %d~n~Speed: %d KM" , estring, Fuel[vehid], GetVehicleSpeed(vehid));
TextDrawSetString(Dash[playerid], tstring);
TextDrawHideForPlayer(playerid,Dash[playerid]);
TextDrawShowForPlayer(playerid,Dash[playerid]);
return 1;
}
pawn Код:
public DashUpdate(playerid)
{
new State = GetPlayerState(playerid);
if(State == PLAYER_STATE_DRIVER && IsPlayerInAnyVehicle(playerid))
{
new vehid = GetPlayerVehicleID(playerid);
new estring[7];
switch(EngineStatus[vehid])
{
case 0: estring = "Off";
case 1: estring = "On";
default: estring = "Broken";
}
new tstring[300];
format(tstring,sizeof(tstring),"Engine: %s~n~Fuel: %d~n~Speed: %d KM" , estring, Fuel[vehid], GetVehicleSpeed(vehid));
TextDrawSetString(Dash[playerid], tstring);
TextDrawHideForPlayer(playerid,Dash[playerid]);
TextDrawShowForPlayer(playerid,Dash[playerid]);
}
else
{
TextDrawHideForPlayer(playerid,Dash[playerid]);
KillTimer(DashUpdate(playerid));
}
return 1;
}