Skin saving problem -
[RS]Monk - 20.11.2011
Hi,i have one problem with saving skin.When player chose skin from class selection he gets CJ skin,thats because i put SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); in OnPlayerSpawn callback.But,when i delete SetPlayerSkin(playerid...from OnPlayerSpawn its work..but when i set player skin with command (/setskin) and kill myself i get old skin.I can't explain better because i don't know good english,i think you understand me.If you don't understand go to 95.180.59.10:7787 and i will show you.Im using y_ini register system.
Re: Skin saving problem -
Tanush123 - 20.11.2011
U should add a timer that saves the player account every 10 seconds so under it you make the skin save
Re: Skin saving problem -
[RS]Monk - 20.11.2011
@Tanush123
again nothing
Re: Skin saving problem -
Tanush123 - 20.11.2011
on top
new SAVETIMER[MAX_PLAYERS];
on your login code
pawn Код:
SAVETIMER = SetTimerEx("Save",5000,1,"u",playerid);
on bottom
pawn Код:
forward Save(playerid);
public Save(playerid)
{
//your saving code
return 1;
}
Re: Skin saving problem -
DreveN - 20.11.2011
Код:
if(strcmp(cmd, "/setskin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "ИНФО: /setskin [ID/Имя] [skin]");
new playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new skin = strval(tmp);
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
PlayerInfo[playa][pSkin] == skin;
}
}
return true;
}
}
Re: Skin saving problem - Sinc - 20.11.2011
The OnPlayerSpawn callback is called when a player spawns. If you die, you will respawn, OnPlayerSpawn is then called. You must remove the SetPlayerSkin function from OnPlayerSpawn, spawn the player, get his skin id and output the data either as a message or directly to the server console.
Re: Skin saving problem -
DreveN - 20.11.2011
Also check for the appearance of the player is loading playerinfo [playerid] [pSkin]
Re: Skin saving problem -
[RS]Monk - 20.11.2011
now its work but only for id 0 save skin..
Re: Skin saving problem -
-Rebel Son- - 21.11.2011
#Tanush, That's a waste of usage, Timers also lag.
Monk, I've never scripted with Yini, But How much are you trying to save? Alot of things? or small amount of things?
Yinis good for large amounts of data, But if it's like 2 or three things, Get something smaller. I Use Dini for my small saving, and use DJSON for my larger saving. Message me so i can talk to you further.
Re: Skin saving problem -
[RS]Monk - 21.11.2011
I wont to make two commands,/saveskin [skinid] and /nosaveskin (when you tyre this,the skin will be save only from class selection).For example,if you tyre /saveskin 294 and go relog and on class selection you can chose any skin but when you spawn you will get skin 294.