3D Text not showing
#1

Guys,as i already asked you how I show a 3D Text to all Players in a vehicle,so i tried it.But when I get in vehicle it didnt show any label.Below is the onplayerstatechange and onplayerupdate.Check it and help me if u know

pawn Код:
public OnPlayerUpdate(playerid)
{
        new Float:Health;
        GetVehicleHealth(GetPlayerVehicleID(playerid),Health);
        new vspeed;
        vspeed = GetVehicleSpeed(GetPlayerVehicleID(playerid));
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(HB[playerid] == 1 && Boost[playerid] == 1 && Lock[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}%s's Car\nSpeed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\nHandbrake:Activated\n{05BDFA}Security:Locked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);
            }
            if(HB[playerid] == 1 && Boost[playerid] == 0 && Lock[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:{FF0000}Offline\n{05BDFA}Handbrake:Activated\n{05BDFA}Security:Locked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 1 && Boost[playerid] == 1 && Lock[playerid] == 0)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\n{05BDFA}Handbrake:Activated\n{05BDFA}Security:Unlocked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 0 && Boost[playerid] == 1 && Lock[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\n{05BDFA}Handbrake:{FF0000}De-Activated\n{05BDFA}Security:Locked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 0 && Boost[playerid] == 0 && Lock[playerid] == 0)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:{FF0000}Offline\n{05BDFA}Handbrake:{FF0000}De-Activated\n{05BDFA}Security:Unlocked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 0 && Boost[playerid] == 1 && Lock[playerid] == 0)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\n{05BDFA}Handbrake:{FF0000}De-Activated\n{05BDFA}Security:Unlocked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 0 && Boost[playerid] == 0 && Lock[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\n{05BDFA}Handbrake:{FF0000}De-Activated\n{05BDFA}Security:Locked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 1 && Boost[playerid] == 0 && Lock[playerid] == 0)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:{FF0000}Offline\n{05BDFA}Handbrake:Activated\n{05BDFA}Security:Unlocked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(God[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "{FFFFFF}GOD MOD");
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);
                SetTimer("normal", 1000, true);

            }
            return 1;
            }
           

        return 1;
}



public OnPlayerExitVehicle(playerid, vehicleid)
{
        Delete3DTextLabel(Speedo);
        return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
        new Float:Health;
        GetVehicleHealth(GetPlayerVehicleID(playerid),Health);
        new vspeed;
        vspeed = GetVehicleSpeed(GetPlayerVehicleID(playerid));
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(HB[playerid] == 1 && Boost[playerid] == 0 && Lock[playerid] == 0)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:{FF0000}Offline\n{05BDFA}Handbrake:Activated\n{05BDFA}Security:Unlocked\nUse /vehctrl",  vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 1 && Boost[playerid] == 1 && Lock[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\nHandbrake:Activated\n{05BDFA}Security:Locked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);
            }
            if(HB[playerid] == 1 && Boost[playerid] == 0 && Lock[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:{FF0000}Offline\n{05BDFA}Handbrake:Activated\n{05BDFA}Security:Locked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 1 && Boost[playerid] == 1 && Lock[playerid] == 0)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\n{05BDFA}Handbrake:Activated\n{05BDFA}Security:Unlocked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 0 && Boost[playerid] == 1 && Lock[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\n{05BDFA}Handbrake:{FF0000}De-Activated\n{05BDFA}Security:Locked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 0 && Boost[playerid] == 0 && Lock[playerid] == 0)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:{FF0000}Offline\n{05BDFA}Handbrake:{FF0000}De-Activated\n{05BDFA}Security:Unlocked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(HB[playerid] == 0 && Boost[playerid] == 1 && Lock[playerid] == 0)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "\n\n\n\n\n{05BDFA}Speed: %d km/hr%s\n{05BDFA}Health:[%s{05BDFA}]\nBoost:Online\n{05BDFA}Handbrake:{FF0000}De-Activated\n{05BDFA}Security:Unlocked\nUse /vehctrl", vspeed,UpdateLabelOfSpeed(playerid),UpdateString(playerid));
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);

            }
            if(God[playerid] == 1)
            {
                format(SpeedoStr, sizeof(SpeedoStr), "{FFFFFF}GOD MOD");
                Update3DTextLabelText(Speedo,0xFF0000FF,SpeedoStr);
                SetTimer("normal", 1000, true);

            }
            return 1;
            }
        return 1;
}
Reply
#2

B-U-M-P.I need help
Reply
#3

Do u get errors?
Reply
#4

u maybe need: https://sampwiki.blast.hk/wiki/Attach3DTextLabelToVehicle
Reply
#5

Quote:
Originally Posted by MiGu3X
Посмотреть сообщение
Do u get errors?
Nope its compiling fine


migu3x I dont think it needs.Need more help
Reply
#6

Do you make sure you create it?

I've one the same like yours. Before i attach it when player is in vehicle.
I created it in Blueberry (0.0, 0.0, 0.0). With empty string. (" ")
Why not trying creating the 3d text label first? Did you make sure it's already created?
Reply
#7

I recommend using

CreatePlayer3DTextLabel(playerid, text[], color, Float:X, Float:Y, Float:Z, FloatrawDistance, attachedplayer, attachedvehicle, testLOS);
Reply
#8

where do u create and attach it ? also the onPlayerupdate is called way too often for that i think.. why not timer with 1000 interval?


also on playerstateChange ur not creating, checking if newstate == DRIVER, or anything.. seems like u just copied the same code from OnPlayerUpdate :P
Reply
#9

Thanks guys.But the problem is solved
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)