SA-MP Forums Archive
changeskin? - 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: changeskin? (/showthread.php?tid=595864)



changeskin? - N0FeaR - 08.12.2015

Код:
../gamemodes/include/OnCommand.pwn(6) : error 014: invalid statement; not in switch
../gamemodes/include/OnCommand.pwn(6) : warning 215: expression has no effect
../gamemodes/include/OnCommand.pwn(6) : warning 215: expression has no effect
../gamemodes/include/OnCommand.pwn(6) : warning 215: expression has no effect
../gamemodes/include/OnCommand.pwn(6) : warning 215: expression has no effect
../gamemodes/include/OnCommand.pwn(6) : error 001: expected token: ";", but found ":"
../gamemodes/include/OnCommand.pwn(6) : error 029: invalid expression, assumed zero
../gamemodes/include/OnCommand.pwn(6) : fatal error 107: too many error messages on one line

PHP код:
CMD:changeskin(playerid// CMD for calling a change skin
{
    case 
0,1,2,3://GROVE
    
{
        if(
classid == || classid == || classid == 2)
        {
            
ShowModelSelectionMenu(playeridskingrove"Select skin for grove");
        }
    }
     case 
4,5,6://LSPD
      
{
          if(
classid == || classid == || classid == || classid == 6)
        {
             
ShowModelSelectionMenu(playeridskinpolice"Select skin for police");
           }
     }
     case 
7,8,9://VAGOS
     
{
        if(
classid == || classid == || classid == 9)
         {
             
ShowModelSelectionMenu(playeridskingrove"Select skin for vagos");
          }
    }
     case 
10,11,12,13://BALLAS
      
{
        if(
classid == 10 || classid == 11 || classid == 12)
        {
            
ShowModelSelectionMenu(playeridskinballas"Select skin for grove");
            return 
1;
        }
    }




Re: changeskin? - Kevln - 08.12.2015

pawn Код:
switch(something)
{
    case 0:
    {
        // ...
    }
    case 1:
    {
        // ...
    }
}



Re: changeskin? - N0FeaR - 08.12.2015

Quote:
Originally Posted by Kevln
Посмотреть сообщение
pawn Код:
switch(something)
{
    case 0:
    {
        // ...
    }
    case 1:
    {
        // ...
    }
}
ops i forgot the switch.


Re: changeskin? - N0FeaR - 08.12.2015

I get this now lol

PHP код:
../gamemodes/include/OnCommand.pwn(6) : error 017undefined symbol "classid"
../gamemodes/include/OnCommand.pwn(10) : error 017undefined symbol "classid"
../gamemodes/include/OnCommand.pwn(17) : error 017undefined symbol "classid"
../gamemodes/include/OnCommand.pwn(24) : error 017undefined symbol "classid"
../gamemodes/include/OnCommand.pwn(31) : error 017undefined symbol "classid" 



Re: changeskin? - Kevln - 08.12.2015

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
I get this now lol

PHP код:
../gamemodes/include/OnCommand.pwn(6) : error 017undefined symbol "classid"
../gamemodes/include/OnCommand.pwn(10) : error 017undefined symbol "classid"
../gamemodes/include/OnCommand.pwn(17) : error 017undefined symbol "classid"
../gamemodes/include/OnCommand.pwn(24) : error 017undefined symbol "classid"
../gamemodes/include/OnCommand.pwn(31) : error 017undefined symbol "classid" 
You're comparing a variable that doesn't even exist.


Re: changeskin? - Nate4 - 09.12.2015

Yea as KevLn said - that variable doesn't exist within the command.

You'll have to save the class ID into an array when the player chooses class, then use that value later
E.g.

New array

PHP код:
new PlayerClass[MAX_PLAYERS]; 
Saving the class:

PHP код:
public OnPlayerRequestClass(playerid,classid)
{
    
PlayerClass[playerid] = classid;

Using in your switch (create local variable classid and read from the array):

PHP код:
new classid PlayerClass[Playerid];
 
switch(
classid)
{
    case 
0,1,2,3://GROVE 
        

            if(
classid == || classid == || classid == 2
            { 
                
ShowModelSelectionMenu(playeridskingrove"Select skin for grove"); 
            } 
        }

Hope this helps


Re: changeskin? - Sew_Sumi - 09.12.2015

Why not a team variable, rather than checking classid via the if statements?