SA-MP Forums Archive
Why get errors in this script ? - 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: Why get errors in this script ? (/showthread.php?tid=462977)



Why get errors in this script ? - bustern - 09.09.2013

I add this after OnPlayerSpawn
PHP код:
    {
    if(
PlayerInfo[playerid][pAdmin] <= 3)
    new 
Text3D:admin Create3DTextLabel("ADMIN"COLOR_RED100.0100.0100.0100.00);
    
Attach3DTextLabelToPlayer(adminplayerid0.00.00.25);
    }
    {
    if(
PlayerInfo[playerid][pVip] <= 2)
    new 
Text3D:vip Create3DTextLabel("V.I.P"COLOR_RED100.0100.0100.0100.00);
    
Attach3DTextLabelToPlayer(vipplayerid0.00.00.25);
    } 
And get errors :@


Re: Why get errors in this script ? - bustern - 09.09.2013

bump


Re: Why get errors in this script ? - Dragonsaurus - 09.09.2013

Show the error lines and errors from compiling please.


Re: Why get errors in this script ? - bustern - 10.09.2013

PHP код:
C:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(585) : error 003declaration of a local variable must appear in a compound block
C
:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(585) : warning 221label name "Text3D" shadows tag name
C
:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(585) : error 017undefined symbol "admin"
C:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(586) : error 017undefined symbol "admin"
C:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(590) : error 003declaration of a local variable must appear in a compound block
C
:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(590) : warning 221label name "Text3D" shadows tag name
C
:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(590) : error 017undefined symbol "vip"
C:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(591) : error 017undefined symbol "vip"
C:\Users\Niko\Desktop\DeathMatch server by bustern\gamemodes\DeathMatch.pwn(585) : warning 203symbol is never used"Text3D" 



Re: Why get errors in this script ? - Dragonsaurus - 10.09.2013

pawn Код:
if(PlayerInfo[playerid][pAdmin] <= 3)
{
    new Text3D:admin = Create3DTextLabel("ADMIN", COLOR_RED, 100.0, 100.0, 100.0, 100.0, 0);
    Attach3DTextLabelToPlayer(admin, playerid, 0.0, 0.0, 0.25);
}
if(PlayerInfo[playerid][pVip] <= 2)
{
    new Text3D:vip = Create3DTextLabel("V.I.P", COLOR_RED, 100.0, 100.0, 100.0, 100.0, 0);
    Attach3DTextLabelToPlayer(vip, playerid, 0.0, 0.0, 0.25);
}



Re: Why get errors in this script ? - bustern - 10.09.2013

Now everyone has tag


Re: Why get errors in this script ? - Dragonsaurus - 10.09.2013

Because you posted in the first post this
pawn Код:
if(PlayerInfo[playerid][pAdmin] <= 3)
That means that only level 3 and below have tag... same as for vip.
If you want only level 3 and above + vip level 2 and above try this:
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 3)
{
    new Text3D:admin = Create3DTextLabel("ADMIN", COLOR_RED, 100.0, 100.0, 100.0, 100.0, 0);
    Attach3DTextLabelToPlayer(admin, playerid, 0.0, 0.0, 0.25);
}
if(PlayerInfo[playerid][pVip] >= 2)
{
    new Text3D:vip = Create3DTextLabel("V.I.P", COLOR_RED, 100.0, 100.0, 100.0, 100.0, 0);
    Attach3DTextLabelToPlayer(vip, playerid, 0.0, 0.0, 0.25);
}



Re: Why get errors in this script ? - bustern - 10.09.2013

now noone have tag


Re: Why get errors in this script ? - Threshold - 10.09.2013

Jesus...

pawn Код:
if(PlayerInfo[playerid][pAdmin] > 0)
{
    new Text3D:admin = Create3DTextLabel("ADMIN", COLOR_RED, 100.0, 100.0, 100.0, 100.0, 0);
    Attach3DTextLabelToPlayer(admin, playerid, 0.0, 0.0, 0.25);
}
if(PlayerInfo[playerid][pVip] > 0)
{
    new Text3D:vip = Create3DTextLabel("V.I.P", COLOR_RED, 100.0, 100.0, 100.0, 100.0, 0);
    Attach3DTextLabelToPlayer(vip, playerid, 0.0, 0.0, 0.25);
}
This is basic scripting bustern. At least ATTEMPT to learn scripting before asking for help.


Re: Why get errors in this script ? - Dragonsaurus - 10.09.2013

If you are assigning the tag to yourself, you won't be able to see it, only others can.