Skin don't change

Started by NicusorN5, Apr 25, 2016, 10:38 AM

Previous topic - Next topic

NicusorN5

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)
}
}

Cool

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


Xmair

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;
}
}

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD