SA-MP Forums Archive
saveskin - 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: saveskin (/showthread.php?tid=645128)



saveskin - rakinz - 20.11.2017

Код:
CMD:saveskin(playerid, params[], help)
{
    new skinid, string[256];
    if(skinid > 299) return SendClientMessage(playerid,COLOR_RED,"ERROR: Available Skin: 0 - 299 !");
    format(string, sizeof(string), "You have saved your correct skin!"COL_YELLOW" use /deleteskin to unsave it.");
    SendClientMessage(playerid, COLOR_GREY, string);
    skinid = GetPlayerSkin(playerid);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"SavedSkin",skinid);
    INI_Close(File);
   return 1;
}
On DialogResponse (register dialog):
Код:
INI_WriteInt(File,"SavedSkin",-1);
Now, when I try to put that code:
Код:
if(PlayerInfo[playerid][pSavedSkin] >=0 ) return SetPlayerSkin(playerid,PlayerInfo[playerid][pSavedSkin]);
OnPlayerConnect it makes the skinid to '0'
And when I'm trying to make it OnPlayerSpawn, it makes the skinid to '0' and changes the virtual world or interior idk.

If someone knows how to fix that problem I will be thankful!


Re: saveskin - Meller - 20.11.2017

When is the next time you set the players skin to something? If you're registering it at -1 and then disallowing the player to load negative skins, their skin will be by default (0) being the CJ skin.


Re: saveskin - rakinz - 20.11.2017

Quote:
Originally Posted by Meller
Посмотреть сообщение
When is the next time you set the players skin to something? If you're registering it at -1 and then disallowing the player to load negative skins, their skin will be by default (0) being the CJ skin.
So how can I fix it?

if I won't make for new registered players a savedskin id, then when they will join the server they'll get a

random new skin.

And where is the best public to put that:
Код:
if(PlayerInfo[playerid][pSavedSkin] >=0 ) return SetPlayerSkin(playerid,PlayerInfo[playerid][pSavedSkin]);
?


Re: saveskin - Meller - 20.11.2017

It really depends on your gamemode and where you want it. By my guesses, place it at OnPlayerSpawn.


Re: saveskin - rakinz - 20.11.2017

Quote:
Originally Posted by Meller
Посмотреть сообщение
It really depends on your gamemode and where you want it. By my guesses, place it at OnPlayerSpawn.
I've made it OnPlayerSpawn and it still when a player spawns his skin id is 0 (cj skin).

btw, I've tried it on some other publics too..


Re: saveskin - Meller - 20.11.2017

Quote:
Originally Posted by rakinz
Посмотреть сообщение
I've made it OnPlayerSpawn and it still when a player spawns his skin id is 0 (cj skin).

btw, I've tried it on some other publics too..
That doesn't matter if you're setting the default skin to -1. Set it to 299 and you'll get a white male with a black leather jacket.

INI_WriteInt(File,"SavedSkin",299);


Re: saveskin - rakinz - 20.11.2017

Quote:
Originally Posted by Meller
Посмотреть сообщение
That doesn't matter if you're setting the default skin to -1. Set it to 299 and you'll get a white male with a black leather jacket.

INI_WriteInt(File,"SavedSkin",299);
I've done it already, and made that:
Код:
SetPlayerSkin(playerid,PlayerInfo[playerid][pSavedSkin]);
OnPlayerSpawn()

Still getting cj skin :E


Re: saveskin - Meller - 20.11.2017

So debug it.