PDA

View Full Version : changeskin?


N0FeaR
08/12/2015, 09:22 PM
../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



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

Kevln
08/12/2015, 09:25 PM
switch(something)
{
case 0:
{
// ...
}
case 1:
{
// ...
}
}

N0FeaR
08/12/2015, 09:29 PM
switch(something)
{
case 0:
{
// ...
}
case 1:
{
// ...
}
}


ops i forgot the switch.

N0FeaR
08/12/2015, 09:31 PM
I get this now lol

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

Kevln
08/12/2015, 09:35 PM
I get this now lol

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

You're comparing a variable that doesn't even exist.

Nate4
09/12/2015, 01:23 AM
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 :D
E.g.

New array

new PlayerClass[MAX_PLAYERS];

Saving the class:

public OnPlayerRequestClass(playerid,classid)
{
PlayerClass[playerid] = classid;
}

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

new classid = PlayerClass[Playerid];


switch(classid)
{

case 0,1,2,3://GROVE
{
if(classid == 0 || classid == 1 || classid == 2)
{
ShowModelSelectionMenu(playerid, skingrove, "Select skin for grove");
}
}
}

Hope this helps :D

Sew_Sumi
09/12/2015, 01:36 AM
Why not a team variable, rather than checking classid via the if statements?