SA-MP Forums Archive
Problem with operators (DUTY NAME TAGS) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with operators (DUTY NAME TAGS) (/showthread.php?tid=632470)



Problem with operators (DUTY NAME TAGS) - Pokemon64 - 14.04.2017

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


Re: Problem with operators (DUTY NAME TAGS) - Pokemon64 - 15.04.2017

Bump


Re: Problem with operators (DUTY NAME TAGS) - GangstaSunny. - 15.04.2017

Names have a maximum of 24 characters.


Re: Problem with operators (DUTY NAME TAGS) - Vince - 15.04.2017

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); 



Re: Problem with operators (DUTY NAME TAGS) - Pokemon64 - 15.04.2017

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)



Re: Problem with operators (DUTY NAME TAGS) - J0sh... - 15.04.2017

0,

Just add a comma.


Re: Problem with operators (DUTY NAME TAGS) - Pokemon64 - 15.04.2017

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


Re: Problem with operators (DUTY NAME TAGS) - Pokemon64 - 15.04.2017

Sorry its working i just forget to put sendclientmessagetoall