SA-MP Forums Archive
Skins loading - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Skins loading (/showthread.php?tid=268196)



Skins loading - Yako - 11.07.2011

Hello, I made a skins saving/loading script for my gamemode, but the script only saves the skins, when I connect second time to server it doesn't loads my skin from user ini file. Maybe someone can help me to fix it?
This is my script:
It saves the file:
Код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_IntSet(file, "Money", GetPlayerMoneyEx(playerid));
dini_IntSet(file, "Clotches",PlayerInfo[playerid][pClotches] = GetPlayerSkin(playerid));
}
gPlayerLogged[playerid] = 0;
gPlayerNewbie[playerid] = 0;
Administrator[playerid] = false;
Moderator[playerid] = false;

return 1;
}
This code have to load the skin but it don't works
Код:
public OnPlayerSpawn(playerid)
{
if(gPlayerNewbie[playerid] == 1)
{
SetPlayerColor(playerid,0x6F6F6FFF);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1642.2858,-2332.8455,-2.6797);
GivePlayerMoneyEx(playerid, 5000);
}
else {
SetPlayerSkin(playerid, PlayerInfo[playerid][pClotches]);
SetPlayerColor(playerid,0x6F6F6FFF);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1642.2858,-2332.8455,-2.6797);
}
return 1;
}
And I need help doing newbie script, I mean when player connect first time he gets 5000 but when he connect second time he doesn't get 5000 more


Re: Skins loading - Hipflop - 11.07.2011

Try to use SetSpawnInfo.

Here is example:
pawn Код:
public OnPlayerSpawn(playerid)
{
if(gPlayerNewbie[playerid] == 1)
{
SetPlayerColor(playerid,0x6F6F6FFF);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1642.2858,-2332.8455,-2.6797);
GivePlayerMoneyEx(playerid, 5000);
}
else {
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pClotches], 1642.2858,-2332.8455,-2.6797, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerColor(playerid,0x6F6F6FFF);
SetPlayerInterior(playerid,0);
}
return 1;
}



Re: Skins loading - Toreno - 11.07.2011

Show these two codes, newbie and when player logins.


Re: Skins loading - Yako - 11.07.2011

Solved the problem, just changed some code and it works. Anyway thanks for the help


Re: Skins loading - Toreno - 11.07.2011

If you can/want, will you edit your thread and post what was the problem.
It would help for others in case it happens them, just suggesting you.


Re: Skins loading - Yako - 11.07.2011

I'll create a tutorial how to make skins saving. I think it will be okay.