Help BUG
#1

Where is the bug

When i enter in the game i select a class for example: Germany

On my head it will says Germany in cian color letter but when i change class /switchclass for Russia i will got on my head Russia and Germany letters.. What can i do..?



PHP код:
CMD:switchclass(playeridparams[])
{
SetPlayerHealth(playerid0.0);
ForceClassSelection(playerid);
SendClientMessage(playerid, -1,"Select you class!");
return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    if(
gTeam[playerid] == TEAM_GERMANY) {
        
SetPlayerArmour(playerid100);
        new 
Text3D:label7 Create3DTextLabel("GERMANY",TEAM_GERMANY_COLOR30.040.050.040.00);
        
Attach3DTextLabelToPlayer(label7playerid0.00.00.4);
        
SetPlayerTeam(playerid0);
        }
    else if(
gTeam[playerid] == TEAM_IRAQ) {
        
SetPlayerArmour(playerid100);
        new 
Text3D:label7 Create3DTextLabel("IRAQ",TEAM_IRAQ_COLOR30.040.050.040.00);
        
Attach3DTextLabelToPlayer(label7playerid0.00.00.4);
        
SetPlayerTeam(playerid1);
    }
    else if(
gTeam[playerid] == TEAM_RUSSIA) {
        
SetPlayerArmour(playerid100);
        new 
Text3D:label7 Create3DTextLabel("RUSSIA",TEAM_RUSSIA_COLOR30.040.050.040.00);
        
Attach3DTextLabelToPlayer(label7playerid0.00.00.4);
        
SetPlayerTeam(playerid2);
    }
    else if(
gTeam[playerid] == TEAM_USA) {
        
SetPlayerArmour(playerid100);
        new 
Text3D:label7 Create3DTextLabel("USA",TEAM_USA_COLOR30.040.050.040.00);
        
Attach3DTextLabelToPlayer(label7playerid0.00.00.4);
        
SetPlayerTeam(playerid3);
    }
    else if(
gTeam[playerid] == TEAM_BANGLADESH) {
        
SetPlayerArmour(playerid100);
        new 
Text3D:label7 Create3DTextLabel("BANGLADESH",TEAM_BANGLADESH_COLOR30.040.050.040.00);
        
Attach3DTextLabelToPlayer(label7playerid0.00.00.4);
        
SetPlayerTeam(playerid4);
    }
    return 
1;

Reply
#2

OnPlayerRequestClass make something to destroy the lable and then to attach it again when he choose his class Simple and easy
Reply
#3

This is because this code is running every time you spawn.
pawn Код:
public OnPlayerSpawn(playerid)
{
    UpdatePlayer3DTextLabelText(playerid, Text3D:label7, -1, " "); //---------------Added this line, to reset the textlabel before making a new one
    if(gTeam[playerid] == TEAM_GERMANY) {
        SetPlayerArmour(playerid, 100);
        new Text3D:label7 = Create3DTextLabel("GERMANY",TEAM_GERMANY_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
        SetPlayerTeam(playerid, 0);
        }
    else if(gTeam[playerid] == TEAM_IRAQ) {
        SetPlayerArmour(playerid, 100);
        new Text3D:label7 = Create3DTextLabel("IRAQ",TEAM_IRAQ_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
        SetPlayerTeam(playerid, 1);
    }
    else if(gTeam[playerid] == TEAM_RUSSIA) {
        SetPlayerArmour(playerid, 100);
        new Text3D:label7 = Create3DTextLabel("RUSSIA",TEAM_RUSSIA_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
        SetPlayerTeam(playerid, 2);
    }
    else if(gTeam[playerid] == TEAM_USA) {
        SetPlayerArmour(playerid, 100);
        new Text3D:label7 = Create3DTextLabel("USA",TEAM_USA_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
        SetPlayerTeam(playerid, 3);
    }
    else if(gTeam[playerid] == TEAM_BANGLADESH) {
        SetPlayerArmour(playerid, 100);
        new Text3D:label7 = Create3DTextLabel("BANGLADESH",TEAM_BANGLADESH_COLOR, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label7, playerid, 0.0, 0.0, 0.4);
        SetPlayerTeam(playerid, 4);
    }
    return 1;
}
Reply
#4

Nathon i got an error:

PHP код:
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(490) : error 017undefined symbol "label7"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


1 Error

Reply
#5

Just use a Y_TIMER, it's alot easier.

And use streamer, Dynamic 3D Text Label, it's tuns easier.
Reply
#6

Didn't understand x)
Reply
#7

bump
Reply
#8

Under #include's
pawn Код:
new TextLabel[MAX_PLAYERS][128];
Add this OnPlayerConnect (without the return 1
pawn Код:
Public OnPlayerConnect(playerid){
    new Text3D:TextLabel[playerid] = Create3DTextLabel(" ", -1, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(TextLabel[playerid], playerid, 0.0, 0.0, 0.4);
    return 1;
}
Use this on player spawn, just updates the text label
pawn Код:
public OnPlayerSpawn(playerid)
{
    UpdatePlayer3DTextLabelText(playerid, Text3D:label7, -1, " ");
    if(gTeam[playerid] == TEAM_GERMANY) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, Text3D:TextLabel[playerid], TEAM_GERMANY_COLOR, "GERMANY");
        SetPlayerTeam(playerid, 0);
        }
    else if(gTeam[playerid] == TEAM_IRAQ) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, Text3D:TextLabel[playerid], TEAM_IRAQ_COLOR, "IRAQ");
        SetPlayerTeam(playerid, 1);
    }
    else if(gTeam[playerid] == TEAM_RUSSIA) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, Text3D:TextLabel[playerid], TEAM_RUSSIA_COLOR, "RUSSIA");
        SetPlayerTeam(playerid, 2);
    }
    else if(gTeam[playerid] == TEAM_USA) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, Text3D:TextLabel[playerid], TEAM_USA_COLOR, "USA");
        SetPlayerTeam(playerid, 3);
    }
    else if(gTeam[playerid] == TEAM_BANGLADESH) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, Text3D:TextLabel[playerid], TEAM_BANGLADESH_COLOR, "BANGLADESH");
        SetPlayerTeam(playerid, 4);
    }
    return 1;
}
Add to OnPlayerDisconnect (Again, without the return1
pawn Код:
public OnPlayerDisconnect(playerid){
    Delete3DTextLabel(Text3D:TextLabel[playerid]);
    return 1;
}
Let me know how it works out
Reply
#9

I got much errors

PHP код:
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(255) : warning 219local variable "TextLabel" shadows a variable at a preceding level
C
:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(255) : error 008must be a constant expressionassumed zero
C
:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(255) : error 008must be a constant expressionassumed zero
C
:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(276) : error 035argument type mismatch (argument 1)
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(499) : error 017undefined symbol "label7"
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(502) : error 035argument type mismatch (argument 2)
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(507) : error 035argument type mismatch (argument 2)
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(512) : error 035argument type mismatch (argument 2)
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(517) : error 035argument type mismatch (argument 2)
C:\Users\Bruno\Desktop\CoD-Rivals\CoD-Rivals\CoD-Rivals\gamemodes\CoD-R.pwn(522) : error 035argument type mismatch (argument 2)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase


9 Errors

Reply
#10

Change OnPlayerConnect
pawn Код:
Public OnPlayerConnect(playerid){
    TextLabel[playerid] = Create3DTextLabel(" ", -1, 30.0, 40.0, 50.0, 40.0, 0);
    Attach3DTextLabelToPlayer(TextLabel[playerid], playerid, 0.0, 0.0, 0.4);
    return 1;
}
Change OnPlayerSpawn
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_GERMANY) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, TextLabel[playerid], TEAM_GERMANY_COLOR, "GERMANY");
        SetPlayerTeam(playerid, 0);
        }
    else if(gTeam[playerid] == TEAM_IRAQ) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, TextLabel[playerid], TEAM_IRAQ_COLOR, "IRAQ");
        SetPlayerTeam(playerid, 1);
    }
    else if(gTeam[playerid] == TEAM_RUSSIA) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, TextLabel[playerid], TEAM_RUSSIA_COLOR, "RUSSIA");
        SetPlayerTeam(playerid, 2);
    }
    else if(gTeam[playerid] == TEAM_USA) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, TextLabel[playerid], TEAM_USA_COLOR, "USA");
        SetPlayerTeam(playerid, 3);
    }
    else if(gTeam[playerid] == TEAM_BANGLADESH) {
        SetPlayerArmour(playerid, 100);
        UpdatePlayer3DTextLabelText(playerid, TextLabel[playerid], TEAM_BANGLADESH_COLOR, "BANGLADESH");
        SetPlayerTeam(playerid, 4);
    }
    return 1;
}
Change OnPlayerDisconnect()
pawn Код:
public OnPlayerDisconnect(playerid){
    Delete3DTextLabel(TextLabel[playerid]);
    reutrn 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)