Problem with operators (DUTY NAME TAGS)
#1

Hello i have problem with operators (==,!=,>,>=, etc) i tried edit dutys tags with color so i made more tags bat problem is that if i try do something like this. Its doesnt work.
Код:
    if(pInfo[playerid][pAdminLevel] < 1 && pInfo[playerid][pVipLevel] < 1)
    {
    format(sudasnx, sizeof(sudasnx), "{d8b713}(VIP){09ed09}(M){%06x}%s{FFFFFF}(%i): {FFFFFF}%s", GetPlayerColor(playerid) >>> 8, name, playerid, text);
    }
Bat if i do with one variable checking tag showing fine.
Код:
    else if(pInfo[playerid][pAdminLevel] == 1)
    {
    format(sudasnx, sizeof(sudasnx), "{09ed09}(M){%06x}%s{FFFFFF}(%i): {FFFFFF}%s", GetPlayerColor(playerid) >>> 8, name, playerid, text);
    }
Код:
    else if(pInfo[playerid][pVipLevel] !=  1)
    {
    format(sudasnx, sizeof(sudasnx), "{d8b713}(VIP){%06x}%s{FFFFFF}(%i): {FFFFFF}%s", GetPlayerColor(playerid) >>> 8, name, playerid, text);
    }
Bat i need make it show together because if you have admin and vip at the same time it will show only (VIP) tag, so i trie use operators bat when i change it at any ways it bugged sometimes doesn't show or sometimes just colors doesnt change. So there is pastebin with all my tags

https://pastebin.com/JFCjDNYJ
Reply
#2

Bump
Reply
#3

Names have a maximum of 24 characters.
Reply
#4

I absolutely loathe the over-usage of "else if" structures. There are certain places where you can't get around using them, but they make everything much more complicated than it needs to be. It took me about 15 minutes to transform this unreadable mess into this:
PHP код:
static const adminColors[] = {
    
0                        // Level 0
    
0x09ed09ff,    // 1
    
0x09ed09ff// 2
    
0x09ed09ff// 3
    
0xef0707ff// 4
    
0xef0707ff// 5
    
0xef0707ff// 6
    
0xef0707ff     // 7
};
static const 
vipColors[] = {
    
0,                    // Level 0
    
0xd8b713ff// 1
    
0xb5b5b5ff// 2
    
0xffe60aff// 3
    
0xffe60aff    // 4
};
new 
    
outputMessage[144],
    
adminTag[16],
    
vipTag[16];
if(
pInfo[playerid][pAdminLevel] < sizeof(adminColors))
    
format(adminTagsizeof(adminTag), "{%06x}(%c)"adminColors[pInfo[playerid][pAdminLevel]] >>> 8pInfo[playerid][pAdminLevel] < 'M' 'A');
if(
pInfo[playerid][pVipLevel] < sizeof(vipColors))
    
format(vipTagsizeof(vipTag), "{%06x}(VIP)"vipColors[pInfo[playerid][pVipLevel]] >>> 8);
format(outputMessagesizeof(outputMessage),"%s%s{%06x}%s{FFFFFF}(%i): {FFFFFF}%s"vipTagadminTagGetPlayerColor(playerid) >>> 8nameplayeridtext); 
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
I absolutely loathe the over-usage of "else if" structures. There are certain places where you can't get around using them, but they make everything much more complicated than it needs to be. It took me about 15 minutes to transform this unreadable mess into this:
PHP код:
static const adminColors[] = {
    
0                        // Level 0
    
0x09ed09ff,    // 1
    
0x09ed09ff// 2
    
0x09ed09ff// 3
    
0xef0707ff// 4
    
0xef0707ff// 5
    
0xef0707ff// 6
    
0xef0707ff     // 7
};
static const 
vipColors[] = {
    
0,                    // Level 0
    
0xd8b713ff// 1
    
0xb5b5b5ff// 2
    
0xffe60aff// 3
    
0xffe60aff    // 4
};
new 
    
outputMessage[144],
    
adminTag[16],
    
vipTag[16];
if(
pInfo[playerid][pAdminLevel] < sizeof(adminColors))
    
format(adminTagsizeof(adminTag), "{%06x}(%c)"adminColors[pInfo[playerid][pAdminLevel]] >>> 8pInfo[playerid][pAdminLevel] < 'M' 'A');
if(
pInfo[playerid][pVipLevel] < sizeof(vipColors))
    
format(vipTagsizeof(vipTag), "{%06x}(VIP)"vipColors[pInfo[playerid][pVipLevel]] >>> 8);
format(outputMessagesizeof(outputMessage),"%s%s{%06x}%s{FFFFFF}(%i): {FFFFFF}%s"vipTagadminTagGetPlayerColor(playerid) >>> 8nameplayeridtext); 
error 001: expected token: "}", but found "-integer value-"
error 010: invalid function or declaration

Lines
Код:
static const adminColors[] = {
    0                        // Level 0 (THIS)
    0x09ed09ff,    // 1
    0x09ed09ff, // 2
    0x09ed09ff, // 3
    0xef0707ff, // 4
    0xef0707ff, // 5
    0xef0707ff, // 6
    0xef0707ff     // 7
}; (THIS)
Reply
#6

0,

Just add a comma.
Reply
#7

Anyway it doesn't work tags doesn't show up in front the name.
Reply
#8

Sorry its working i just forget to put sendclientmessagetoall
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)