Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: NicusorN5 on Apr 25, 2016, 10:38 AM

Title: Skin don't change
Post by: NicusorN5 on Apr 25, 2016, 10:38 AM
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)
}
}
Title: Re: Skin don't change
Post by: Cool on Apr 25, 2016, 11:04 AM
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

Title: Re: Skin don't change
Post by: Xmair on Apr 25, 2016, 11:05 AM
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;
}
}