saveskin, removeskin

Started by KAKAN, Sep 06, 2015, 06:11 AM

Previous topic - Next topic

KAKAN

Credits:- @KAKAN aka me, @soulshaker (for changeskin cmd)

ChangeSkin cmd:-
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 );
  }
  }
    }

Needed things
class SkinClass
{
skina = false;
skin = null;
}

function onScriptLoad()
{
sarray <- array(GetMaxPlayers(), null)
}

function onPlayerJoin(player)
{
sarray[ player.ID ] = SkinClass(player.Name); //Correct me if I'm wrong here
}

function onPlayerPart(player,reason)
{
sarray[player.ID] = null;
}

function onPlayerSpawn(player)
{
if ( sarray[ player.ID ].skina )
{
local skinr = sarray[ player.ID ].skin
local skin = GetSkinID(skinr)
player.Skin = skin.tointeger()
}
}

AND ATLAST The COmmands:-
else if ( cmd == "saveskin" )
{
local skiin = GetSkinName( player.Skin );
sarray[ player.ID ].skina = true;
sarray[ player.ID ].skin = skiin;
MessagePlayer(">> You have saved your current skin for next spawn/s.",player);
}

else if ( cmd == "removeskin" )
{
sarray[ player.ID ].skina = false;
MessagePlayer(">> You have removed your current saved skin for next spawn/s.",player);
}
oh no

FinchDon

Can i ask what this system do??
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

KAKAN

Your head!
This system will save the skin for the next spawn, so u can spawn with your favorite skin unless u leave the server
oh no

FinchDon

haha bug when i spawn while saveskin it doesnot give savedskin
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

KAKAN

DOes it give any error, NO
You have to edit the saveskin and removeskin according to your system, Have u added the playerclass?
[mergedate]1441525719[/mergedate]
Because this is working on mine
oh no

FinchDon

For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

KAKAN

So, it works now?
If no, then post your code
oh no

FinchDon

For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

KAKAN

lol... You can add it on your own PlayerClass
oh no

Xmair

First of all, Nice work.
Secondly, I want my credits, I helped you in saveskin xD

Credits to Boystang!

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

KAKAN

:P u didn't, the one u gave didn't work, so i tried another idea to save the skin NAME then change the SKIN NAME to SKIN ID while player spawns and set the player SKIN to the requested SKIN ID
oh no