Register/login syste
#1

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

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

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;
}

Reply
#4

Thank you
Reply
#5

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 ?
Reply
#6

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
Reply
#7

Ok Thanks
Reply
#8

Ok Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)