SA-MP Forums Archive
Register/login syste - 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/login syste (/showthread.php?tid=345257)



Register/login syste - Stm - 24.05.2012

Can some one give me a good and simple register/login system for RP server ? PLS


Re: Register/login syste - Neil. - 24.05.2012

Next time, try to use the search or find one here https://sampforum.blast.hk/showthread.php?tid=283602


Re: Register/login syste - vvhy - 24.05.2012

Heres an example of the register/login cmds
Quote:

if (strcmp(cmd, "/register", true)==0)
{
new string[265];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, grey, "USAGE: /register [password]");
return 1;
}
if (gPlayerAccount[playerid] == 1)
{
SendClientMessage(playerid, grey, " That nickname is already registered");
return 1;
}

strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 255);
String(PlayerInfo[playerid][pPassword]);
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "%s.cer", playername);
new File: file = fopen(string, io_read);
if (file)
{
SendClientMessage(playerid, grey, " That name is already registered");
fclose(file);
return 1;
}
new File:hFile;
hFile = fopen(string, io_append);
new var[32];//
format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
format(var, 32, "Level:%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 32, "Exp:%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
format(var, 32, "Cash:%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
fclose(hFile);
SendClientMessage(playerid, white, "Succesfully Registered!");
SendClientMessage(playerid, white, "Next time when you come , use /login [ password ].");
OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
return 1;
}

Quote:

if (strcmp(cmd, "/login", true) ==0 )
{
if(IsPlayerConnected(playerid))
{
new tmppass[64];
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, grey, " You are already logged in.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, grey, " USAGE: /login [password]");
return 1;
}
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
String(tmppass);
OnPlayerLogin(playerid,tmppass);
}
return 1;
}




Re: Register/login syste - Stm - 24.05.2012

Thank you


Re: Register/login syste - Stm - 24.05.2012

D:\samp03e_svr_win32\gamemodes\FAILS.pwn(212) : error 017: undefined symbol "tmp"
D:\samp03e_svr_win32\gamemodes\FAILS.pwn(212) : error 017: undefined symbol "strtok"
D:\samp03e_svr_win32\gamemodes\FAILS.pwn(214) : error 017: undefined symbol "tmp"
D:\samp03e_svr_win32\gamemodes\FAILS.pwn(219) : error 017: undefined symbol "gPlayerAccount"
D:\samp03e_svr_win32\gamemodes\FAILS.pwn(219) : warning 215: expression has no effect
D:\samp03e_svr_win32\gamemodes\FAILS.pwn(219) : error 001: expected token: ";", but found "]"
D:\samp03e_svr_win32\gamemodes\FAILS.pwn(219) : error 029: invalid expression, assumed zero
D:\samp03e_svr_win32\gamemodes\FAILS.pwn(219) : fatal error 107: too many error messages on one line


Ummmm Help.Im sorry but im new in scripting and im sure that there is simple solution for this but what is it ?


Re: Register/login syste - vvhy - 24.05.2012

That is an example you can't just put it in your script, you might just want to download an account system.
here is one that is also an admin system https://sampforum.blast.hk/showthread.php?tid=255513


Re: Register/login syste - Stm - 24.05.2012

Ok Thanks


Re: Register/login syste - qinaixiuor - 24.05.2012

Ok Thanks