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);
}
Can i ask what this system do??
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
haha bug when i spawn while saveskin it doesnot give savedskin
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
ya i added
So, it works now?
If no, then post your code
I miss the OnPlayerJoin
lol... You can add it on your own PlayerClass
First of all, Nice work.
Secondly, I want my credits, I helped you in saveskin xD
: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