Error on Case Line +1rep
#1

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    switch(
classid)
    {
        case 
0:
           {
              
gTeam[playerid] = TEAM_JUTUM;
              
GameTextForPlayer(playerid"~b~JUTUM"50005);
              
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                 
SetPlayerFacingAngle(playerid270 );
              
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
              
CreateExplosion(212.9525,1822.9084,6.41411110.0);
        }
        case 
1:
        {
               
gTeam[playerid] = TEAM_KOKUS;
               
GameTextForPlayer(playerid"~r~KOKUS"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            }
        }
        case 
2:
        {
               
gTeam[playerid] = TEAM_JUMBO;
               
GameTextForPlayer(playerid"~r~JUMBO"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            }
        } 
Errors:
PHP код:
C:\Users\Nelson\Desktop\SERVER\gamemodes\taa.pwn(347) : error 014invalid statementnot in switch
C:\Users\Nelson\Desktop\SERVER\gamemodes\taa.pwn(347) : warning 215expression has no effect
C
:\Users\Nelson\Desktop\SERVER\gamemodes\taa.pwn(347) : error 001expected token";"but found ":"
C:\Users\Nelson\Desktop\SERVER\gamemodes\taa.pwn(347) : error 029invalid expressionassumed zero
C
:\Users\Nelson\Desktop\SERVER\gamemodes\taa.pwn(347) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

Please help to fix that.
Reply
#2

Use like this
Код:
if(classid == 0)
Код:
if(classid == 1)
Код:
if(classid == 2)
Reply
#3

Quote:
Originally Posted by Roberto80
Посмотреть сообщение
Use like this
Код:
if(classid == 0)
Код:
if(classid == 1)
Код:
if(classid == 2)
Still errors:
PHP код:
error 002only a single statement (or expressioncan follow each "case"
error 029invalid expressionassumed zero
error 010
invalid function or declaration
error 010
invalid function or declaration 
4 Errors.


PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    switch(
classid)
    {
        if(
classid == 0)
           {
              
gTeam[playerid] = TEAM_AMERICA;
              
GameTextForPlayer(playerid"~b~Americaaa"50005);
              
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                 
SetPlayerFacingAngle(playerid270 );
              
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
              
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            
        }
        if(
classid == 1)
        {
               
gTeam[playerid] = TEAM_ASIA;
               
GameTextForPlayer(playerid"~r~ASIA"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            }
        }
        if(
classid == 2)
        {
               
gTeam[playerid] = TEAM_AFRICA;
               
GameTextForPlayer(playerid"~r~AFRICA"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            }
        }
        return 
1;

Reply
#4

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    switch(
classid)
    {
        if(
classid == 0)
           {
              
gTeam[playerid] = TEAM_AMERICA;
              
GameTextForPlayer(playerid"~b~Americaaa"50005);
              
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                 
SetPlayerFacingAngle(playerid270 );
              
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
              
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            
        }
        if(
classid == 1)
        {
               
gTeam[playerid] = TEAM_ASIA;
               
GameTextForPlayer(playerid"~r~ASIA"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
        }
        if(
classid == 2)
        {
               
gTeam[playerid] = TEAM_AFRICA;
               
GameTextForPlayer(playerid"~r~AFRICA"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            }
        }
        return 
1;

:P you put two from: } in case 2:
PHP код:
            }
        }
        if(
classid == 2
should be
PHP код:
        }
        if(
classid == 2
Reply
#5

Ah yeah you closed the switch before case 2, xD
Reply
#6

Still not working:

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    switch(
classid)
    {
        if(
classid == 0)
           {
              
gTeam[playerid] = TEAM_AMERICA;
              
GameTextForPlayer(playerid"~b~Ameericaa"50005);
              
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                 
SetPlayerFacingAngle(playerid270 );
              
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
              
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            
        }
        if(
classid == 1)
        {
               
gTeam[playerid] = TEAM_ASIA;
               
GameTextForPlayer(playerid"~r~Asia"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            
        }
        if(
classid == 2)
        {
               
gTeam[playerid] = TEAM_AFRICA;
               
GameTextForPlayer(playerid"~r~Africa"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
            }
        }
        return 
1;

PHP код:
error 002only a single statement (or expressioncan follow each "case"
error 029invalid expressionassumed zero
error 010
invalid function or declaration
3 Errors

Reply
#7

Remove the switch,no need for it
Reply
#8

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    switch(
classid)
    {
        case 
0:
          {
              
gTeam[playerid] = TEAM_AMERICA;
               
GameTextForPlayer(playerid"~b~Ameericaa"50005);
              
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
                 
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
              
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
              
SetPlayerFacingAngle(playerid270 );
              
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
              
CreateExplosion(212.9525,1822.9084,6.41411110.0);
        }
        case 
1:
        {
               
gTeam[playerid] = TEAM_ASIA;
               
GameTextForPlayer(playerid"~r~Asia"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
            
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
        }
        case 
2
        
{
               
gTeam[playerid] = TEAM_AFRICA;
               
GameTextForPlayer(playerid"~r~Africa"50005);
               
SetPlayerPos(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368);
               
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141);
                  
SetPlayerFacingAngle(playerid270 );
               
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);
               
CreateExplosion(212.9525,1822.9084,6.41411110.0);
        }
    }
    return 
1;

You had return 1; after the case closing bracket.
Reply
#9

PHP код:
public OnPlayerRequestClass(playeridclassid

    switch(
classid
    { 
        case 
0
        { 
            
gTeam[playerid] = TEAM_JUTUM
            
GameTextForPlayer(playerid"~b~JUTUM"50005); 
            
SetPlayerPos(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141); 
            
SetPlayerFacingAngle(playerid270 ); 
            
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
            
CreateExplosion(212.9525,1822.9084,6.41411110.0); 

        } 
        case 
1
        { 
            
gTeam[playerid] = TEAM_KOKUS
            
GameTextForPlayer(playerid"~r~KOKUS"50005); 
            
SetPlayerPos(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141); 
            
SetPlayerFacingAngle(playerid270 ); 
            
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);  
            
CreateExplosion(212.9525,1822.9084,6.41411110.0); 
        } 
        case 
2
        { 
            
gTeam[playerid] = TEAM_JUMBO
            
GameTextForPlayer(playerid"~r~JUMBO"50005); 
            
SetPlayerPos(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141); 
            
SetPlayerFacingAngle(playerid270 ); 
            
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);  
            
CreateExplosion(212.9525,1822.9084,6.41411110.0); 
        }
    }

Reply
#10

Quote:
Originally Posted by PT
Посмотреть сообщение
PHP код:
public OnPlayerRequestClass(playeridclassid

    switch(
classid
    { 
        case 
0
        { 
            
gTeam[playerid] = TEAM_JUTUM
            
GameTextForPlayer(playerid"~b~JUTUM"50005); 
            
SetPlayerPos(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141); 
            
SetPlayerFacingAngle(playerid270 ); 
            
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1); 
            
CreateExplosion(212.9525,1822.9084,6.41411110.0); 
        } 
        case 
1
        { 
            
gTeam[playerid] = TEAM_KOKUS
            
GameTextForPlayer(playerid"~r~KOKUS"50005); 
            
SetPlayerPos(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141); 
            
SetPlayerFacingAngle(playerid270 ); 
            
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);  
            
CreateExplosion(212.9525,1822.9084,6.41411110.0); 
        } 
        case 
2
        { 
            
gTeam[playerid] = TEAM_JUMBO
            
GameTextForPlayer(playerid"~r~JUMBO"50005); 
            
SetPlayerPos(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraLookAt(playerid,220.3261,1822.9734,7.5368); 
            
SetPlayerCameraPos(playerid,226.7491,1823.0441,7.4141); 
            
SetPlayerFacingAngle(playerid270 ); 
            
ApplyAnimation(playerid,"DANCING","DNCE_M_B",4.0,1,0,0,0,-1);  
            
CreateExplosion(212.9525,1822.9084,6.41411110.0); 
        }
    }

Thank you, you are the best!
+Rep!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)