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



Register command not working? - Torran - 01.03.2010

Ingame if i type /register [mypassword]
Nothing happens..
But if i type /register, It shows the usage

Im using SeifAdmin v4 edited,

pawn Код:
if (strcmp(cmd, "/register", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(AccountInfo[playerid][Logged] == 1)
{
SendClientMessage(playerid, RED, "You are already logged in.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "/Gamemode/%s.cfg", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, RED, "That name is already taken. Please reconnect using a different username.");
fclose(hFile);
return 1;
}
new pass[150];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /register [password]");
WP_Hash(pass, sizeof pass, tmp);
printf("register: %s", pass);
OnPlayerRegister(playerid, pass);
}
return 1;
}
pawn Код:
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new name[MAX_PLAYER_NAME], str[128], ip[15];
GetPlayerName(playerid, name, sizeof name);
GetPlayerIp(playerid, ip, sizeof ip);
format(str, sizeof str, "/Gamemode/%s.cfg", name);
new File:account = fopen(str, io_write);
if (account)
{
strmid(AccountInfo[playerid][Password], password, 0, strlen(password), 255);
AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
new file[256];
{
format(file, sizeof file, "Password: %s\n", AccountInfo[playerid][Password]);
{fwrite(account, file); }
format(file, sizeof file, "Gender: %d\n", AccountInfo[playerid][Gender]);
{fwrite(account, file); }
format(file, sizeof file, "City: %d\n", AccountInfo[playerid][City]);
{fwrite(account, file); }
format(file, sizeof file, "Cash: %d\n", AccountInfo[playerid][Cash]);
{fwrite(account, file); }
format(file, sizeof file, "Warnings: %d\n",AccountInfo[playerid][Warns]);
{fwrite(account, file); }
format(file, sizeof file, "WarnReason1: %s\n",AccountInfo[playerid][WarnReason1]);
{fwrite(account, file); }
format(file, sizeof file, "WarnReason2: %s\n",AccountInfo[playerid][WarnReason2]);
{fwrite(account, file); }
format(file, sizeof file, "WarnReason3: %s\n",AccountInfo[playerid][WarnReason3]);
{fwrite(account, file); }
format(file, sizeof file, "IPAddress: %s\n",ip);
{fwrite(account, file); }
}
fclose(account);
SendClientMessage(playerid, GREEN, "You have successfully registered an account, Please login");
SendClientMessage(playerid, ORANGE, "\"/login [password]\"");
}
}
return 1;
}



Re: Register command not working? - adsy - 01.03.2010

http://dracoblue.net/tidy/pawn/

handy link for you, ive had to convert it to read it properly




Re: Register command not working? - Torran - 01.03.2010

That dosent help me at all,
In my script. indentation is correct but when i copy and pasted it went wrong so i did that.


Re: Register command not working? - adsy - 01.03.2010

sizeof pass

do you need brackets here?


Re: Register command not working? - Torran - 01.03.2010

I dont think so, I think it was like that before i edited, Let me check
EDIT: Yes its like that on the script seif released


Re: Register command not working? - adsy - 01.03.2010

then i better not try any further, looks good to me.

stick a load of printf's or sendclientmessages in all over the place under every bit and see what actually goes through


Re: Register command not working? - HotSauce - 01.03.2010

Ok i see your using serverffs goto Your FileManager make sure the "Users" folder dosent have caps ok their u go


Re: Register command not working? - adsy - 01.03.2010

Quote:
Originally Posted by The Fame Monster
Ok i see your using serverffs goto Your FileManager make sure the "Users" folder dosent have caps ok their u go
clever, i didnt realise torran uses serverffs though.

useful info for the future


Re: Register command not working? - Torran - 02.03.2010

Quote:
Originally Posted by The Fame Monster
Ok i see your using serverffs goto Your FileManager make sure the "Users" folder dosent have caps ok their u go
I dont use ServerFFS

Quote:
Originally Posted by Seif_
If /register doesn't work, it means your folder where accounts should be saved in doesn't exist. In your case, your folder is called "Gamemode". Create it in "scriptfiles" folder.
Lol forgot all about that :P


Re: Register command not working? - HotSauce - 03.03.2010

Dosen't matter what Host you use, Lol you always need no caps :P Anyways Yw.