#1

Hello,

My skin is saving when I /q. But when I throw a server restart, it's setted back to CJ.
What's wrong with my GMX? Nothing I think so.
GMX:
pawn Код:
//-----[Server GMX]-----
CMD:gmx(playerid, params[])
{
    SaveUserDate(playerid);

    SetTimer("Gmx",3000,false);
    SendRconCommand("gmx");
    return 1;
}
SaveUserDate
pawn Код:
forward SaveUserDate(playerid);
public SaveUserDate(playerid)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    INI_Close(File);
    return true;
}
Reply
#2

It also doens't work for me (who typed the command).

pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][Password]);
    INI_Int("Cash",PlayerInfo[playerid][Cash]);
    INI_Int("Kills",PlayerInfo[playerid][Kills]);
    INI_Int("Deaths",PlayerInfo[playerid][Deaths]);
    INI_Int("Score",PlayerInfo[playerid][Score]);
    INI_Int("Adminlevel",PlayerInfo[playerid][Adminlevel]);
    INI_Int("Skin",PlayerInfo[playerid][Skin]);
    return 1;
}
Here I load them. But the weird part is, it's removing after the GMX.
Full SaveUserDate:
pawn Код:
forward SaveUserDate(playerid);
public SaveUserDate(playerid)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    PlayerInfo[playerid][Skin] = GetPlayerSkin(playerid);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Adminlevel",PlayerInfo[playerid][Adminlevel]);
    INI_WriteInt(File,"Skin", GetPlayerSkin(playerid));
    INI_Close(File);
    return true;
}
Reply
#3

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { SaveUserData(i); }}
Thats a fix for what ****** mentioned.

Anyway, what kind of information do you load on playerspawn/requestclass?
Reply
#4

OnPlayerSpawn
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetSpawnInfo( playerid, 0, PlayerInfo[playerid][Skin], 2842.7844,1290.9116,11.3906,93.5261, 0, 0, 0, 0, 0, 0 );
    SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
    return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetSpawnInfo( playerid, 0, PlayerInfo[playerid][Skin], 2842.7844,1290.9116,11.3906,93.5261, 0, 0, 0, 0, 0, 0 );
    SpawnPlayer(playerid);
    return 1;
}
I just don't know wich one I can remove.
@Kayaque
I will implent that. Thank you
Reply
#5

pawn Код:
CMD:gmx(playerid, params[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    SaveUserDate(i);
    SetTimer("Gmx",3000,false);
    SendRconCommand("gmx");
    return 1;
}
try
Reply
#6

Quote:
Originally Posted by Venice
Посмотреть сообщение
pawn Код:
CMD:gmx(playerid, params[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    SaveUserDate(i);
    SetTimer("Gmx",3000,false);
    SendRconCommand("gmx");
    return 1;
}
try
Saving after /q and not saving after GMX. So same story. But it will fix the other problem I think =]
Reply
#7

Quote:
Originally Posted by ******
Посмотреть сообщение
Where do you call INI_ParseFile? You might want to look in to this system:

https://sampforum.blast.hk/showthread.php?tid=279986
Can you give me a example of 'parsing' the file? I'm probably new with that. And will that solve my problem?
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
You have the "LoadUser_data" callback, but no evidence of "INI_ParseFile", which is used to call those callbacks. There are tutorials on y_ini use - see the "My Threads" link in my signature.
Okay, I will check that. But does that solve my problem? Or it's just needed to the for in the futher?
Reply
#9

Hello guys, theres something I would like to ask:

pawn Код:
//-----[Server GMX]-----
CMD:gmx(playerid, params[])
{
    SaveUserDate(playerid);

    SetTimer("Gmx",3000,false); // <---- About this
    SendRconCommand("gmx"); // <---- And this
    return 1;
}
What does the callback of the timer "Gmx" do? If I understood the code correctly, then you're setting a timer for a gmx command, and then you're instantly calling a SendRconCommand("gmx"); under it..? Am I right?
Reply
#10

pawn Код:
SendRconCommand("gmx");
That's calling the /rcon gmx. But before that you can save your shit and everything else what you wanna do.
Honestly the Timer is useless, I will remove that later. I just don't know why it's still in my command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)