SA-MP Forums Archive
/Register command problem - 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: /Register command problem (/showthread.php?tid=429442)



/Register command problem - Spazur - 09.04.2013

Hi. I have recently downloaded a BAdmin FS and everytime I /register it's like I didn't do anything. It should create a file on scriptfiles\BAdmin\Users but it doesn't, I don't know what I am doing wrong... help?


Re: /Register command problem - Shoulen - 09.04.2013

Is it not supposed to create the file in Scriptfiles/BAdmin/Users? If so, does the BAdmin/Users file path exist in the Scriptfiles path?


Re: /Register command problem - Spazur - 09.04.2013

Quote:
Originally Posted by Shoulen
Посмотреть сообщение
Is it not supposed to create the file in Scriptfiles/BAdmin/Users? If so, does the BAdmin/Users file path exist in the Scriptfiles path?
Yes and yes. The problem is, it doesn't create, like it doesn't exist.


Re: /Register command problem - Shoulen - 09.04.2013

What does the code look like?


Re: /Register command problem - Spazur - 09.04.2013

Quote:
Originally Posted by Shoulen
Посмотреть сообщение
What does the code look like?
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME];
new playerfile[100];
GetPlayerName(playerid, pname, sizeof(pname));
format(playerfile, sizeof(playerfile), "BAdmin/Users/%s.ini",pname);
if(!dini_Exists(playerfile)) SendClientMessage(playerid, orange, "This username is available! Type /register to make an account.");
else if(dini_Exists(playerfile)) SendClientMessage(playerid, orange, "This username is registered! Type /login to log into your account.");
if(dini_Int(playerfile, "Banned") == 1)
{
new string1[126];
format(string1, sizeof(string1), "%s has been kicked for ban evading.", pname);
SendClientMessageToAll(red, string1);
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
if(logged[playerid] == 1)
{
new playerfile[100], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(playerfile, sizeof(playerfile), "BAdmin/Users/%s.ini",pname);
dini_IntSet(playerfile, "Level", level[playerid]);
dini_IntSet(playerfile, "Cash", GetPlayerMoney(playerid));
dini_IntSet(playerfile, "Score", GetPlayerScore(playerid));
}
level[playerid] = 0;
logged[playerid] = 0;
muted[playerid] = 0;
return 1;
}


Re: /Register command problem - Spazur - 09.04.2013

UPDATE: I have managed to figure it out that if I manually create the .ini file it works, it recognizes the User. The problem seems to be related in 'creating' when you join the server.