Switch - 3Dtextlabels
#21

Quote:
Originally Posted by Mo123
View Post
I rather use my own

Code:
CMD:aduty(playerid, params[])
{
    new id;

    if(IsAdmin(playerid))
    {
        if(IsOnAdminDuty(playerid))
        {
            PlayerInfo[playerid][pAdminDuty] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty.");
            DestroyDynamic3DTextLabel(PlayerAdminLabel[playerid]);
        }
        else
        {
            PlayerAdminLabel[playerid] = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0xFFA500FF, 0.0, 0.0, 0.1, 5.0, .attachedplayer = playerid, .testlos = 1); 
            SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on duty as a %s", ReturnAdminLevel(id));

            PlayerInfo[playerid][pAdminDuty] = 1;
        }
    }
    else
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Administrator!");
    
    return 1;
}
It's the same. Except you added if statements filled by variables from your gamemode, things I don't have. And used my code

By the way you got a nice way thanking people spending time to help others.
Reply
#22

Quote:
Originally Posted by TheToretto
View Post
It's the same. Except you added if statements filled by variables from your gamemode, things I don't have. And used my code
Code:
new PlayerText3D:PlayerAdminLabel[MAX_PLAYERS];

ReturnAdminLevel(playerid)  
{  
    new  
        string[64]  
    ;  
    switch (PlayerInfo[playerid][pAdmin])  
    {  
        case 1: string= "Moderator";  
        case 2: string= "Game Administrator";  
        case 3: string= "Lead Administrator";  
        case 4: string= "Server Manager";  
        default: string= "Undefined";  
    }  
    return string;  
}   

CMD:aduty(playerid, params[])
{
    new id;

    if(IsAdmin(playerid))
    {
        if(IsOnAdminDuty(playerid))
        {
            PlayerInfo[playerid][pAdminDuty] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty.");
            DestroyDynamic3DTextLabel(PlayerAdminLabel[playerid]);
        }
        else
        {
            PlayerAdminLabel[playerid] = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0xFFA500FF, 0.0, 0.0, 0.1, 5.0, .attachedplayer = playerid, .testlos = 1); 
            SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on duty as a %s", ReturnAdminLevel(id));

            PlayerInfo[playerid][pAdminDuty] = 1;
        }
    }
    else
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Administrator!");
    
    return 1;
}
These are the ones ive got
Reply
#23

pawn Code:
new PlayerText3D:PlayerAdminLabel[MAX_PLAYERS];
The fuck.

Replace PlayerText3D by Text3D

EDIT: That's why you were getting those warnings before, I gave a whole code, you copied just a part of it.
Reply
#24

Code:
new Text3D:PlayerAdminLabel[MAX_PLAYERS];

ReturnAdminLevel(playerid)  
{  
    new  
        string[64]  
    ;  
    switch (PlayerInfo[playerid][pAdmin])  
    {  
        case 1: string= "Moderator";  
        case 2: string= "Game Administrator";  
        case 3: string= "Lead Administrator";  
        case 4: string= "Server Manager";  
        default: string= "Undefined";  
    }  
    return string;  
}   
CMD:aduty(playerid, params[])
{
    new id;

    if(IsAdmin(playerid))
    {
        if(IsOnAdminDuty(playerid))
        {
            PlayerInfo[playerid][pAdminDuty] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty.");
            DestroyDynamic3DTextLabel(Text3D:PlayerAdminLabel[MAX_PLAYERS]);
        }
        else
        {
            Text3D:PlayerAdminLabel = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0xFFA500FF, 0.0, 0.0, 0.1, 5.0, .attachedplayer = playerid, .testlos = 1); 
            SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on duty as a %s", ReturnAdminLevel(id));

            PlayerInfo[playerid][pAdminDuty] = 1;
        }
    }
    else
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Administrator!");
    
    return 1;
}
what am i doing wrong im tired af pls halp
Reply
#25

pawn Code:
CMD:aduty(playerid, params[])
{
    new id;

    if(IsAdmin(playerid))
    {
        if(IsOnAdminDuty(playerid))
        {
            PlayerInfo[playerid][pAdminDuty] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty.");
            DestroyDynamic3DTextLabel(PlayerAdminLabel[playerid]);
        }
        else
        {
            PlayerAdminLabel[playerid] = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0xFFA500FF, 0, 0, 0, 40.0, playerid, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
            PlayerInfo[playerid][pAdminDuty] = 1;
            SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on duty as a %s", ReturnAdminLevel(id));
        }
    }
    else
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Administrator!");

    return 1;
}
Try this
Reply
#26

Quote:
Originally Posted by UFF
View Post
pawn Code:
CMD:aduty(playerid, params[])
{
    new id;

    if(IsAdmin(playerid))
    {
        if(IsOnAdminDuty(playerid))
        {
            PlayerInfo[playerid][pAdminDuty] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty.");
            DestroyDynamic3DTextLabel(PlayerAdminLabel[playerid]);
        }
        else
        {
            PlayerAdminLabel[playerid] = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0xFFA500FF, 0, 0, 0, 40.0, playerid, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
            PlayerInfo[playerid][pAdminDuty] = 1;
            SendClientMessageEx(playerid, COLOR_YELLOW, "You are now on duty as a %s", ReturnAdminLevel(id));
        }
    }
    else
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Administrator!");

    return 1;
}
Try this
This does work, but how do I make it so the tag stays put if I come closer? Right now if I go further away the tag moves up
Reply
#27

