Wierd problem..
#1

Hey.. I made a speedometer by using of the guides in the forums I found..
Since I have a problem with my router and my ports arent opened for some reason.. I gave the script to a friend so he'll help me check few things so when I was on his server I couldnt see the speedometer I made.. but he could see it
and on my own server I can see it..
anyway.. I'll show here exactly what I did..

pawn Код:
forward Speedometer(playerid);
pawn Код:
new Text:SPEEDOS[MAX_PLAYERS];
public OnPlayerConnect(playerid)
pawn Код:
SPEEDOS[playerid] = TextDrawCreate(10.0,200.0," ");
    TextDrawShowForPlayer(playerid,SPEEDOS[playerid]);
public OnGameModeInit()
pawn Код:
SetTimer("Speedometer", 100, true);
pawn Код:
public Speedometer(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int;
        vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid != 0)
        {
            GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
            final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*250.666667; // 250.666667 = kmph  // 199,4166672 = mph
            final_speed_int = floatround(final_speed,floatround_round);
            format(speed_string,256,"Speed (km/h): %i",final_speed_int);
            TextDrawSetString(SPEEDOS[playerid], speed_string);
        }
    }
    else
    {
        TextDrawSetString(FUELOS[playerid], " ");
        TextDrawSetString(SPEEDOS[playerid], " ");
    }
    return 1;
}
btw.. ignore the FUELOS its same things done just for the fuel.. but ignore it please


anyway.. what is wrong here? I mean.. nothing wrong I took it from guide and everything working good.. I just couldnt see it in my friend's server.. but he could see it!
maybe only the server owner can see? anyway.. no idea!

PLEASE HELP
Reply
#2

Bump!!
common! its really importent.. i still cant fix it!
Reply
#3

pawn Код:
SPEEDOS[playerid] = TextDrawCreate(10.0,200.0," ");
pawn Код:
TextDrawSetString(FUELOS[playerid], " ");
"" You have Left it Empty. What 'd it show?
Reply
#4

It means that if you're not in the driver seat.. if you're passenger or not in a car so you wont see any of this..
Reply
#5

Ahh Use SetTimerEx
Under OnPlayerSpawn
pawn Код:
SetTimerEx("Speedometer", 100, true,"i",playerid);
Try This.
Remove the One Under OnGamemodeInit()
Reply
#6

Okay.. I'll try it.. right now I cant check if not only the owner can see it..
but what does it do? I mean.. what the matter if I put it on gamemodeinit or onplayerspawn?
and put settimerex instead of settimer?
Thanks..



EDIT: for me its working, but it worked before.. I'll have my friend to open his server with my script to check if its fixed
Reply
#7

SetTimerEx is different from SetTimer . SetTimer is used when it's used for all players but if u want it for a Specific player then u need to SetTimerEx . You Can't use it Under OnGameModeInit because playerid is not defined there.
btw i can't see any code for owner.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)