Speedometer crashes my client
#1

Hey guys
Speedometer alone = Works
Fuel meter alone = Works
Together = Crash

(Ignore Speedcheck)

PHP код:
// Speedometer
        
if(Speedo[playerid] && fMeter[playerid] && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
string[128], speed GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
            
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r-Speedometer: ~w~%d MPH ~r~Fuel: ~w~ %d%"speedFuel[GetPlayerVehicleID(playerid)]);
            
GameTextForPlayer(playeridstring10003);
        }
        if(
Speedo[playerid] == && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && !fMeter[playerid])
        {
            new 
string[64], speed GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
            
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Speedometer: ~w~%d MPH"speed);
            
GameTextForPlayer(playeridstring,10003);
        }
        
// SpeedCheck
        
if(IsPlayerInAnyVehicle(playerid) && IsAAdmin(playerid) && IsAFlight(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new 
speed GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
            if(
speed 205 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 519 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 553  && GetVehicleModel(GetPlayerVehicleID(playerid)) != 592 && IsAAdmin(playerid) || speed 240)
            {
                new 
string[128];
                
format(stringsizeof(string), "AdmWarn: %s might be using speed hacks (%d MPH)"RPN(playerid), speed);
                
SendAdminMessage(COLOR_DARKRED1string);
            }
        }
        
// Fuel
        
if(fMeter[playerid] == && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && !Speedo[playerid])
        {
            new 
string[64];
            
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Fuel: ~w~%d%"Fuel[GetPlayerVehicleID(playerid)]);
            
GameTextForPlayer(playeridstring,10003);
        } 
Reply
#2

Any clues?
Reply
#3

The wiki does not mention server crashes when not closing the text color tildes, but it might as well be the cause of your problem:
PHP код:
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r-Speedometer: ~w~%d MPH ~r~Fuel: ~w~ %d%"speedFuel[GetPlayerVehicleID(playerid)]); 
You have to make sure that the amount of '~' or tildes are of an even amount. You forgot the closing tilde after the 'r' right before 'Speedometer'.

Warning on the wiki:
Quote:
Originally Posted by wiki warning
Be careful, using too many text colors or special characters in one gametext may crash every player the gametext is shown to. Additionally, avoid using an uneven usage of the ~ character.

Example: ~~r~Hello, ~g~how are ~y~~you?~
Reply
#4

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
The wiki does not mention server crashes when not closing the text color tildes, but it might as well be the cause of your problem:
PHP код:
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r-Speedometer: ~w~%d MPH ~r~Fuel: ~w~ %d%"speedFuel[GetPlayerVehicleID(playerid)]); 
You have to make sure that the amount of '~' or tildes are of an even amount. You forgot the closing tilde after the 'r' right before 'Speedometer'.

Warning on the wiki:
I've read about the function on the wiki just yesterday, damn me
I'll try it out
Reply
#5

You also have a lonely '%' at the end of that same line.

EDIT: just noticed the context of it. I'm pretty sure you have to escape it: \% or %%.
Reply
#6

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
You also have a lonely '%' at the end of that same line.

EDIT: just noticed the context of it. I'm pretty sure you have to escape it: \% or %%.
Well I know that to make the percent sign by itself I have to double it (%%)
but it works that way, so why would I ?
Thanks for helping by the way!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)