Skins loading
#1

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
Reply
#2

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;
}
Reply
#3

Show these two codes, newbie and when player logins.
Reply
#4

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

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.
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)