Saving skin on variable
#1

I've been trying to make variable that would save player skin while he is on duty ( PD, FBI, etc.. )

Saving skin on variable..
Код:
new skin;
skin = GetPlayerSkin(playerid);
PlayerSkin[playerid] = skin; // THIS VARIABLE
Putting player skin on duty skin.
Код:
SetPlayerSkin(playerid, 255);
PlayerInfo[playerid][pSkin] = 255;
And this part does not work, when it should set player skin to one that he had before he went on duty..
Код:
new skin = PlayerSkin[playerid];	    
PlayerInfo[playerid][pSkin] = skin;
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
Reply
#2

At the third quote,you already declared skin as an variable,so you do not need 'new' infront of it.
You actually don't need that 'skin' variable at all,you're already using PlayerSkin[playerid];
So as 'PlayerInfo[playerid][pSkin]' and 'PlayerSkin[playerid]' are two different variables,you can use it like this:
pawn Код:
PlayerSkin[playerid]=GetPlayerSkin(playerid);//Setting the first skin before duty to that var
//Going on duty-
SetPlayerSkin(playerid, 255);
PlayerInfo[playerid][pSkin] = 255;
//When getting the skin before duty:
SetPlayerSkin(playerid, PlayerSkin[playerid]);
PlayerInfo[playerid][pSkin] = PlayerSkin[playerid];
Reply
#3

that is strange, but improve that.

pawn Код:
// saving
PlayerSkin[playerid] = GetPlayerSkin(playerid);

// putting on duty
SetPlayerSkin(playerid, 255);
PlayerInfo[playerid][pSkin] = 255;

// re-putting  
PlayerInfo[playerid][pSkin] = PlayerSkin[playerid];
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
Reply
#4

Tried but it does not work..
When I change to duty clothes and try to change back to normal it doesn't work..
Reply
#5

If you have enum table just add a entry that called e.g "OldSkin",
and to save it just send the variable to it.

e.g:

PlayerInfo[playerid][OldSkin] = GetPlayerSkin(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)