#1

Hi I have a filterscript but it doesn't have an /skin command that save. How can make when I do /skin then after I spawn the skin should be the one that I set before? Also when player do quit and after they came back again in the server the last skin they saved should be loaded or set.

Thanks in advance.
Reply
#2

Do you use any Include for save like dini or something? what is your define of skin?
Reply
#3

Do you mean save the skin on disconnection, or just on respawn? If on respawn:
pawn Код:
new PlayerSkin[MAX_PLAYERS];   // On top of your script.

// Under your /skin command.
PlayerSkin[playerid] = skin;   // Change the "skin" to the variable used on the command on SetPlayerSkin.

// Under OnPlayerSpawn.
SetPlayerSkin(playerid, PlayerSkin[playerid]);
Reply
#4

Sorry I checked my filterscript again and I see that its using a skin saving

Код:
public LoginPlayer(playerid, name[], value[])
{
    INI_Int("Level", pInfo[playerid][pLevel]);
    INI_Int("Donator", pInfo[playerid][Donator]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Kills", pInfo[playerid][Kills]);
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    INI_Int("Muted", pInfo[playerid][Muted]);
    INI_Int("Score", pInfo[playerid][Score]);
    INI_Int("Cash", pInfo[playerid][Cash]);
    INI_Int("Skin", pInfo[playerid][Skin]);
    INI_String("LastLoggedIP", pInfo[playerid][IP], 16);
    INI_Int("TotalSeconds", pInfo[playerid][TotalSecs]);
    return 1;
}
But when I do set my /skin ingame (example: /skin 22) then after commit suicide then I spawn my skin changes back to the first one (anyway I found also this cmd for skin)

Код:
CMD:skin(playerid,params[])
{
	new skinid;
	if(sscanf(params, "i", skinid)) return
	SendClientMessage(playerid, white, "{FFFF00}Usage: /setskin <Skin ID>") ;
  	if(IsPlayerConnected(playerid))
	{
 		if(skinid < 0 || skinid > 299) return SendClientMessage(playerid, red, ">> Invaild Skin ID. Must be between <0-299>");
   		GameTextForPlayer(playerid,"~g~Skin Changed",2000,3);
		return SetPlayerSkin(playerid, skinid);
 	}
	else return ShowMessage(playerid, red, 2);

}
EDIT: Dragonsaurus: How about when player disconnect? then reconnect again in the server. It should load the last skin used. Is that possible?
Reply
#5

pawn Код:
CMD:skin(playerid,params[])
{
    new skinid;
    if(sscanf(params, "i", skinid)) return
    SendClientMessage(playerid, white, "{FFFF00}Usage: /setskin <Skin ID>") ;
    if(IsPlayerConnected(playerid))
    {
        if(skinid < 0 || skinid > 299) return SendClientMessage(playerid, red, ">> Invaild Skin ID. Must be between <0-299>");
        GameTextForPlayer(playerid,"~g~Skin Changed",2000,3);
        pInfo[playerid][Skin] = skinid;
        return SetPlayerSkin(playerid, skinid);
    }
    else return ShowMessage(playerid, red, 2);

}
and in OnPlayerSpawn
pawn Код:
SetPlayerSkin(playerid, pInfo[playerid][Skin]);
Reply
#6

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
Do you mean save the skin on disconnection, or just on respawn? If on respawn:
pawn Код:
new PlayerSkin[MAX_PLAYERS];   // On top of your script.

// Before SetPlayerSkin(playerid, skinid);
PlayerSkin[playerid] = skinid;

// Under OnPlayerSpawn.
SetPlayerSkin(playerid, PlayerSkin[playerid]);
I already posted the solution. Just changed the skin to skinid.
Reply
#7

pawn Код:
//under OnPlayerSpawn

SetPlayerSkin(playerid,pInfo[playerid][Skin]);
EDIT: Too late xD
Reply
#8

Guys I found out that I am using this underonplayerspawn

Код:
if(GetPVarInt(playerid,"Useskin") == 1)
{
        SetPlayerSkin(playerid, pInfo[playerid][Skin]);
}
Which one should I used?


EDIT: Also please kindly post the whole script coz I got confused.
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
pawn Код:
pInfo[playerid][Skin] = skinid;
You did not see this.
Put it after the SetPVInt(bla bla);
Reply
#10

Quote:
Originally Posted by Dragonsaurus
Посмотреть сообщение
You did not see this.
Put it after the SetPVInt(bla bla);
aww sweet man! good job its working! but the last thing is that after I disconnect and came back to server then choose random skin from character selector. The last skin before I disconnect was gone. I should spawn with the last skin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)