Author Topic: Help in command /setskin correction.  (Read 2915 times)

CANYON

  • Newbie
  • *
  • Posts: 29
  • Karma: +1/-0
    • View Profile
Help in command /setskin correction.
« on: August 24, 2012, 11:00:51 pm »
Code: [Select]
else if ( cmd == "setskin" )
{
local check = Required( player, cmd, Level );

if ( check )
{
if ( !text ) MessagePlayer( "[#FF7C7C]Use: /setskin [ID] [Skin]", player );
else
{
                                local skin = text ? text.tointeger() : 0;
         
                                player.Skin = skin;
Message( "[#FF7C7C] Admin " + player + " changed a skin to the player " + plr + " on " + skin +"" );
}
}
}

What not so in a command? Help to correct.

morphine

  • Newbie
  • *
  • Posts: 9
  • Karma: +2/-0
    • View Profile
Re: Help in command /setskin correction.
« Reply #1 on: August 26, 2012, 12:00:59 pm »
Code: [Select]
else if ( cmd == "setskin" )

                                local skin = text ? text.tointeger() : 0;
         
 
}

What not so in a command? Help to correct.

Why make life such a pain? Do you even know what the "?" closure is used for? I highly doubt it.

You should replace what I quoted above with the following:
Code: [Select]
local skin = text.tointeger();
However, I'd suggest you to not convert the "skin" variable to an integer right away, rather first check whether the skin parameter a player on your server will type is a digit by using IsNum, and if it is, convert it to an integer.

Have a nice day.

 

© Liberty Unleashed Team.