PDA

View Full Version : 3D Label shows up twice


Ouch_Charlie
21/12/2011, 02:44 PM
FIXED

WooTFTW
21/12/2011, 02:49 PM
nvm -.-

Thresholdold
21/12/2011, 02:58 PM
Shouldn't it be
if(LevelCheck(playerid, #)) ??

WooTFTW
21/12/2011, 02:59 PM
Shouldn't it be
if(LevelCheck(playerid, #)) ??

Oh yeah, didn't notice that at all :d


if(IsPlayerAdmin(playerid))
{
rcon[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Owner",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(rcon[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 1))
{
level1[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Helper",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level1[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 2))
{
level2[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Mini Moderator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level2[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 3))
{
level3[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Moderator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level3[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 4))
{
level4[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Administrator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level4[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 5))
{
level5[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Owner",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level5[playerid], playerid, 0.0, 0.0, 0.5);
}

Ouch_Charlie
21/12/2011, 03:06 PM
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(2847) : error 010: invalid function or declaration
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(2853) : error 010: invalid function or declaration
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3174) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3174) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3174) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3175) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3179) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3179) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3179) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3180) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3184) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3184) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3184) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3185) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3189) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3189) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3189) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3190) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3194) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3194) : warning 217: loose indentation
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3194) : error 029: invalid expression, assumed zero
F:\Stunter's God 03d R2\filterscripts\0Admin.pwn(3195) : warning 217: loose indentation

Ouch_Charlie
21/12/2011, 03:26 PM
Bump. Any help? Please :)

Tee
21/12/2011, 03:30 PM
With your code it would get created 2 times if the player is Logged-into RCON and the player has an admin level greater than 0.
Try this:


if(IsPlayerAdmin(playerid))
{
rcon[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Owner",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(rcon[playerid], playerid, 0.0, 0.0, 0.5);
return 1;
}
if(LevelCheck(playerid, 1))
{
level1[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Helper",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level1[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 2))
{
level2[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Mini Moderator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level2[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 3))
{
level3[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Moderator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level3[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 4))
{
level4[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Administrator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level4[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 5))
{
level5[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Owner",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level5[playerid], playerid, 0.0, 0.0, 0.5);
}

wups
21/12/2011, 03:33 PM
Or just do:
if
else if
else if
...

Tee
21/12/2011, 03:36 PM
I added "return 1;" to the first check, so if the player is logged-in to RCON, it won't go any further.
Edit: Charlie, learn to indent. It makes the code flow and easier to read.

Ouch_Charlie
21/12/2011, 03:45 PM
With your code it would get created 2 times if the player is Logged-into RCON and the player has an admin level greater than 0.
Try this:


if(IsPlayerAdmin(playerid))
{
rcon[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Owner",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(rcon[playerid], playerid, 0.0, 0.0, 0.5);
return 1;
}
if(LevelCheck(playerid, 1))
{
level1[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Helper",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level1[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 2))
{
level2[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Mini Moderator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level2[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 3))
{
level3[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Moderator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level3[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 4))
{
level4[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Administrator",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level4[playerid], playerid, 0.0, 0.0, 0.5);
}
if(LevelCheck(playerid, 5))
{
level5[playerid] = Create3DTextLabel("{FFFFFF}Server {FF5500}Owner",0xFFFFFFFF,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(level5[playerid], playerid, 0.0, 0.0, 0.5);
}

Still the same errors...

Tee
21/12/2011, 03:47 PM
Show me your "LevelCheck()" function. And 2 of lines from each error.

Ouch_Charlie
21/12/2011, 03:54 PM
Ow... yeah! Fixed it thanks for the replies guys :D
+1 rep to? lol

Tee
21/12/2011, 03:58 PM
No problem.

Ouch_Charlie
21/12/2011, 04:20 PM
+1 rep to Tee :D Sorry other guys :(

Tee
21/12/2011, 04:21 PM
Lol okay, thanks anyway.