Code:
#include <a_samp> 
#include <zcmd>
#include <streamer>

new Text3D:PlayerAdminLabel[MAX_PLAYERS];

ReturnAdminLevel(playerid)  
{  
    new  
        string[64]  
    ;  
    switch (pInfo[playerid][Admin])  
    {  
        case 1: string= "Moderator";  
        case 2: string= "Game Administrator";  
        case 3: string= "Lead Administrator";  
        case 4: string= "Server Manager";  
        default: string= "Undefined";  
    }  
    return string;  
}   
CMD:aduty(playerid, params[])
{

    if(IsAdmin(playerid))
    {
        if(IsOnAdminDuty(playerid))
        {
            if(IsValidDynamic3DTextLabel(PlayerAdminLabel[playerid]))
                DestroyDynamic3DTextLabel(PlayerAdminLabel[playerid]);

            PlayerInfo[playerid][pAdminDuty] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty.");
        }
        else
        {
            PlayerAdminLabel[playerid] = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0x8CAA63FF, 0.0, 0.0, 0.1, 5.0, .attachedplayer = playerid, .testlos = 1); 
            SendClientMessage(playerid, COLOR_YELLOW, "You are now on duty as a %s", ReturnAdminLevel(playerid));
            PlayerInfo[playerid][pAdminDuty] = 1;
        }
    }
    else
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Administrator!");
    
    return 1;
}
You had a lot of mistakes in your code, such as the "id" variable, something "UFF" ignored. The value of id is always 0, and I assume you're testing in localhost, you're the ID 0 in the server, it will work, but as soon as the ID isn't null you'll get blank text (literally space).

Then:

Quote:
Originally Posted by Mo123
View Post
This does work, but how do I make it so the tag stays put if I come closer? Right now if I go further away the tag moves up
Play with the draw distance argument in the native:

CreateDynamic3DTextLabel(const text[], color, Float: x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);

So it will become:

pawn Code:
PlayerAdminLabel[playerid] = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0x8CAA63FF, 0.0, 0.0, 0.1, 12.0 /*Change the 12 to whatever radius you want, 12 is already a good range*/, .attachedplayer = playerid, .testlos = 1);
Reply
#28

Quote:
Originally Posted by TheToretto
View Post
Code:
#include <a_samp> 
#include <zcmd>
#include <streamer>

new Text3D:PlayerAdminLabel[MAX_PLAYERS];

ReturnAdminLevel(playerid)  
{  
    new  
        string[64]  
    ;  
    switch (pInfo[playerid][Admin])  
    {  
        case 1: string= "Moderator";  
        case 2: string= "Game Administrator";  
        case 3: string= "Lead Administrator";  
        case 4: string= "Server Manager";  
        default: string= "Undefined";  
    }  
    return string;  
}   
CMD:aduty(playerid, params[])
{

    if(IsAdmin(playerid))
    {
        if(IsOnAdminDuty(playerid))
        {
            if(IsValidDynamic3DTextLabel(PlayerAdminLabel[playerid]))
                DestroyDynamic3DTextLabel(PlayerAdminLabel[playerid]);

            PlayerInfo[playerid][pAdminDuty] = 0;
            SendClientMessage(playerid, COLOR_YELLOW, "You are now off duty.");
        }
        else
        {
            PlayerAdminLabel[playerid] = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0x8CAA63FF, 0.0, 0.0, 0.1, 5.0, .attachedplayer = playerid, .testlos = 1); 
            SendClientMessage(playerid, COLOR_YELLOW, "You are now on duty as a %s", ReturnAdminLevel(playerid));
            PlayerInfo[playerid][pAdminDuty] = 1;
        }
    }
    else
        return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Administrator!");
    
    return 1;
}
You had a lot of mistakes in your code, such as the "id" variable, something "UFF" ignored. The value of id is always 0, and I assume you're testing in localhost, you're the ID 0 in the server, it will work, but as soon as the ID isn't null you'll get blank text (literally space).

Then:



Play with the draw distance argument in the native:

CreateDynamic3DTextLabel(const text[], color, Float: x, Float:y, Float:z, Float:drawdistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testlos = 0, worldid = -1, interiorid = -1, playerid = -1, Float:distance = 100.0);

So it will become:

pawn Code:
PlayerAdminLabel[playerid] = CreateDynamic3DTextLabel(ReturnAdminLevel(playerid), 0x8CAA63FF, 0.0, 0.0, 0.1, 12.0 /*Change the 12 to whatever radius you want, 12 is already a good range*/, .attachedplayer = playerid, .testlos = 1);
No, it does work on diff ids, I've tried it myself.

Everything works. Cheers.
Reply
#29

Quote:
Originally Posted by Mo123
View Post
No, it does work on diff ids, I've tried it myself.

Everything works. Cheers.
Bullshit. Will return the default in the switch statement I gave you HERE
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)