My skin don't change ,my command:
else if (cmd == "skin")
{
if(!text) MessagePlayer("[#ff0000]Use /skin <ID>".player);
else {
player.Cash += -100000;
player.Skin = text;
}
if (player.Skin == 1 || player.Skin == 5) {
player.Health = 0.0;
MessagePlayer("[#ff0000]Invalid Skin!",player)
}
}
very little mistake
if(!text) MessagePlayer("[#ff0000]Use /skin <ID>".player);
change to
if(!text) MessagePlayer("[#ff0000]Use /skin <ID>",player);
tested on my script and its works
function onPlayerCommand( player, cmd, text )
{
if ( cmd =="skin" )
{
if( !text ) MessagePlayer("[#FF0000]Use /skin <ID>", player );
else if ( !IsNum( text ) ) MessagePlayer("[#FF0000]Use /skin <[#CC0000]ID[#FF0000]>", player );
else if ( !GetValidSkin( text.tointeger( ) ) ) MessagePlayer("[#FF0000]Invalid skin!", player );// You can add more.
else if ( player.Cash < 100000 ) MessagePlayer("[#FF0000]You do not have enough cash.", player );
else
{
player.Cash -= 100000;
player.Skin = text.tointeger( );
MessagePlayer( "You've changed your skin!", player );
}
}
}
function GetValidSkin( skinID )
{
switch( skinID.tointeger( ) )
{
case 1:
case 5: return false;
break;
default: return true;
}
}