3D Text Label
#1

Previously, I have made a topic about the Player Labels.
I figured it out on scripting it, and eventually the script works properly.

I am creating a vehicle system and everything works fine so far but!
I have noticed something between the player_label and vehicle_label Text3D.
For example, When i spawn my personal vehicle it displays

"This Bike is owned by FFG.JaKe(0)"

I am in a spawn protection, and once that spawn protection expires, LabelUpdate gets called.
When the LabelUpdate is called, the vehicle_label is affected instead of the player_label.

"This Bike is owned by FFG.JaKe(0)" is then changed to "Admin/VIP"

Below are the codes showing how i manage/work with these labels:

PHP код:
new Text3D:player_label[MAX_PLAYERS];
new 
Text3D:vehicle_label[MAX_VEHICLES];
public 
OnPlayerConnect(playerid)
{
    
player_label[playerid] = Create3DTextLabel("_"0xFFFFFF000003001);
    
Attach3DTextLabelToPlayer(player_label[playerid], playerid000.4);
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
User[playerid][ownedvehicle_id])
    {
        
Delete3DTextLabel(vehicle_label[User[playerid][ownedvehicle_id]]);
        
DestroyVehicle(User[playerid][ownedvehicle_id]);
    }
    
Delete3DTextLabel(player_label[playerid]);
    return 
