Author Topic: Changeskin, paint - commands  (Read 2639 times)

0 Members and 1 Guest are viewing this topic.

Offline soulshaker

  • Street Thug
  • *
  • Posts: 21
    • View Profile
    • Ethical DM VC:MP 0.4
Changeskin, paint - commands
« on: October 07, 2014, 03:47:58 pm »
Changeskin:-

Code: [Select]
if ( cmd == "changeskin" )
    {
        if ( !player.IsSpawned ) MessagePlayer( "[#EE3B3B]You have to be spawned to use this command.", player );
        else if ( !text ) MessagePlayer( "[#FFFFFE]Syntax:- /" + cmd + "[#EE3B3B] <ID/SkinName>", player );
        else if( IsNum(text) )
{
player.Skin = text.tointeger();
         MessagePlayer( "[#66CD00]Skin changed to: " + GetSkinName( player.Skin ), player );
        }
else
         {
local skin_id = GetSkinID(text);
         if (skin_id < 0) MessagePlayer( "[#EE3B3B]Could not identify the specified skin name.", player );
else
         {
player.Skin = skin_id;
MessagePlayer( "[#66CD00]Skin changed to: " + GetSkinName( player.Skin ), player );
}
}
    }

Paint:-

Code: [Select]
if ( cmd == "paint" )
                {
                    if ( !player.IsSpawned ) MessagePlayer( "[#EE3B3B]You have to be spawned to use this command", player );
                        else if ( !player.Vehicle ) MessagePlayer( "[#FFFFFE]Error: [#EE3B3B]You must be in a vehicle to use this command", player );
                        else if ( !text ) MessagePlayer( "[#FFFFFE]Syntax:- /" + cmd + "[#EE3B3B] <ID> (Id must be between 0 to 94)", player );
                        else if ( !IsNum( text ) ) MessagePlayer( "[#FFFFFE]Error: [#EE3B3B]The color ID should be in integer/number.", player );
                        else if ( text.tointeger() > 94 ) MessagePlayer( "[#FFFFFE]Syntax:- /" + cmd + "[#EE3B3B] <ID> (Id must be between 0 to 94)", player );
                        else
                        {
                         player.Vehicle.Colour1 = text.tointeger();
                         MessagePlayer( "[#66CD00]You have change colour of your vehicle", player );
                        }
                }

Simple commands, but i thought these may help some people :)
« Last Edit: October 08, 2014, 02:10:31 am by soulshaker »

Offline Flockshot

  • Street Thug
  • *
  • Posts: 29
    • View Profile
Re: Changeskin, paint - commands
« Reply #1 on: October 07, 2014, 04:28:58 pm »
You added

Code: [Select]
text = text.tointeger();

when there is no need for it.
You can just simply do
Code: [Select]
player.Skin = text.tointeger();
veh.Colour1 = text.tointeger();

Also when you are making a variable of player.Vehicle and only using it once in
Code: [Select]
else if ( !veh )
when u dont use it here
Code: [Select]
player.Vehicle.Colour1 = text.tointeger();

Simple errors which make the server do more work.
Other than that its good.

Offline soulshaker

  • Street Thug
  • *
  • Posts: 21
    • View Profile
    • Ethical DM VC:MP 0.4
Re: Changeskin, paint - commands
« Reply #2 on: October 07, 2014, 05:10:27 pm »
Thanks :)

Updated.

Offline Honey.

  • Made Man
  • ***
  • Posts: 111
    • View Profile
Re: Changeskin, paint - commands
« Reply #3 on: October 07, 2014, 05:37:29 pm »
Nice, It will get better if you add different attractive bright colors  ;)

Offline soulshaker

  • Street Thug
  • *
  • Posts: 21
    • View Profile
    • Ethical DM VC:MP 0.4
Re: Changeskin, paint - commands
« Reply #4 on: October 07, 2014, 05:46:53 pm »
Actually it depend on others, which colour they want to add. So i didn't added any :)

Offline Flockshot

  • Street Thug
  • *
  • Posts: 29
    • View Profile
Re: Changeskin, paint - commands
« Reply #5 on: October 07, 2014, 08:28:52 pm »
Actually it depend on others, which colour they want to add. So i didn't added any :)
It depend on player when he know about it.These are good but i think player would also need a list of skins/colors according to ids so he can choose the skin/color he really want instead of trying from 0 to end of the ids.

Offline S.L.C

  • Street Thug
  • *
  • Posts: 42
  • Sorry if you weren't impressed!
    • View Profile
Re: Changeskin, paint - commands
« Reply #6 on: October 07, 2014, 11:53:53 pm »
You could take advantage of the GetSkinID() function from the latest plug-in update:
Code: [Select]
if ( cmd == "skin" )
{
if ( !player.IsSpawned ) MessagePlayer( "You have to be spawned to use this command.", player );
else if ( !text ) MessagePlayer( "Syntax, /" + cmd + " <TAG>", player );
else {
local skin_id = GetSkinID(text);
if (skin_id < 0) MessagePlayer( "Could not identify the specified skin tag.", player );
else {
player.Skin = skin_id;
MessagePlayer( "Skin changed to: " + GetSkinName( player.Skin ), player );
}
}
}

By short-tag I mean you don't have to use the full skin name. All you need is a few key letters to help identify the skin. Like "tv" for [To]mmy [V]ercetti. For example you could do: /skin ha3 ([Ha]tian 3/C). You can also use the full name if you want to. Even other symbols or different case. The search strips symbols and is case insensitive.

Quote from: Bitbucket
It's a small function to retrieve the skin id from the name. The function should (theoretically) work for both full names or simple short tags.
Example of short tags where every item in the list point to the same id:
  • Candy Suxx
  • Cas
  • Cax
They all point to Candy Suxx

  • Garbage man 1
  • Garbage man a
  • Gm1
  • Gma
  • Ga1
  • Gaa
They all point to Garbage man 1

As long as the short tag doesn't interfere with another name then it tries to be as simple as possible.

The search doesn't care about trailing spaces, case sensitivity or non-alphanumeric symbols:
  • ------Lo*%ve F&ist^374
  • l--------Fd
  • LoD
  • Love 4
They all point to Love Fist 4/D

You can also use a, b, c, d ... instead of 1, 2, 3, 4 because some IDs share the same skin name and precise numeric identification wouldn't be accurate.

Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Re: Changeskin, paint - commands
« Reply #7 on: October 08, 2014, 01:21:47 am »
off-topic: some developer should list the new skins added in 0.4

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



Offline soulshaker

  • Street Thug
  • *
  • Posts: 21
    • View Profile
    • Ethical DM VC:MP 0.4
Re: Changeskin, paint - commands
« Reply #8 on: October 08, 2014, 01:59:05 am »
You could take advantage of the GetSkinID() function from the latest plug-in update

Thanks SLC :D
Updated the code( Now the command works both with ID and TAG).

Nice, It will get better if you add different attractive bright colors  ;)

Added.