Saving skin on variable - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Saving skin on variable (
/showthread.php?tid=480204)
Saving skin on variable -
iLegend5 - 09.12.2013
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]);
Re: Saving skin on variable -
Tagathron - 09.12.2013
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];
Re: Saving skin on variable -
PT - 09.12.2013
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]);
Re: Saving skin on variable -
iLegend5 - 09.12.2013
Tried but it does not work..
When I change to duty clothes and try to change back to normal it doesn't work..
Re : Saving skin on variable -
FilesMAker - 09.12.2013
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);