1;
}
CMD:spawnvehicle(playeridparams[])
{
    if(
mode == MINIGUN_ID || mode == FREIGHTER_ID || mode == AREA51_ID || mode == STREET_ID || mode == ZOMBIE_ID || mode == AIL_ID || mode == HI_ID || mode == CP_ID)
        return 
SendClientMessage(playerid, -1"You cannot spawn your personal vehicle during this game round.");
    if(
User[playerid][accountLogged] == false) return SendClientMessage(playeridCOLOR_YELLOW"You are not logged in.");
    if(
User[playerid][ownedvehicle] == 0) return SendClientMessage(playeridCOLOR_RED"You do not own a vehicle.");
    if(!
IsPlayerSpawn(playerid)) return SendClientMessage(playeridCOLOR_RED"You must be spawned to use this command.");
    if(
User[playerid][account_Objective] == true) return SendClientMessage(playeridCOLOR_RED"You must be out of objective info screen first.");
    if(
User[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE) return SendClientMessage(playeridCOLOR_RED"You must not be on spectate mode to use this command.");
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_RED"You are already in a vehicle.");
    if(
User[playerid][ownedvehicle_id]) return SendClientMessage(playeridCOLOR_RED"You have already spawned your personal vehicle.");
    
Delete3DTextLabel(vehicle_label[User[playerid][ownedvehicle_id]]);
    
DestroyVehicle(User[playerid][ownedvehicle_id]);
    new 
Float:xFloat:yFloat:zFloat:astring[128];
    
GetPlayerPos(playeridxyz);
    
GetPlayerFacingAngle(playerida);
    
    
User[playerid][ownedvehicle_id] = CreateVehicle(User[playerid][ownedvehicle_model], xyz+1aUser[playerid][ownedvehicle_color][0], User[playerid][ownedvehicle_color][1], -1);
    
LinkVehicleToInterior(User[playerid][ownedvehicle_id], GetPlayerInterior(playerid));
    
SetVehicleVirtualWorld(User[playerid][ownedvehicle_id], GetPlayerVirtualWorld(playerid));
    
PutPlayerInVehicle(playeridUser[playerid][ownedvehicle_id], 0);
    
format(stringsizeof string"This %s is owned by %s(%d)."VehicleNames[User[playerid][ownedvehicle_model]-400], GetName(playerid), playerid);
    
vehicle_label[User[playerid][ownedvehicle_id]] = Create3DTextLabel(string, -10008001);
    
Attach3DTextLabelToVehicle(vehicle_label[User[playerid][ownedvehicle_id]], User[playerid][ownedvehicle_id], 0.00.00.0);
    
    
SendClientMessage(playeridCOLOR_YELLOW"* You have spawned your personal vehicle.");
    return 
1;
}
CMD:destroyvehicle(playeridparams[])
{
    if(
User[playerid][accountLogged] == false) return SendClientMessage(playeridCOLOR_YELLOW"You are not logged in.");
    if(
User[playerid][ownedvehicle] == 0) return SendClientMessage(playeridCOLOR_RED"You do not own a personal vehicle.");
    if(
GetPVarInt(playerid"destroy_vehicle"))
    {
        
SendClientMessage(playeridCOLOR_YELLOW"* Your vehicle has been destroyed.");
        
SendClientMessage(playerid, -1"You may own a new one.");
        if(
User[playerid][ownedvehicle_id])
        {
            
Delete3DTextLabel(vehicle_label[User[playerid][ownedvehicle_id]]);
            
DestroyVehicle(User[playerid][ownedvehicle_id]);
            
User[playerid][ownedvehicle_id] = 0;
        }
        
//
        
User[playerid][ownedvehicle] = 0;
        
User[playerid][ownedvehicle_model] = 0;
        
User[playerid][ownedvehicle_color][0] = 0;
        
User[playerid][ownedvehicle_color][1] = 0;
        
//
    
        
DeletePVar(playerid"destroy_vehicle");
    }
    else
    {
        
SendClientMessage(playerid, -1"You are about to delete your "red"personal vehicle"white".");
        
SendClientMessage(playeridCOLOR_YELLOW"Type /destroyvehicle for the second time if you wanted to delete your personal vehicle.");
        
SetPVarInt(playerid"destroy_vehicle"1);
    }
    return 
1;
}
// Below are the function LabelUpdate, I am not gonna post down the codes where this function is called in but let me give you a hint. This function is called when player gets promoted/demoted from admin,vip, Spawn Protection, Login.
stock LabelUpdate(i)
{
    if(
Spawn_Kill[i] == true)
    {
        
Update3DTextLabelText(player_label[i], 0x28BA9AFF"Spawn Protection");
        return 
1;
    }
    if(
User[i][accountDuty] == 1)
    {
        
Update3DTextLabelText(player_label[i], COLOR_GREEN"Admin On Duty");
        return 
1;
    }
    if(
User[i][accountAdmin] >= && User[i][accountVip] == 1)
    {
        
Update3DTextLabelText(player_label[i], COLOR_RED"Admin"white"/{28BA9A}VIP");
    }
    else if(
User[i][accountAdmin] >= && User[i][accountVip] == 0)
    {
        
Update3DTextLabelText(player_label[i], COLOR_RED"Admin Staff");
    }
    else if(
User[i][accountAdmin] == && User[i][accountVip] == 1)
    {
        
Update3DTextLabelText(player_label[i], 0x28BA9AFF"VIP Member");
    }
    else if(
User[i][accountAdmin] == && User[i][accountVip] == 0)
    {
        
Update3DTextLabelText(player_label[i], 0xFFFFFF00"_");
    }
    return 
1;

These Text3D labels are conflicting on each other?? If so, how can i fix it.
Reply


Messages In This Thread
3D Text Label - by JaKe Elite - 31.10.2015, 05:08
Re: 3D Text Label - by Gammix - 31.10.2015, 05:17
Re: 3D Text Label - by JaKe Elite - 31.10.2015, 05:22
Re: 3D Text Label - by jlalt - 31.10.2015, 05:30
Re: 3D Text Label - by Gammix - 31.10.2015, 05:44
Re: 3D Text Label - by JaKe Elite - 31.10.2015, 05:50
Re: 3D Text Label - by Gammix - 31.10.2015, 06:02
Re: 3D Text Label - by JaKe Elite - 31.10.2015, 06:27
Re: 3D Text Label - by JaKe Elite - 31.10.2015, 07:27

Forum Jump:


Users browsing this thread: 1 Guest(s)