Registration + (auto) Login [problem] -
mickos - 03.08.2012
Hey guys,
Today I tried to make an Register + (Auto) login system,
But it wont work I didnt test it because I got errors and I dont know how to fix this, I tried a lot of things, but without any result.
Here are the errors:
PHP код:
C:\Users\Edward\Desktop\PlanetS\pawno\KamAdminOF.pwn(87) : error 017: undefined symbol "str"
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(89) : error 017: undefined symbol "y_ini_Get"
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(89) : error 033: array must be indexed (variable "tmp2")
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(90) : error 017: undefined symbol "tmpip"
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(92) : error 017: undefined symbol "Login"
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(99) : error 029: invalid expression, assumed zero
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(103) : warning 217: loose indentation
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(110) : warning 217: loose indentation
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(110) : error 029: invalid expression, assumed zero
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(110) : error 004: function "S@@_OnPlayerDisconnect" is not implemented
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(130) : warning 225: unreachable code
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(130) : error 029: invalid expression, assumed zero
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(130) : error 004: function "S@@_OnPlayerDeath" is not implemented
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(132) : error 017: undefined symbol "killerid"
C:\Users\Edward\Desktop\Samp\pawno\RegLogin.pwn(157) : error 030: compound statement not closed at the end of file (started at line 86)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
12 Errors.
And, this is the script self.
PHP код:
#include <a_samp>
#include <YSI\y_ini>
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Defines
//------------------------------------------------------------------------------
#define COLOR_GREEN 0x00FF04FF
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFB00FF
#define COLOR_ORANGE 0xFFA200FF
#define COLOR_GREY 0xBABABAFF
#define PATH "/Users/%s.ini"
//------------------------------------------------------------------------------
enum pInfo
{
pPass,
pSkin,
pColor,
pCash,
pAdmin,
pKills,
pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
//------------------------------------------------------------------------------
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Color",PlayerInfo[playerid][pColor]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}
//------------------------------------------------------------------------------
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
//------------------------------------------------------------------------------
stock udb_hash(buf[]){
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// OnPlayerConnect (Register, Login, Auto Login...
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
if(fexist(str))
{
new tmp2[256]; tmp2 = y_ini_Get(str,"ip");
if(!strcmp(tmpip,tmp2,true))
{
Login(playerid);
SendClientMessage(playerid,COLOR_GREEN,"You have been automatically logged in.");
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"Welcome, you are NOT registered. Please /register.");
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"There was something wrong, you are not automatically logged in. Please /login.");
}
return 1;
}
//------------------------------------------------------------------------------
// OnPlayerDisconnect
//------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Color",GetPlayerColor(playerid));
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// OnPlayerDeath +kills +Deaths etc..
//------------------------------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
//==============================================================================
Missing some things? I think yes but I still didnt know what, and I dont know how to fix this..
Anyone that can help me out of this?,
Thank you
Re: Registration + (auto) Login [problem] -
[MM]RoXoR[FS] - 03.08.2012
I hope that script you gave us was not full.
I did not found any commands, functions.
This is the max thing I can fix.
pawn Код:
#include <a_samp>
#include <YSI\y_ini>
#include <ZCMD>
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Defines
//------------------------------------------------------------------------------
#define COLOR_GREEN 0x00FF04FF
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFB00FF
#define COLOR_ORANGE 0xFFA200FF
#define COLOR_GREY 0xBABABAFF
#pragma tabsize 0
#define PATH "/Users/%s.ini"
//------------------------------------------------------------------------------
enum pInfo
{
pPass,
pSkin,
pColor,
pCash,
pAdmin,
pKills,
pDeaths,
pIP[20]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
//------------------------------------------------------------------------------
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Color",PlayerInfo[playerid][pColor]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}
//------------------------------------------------------------------------------
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
//------------------------------------------------------------------------------
stock udb_hash(buf[]){
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// OnPlayerConnect (Register, Login, Auto Login...
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new tmpip[20];
GetPlayerIp(playerid,tmpip,20);
if(!strcmp(tmpip,PlayerInfo[playerid][pIP],true))
{
Login(playerid);
SendClientMessage(playerid,COLOR_GREEN,"You have been automatically logged in.");
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"There was something wrong, you are not automatically logged in. Please /login.");
}
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"Welcome, you are NOT registered. Please /register.");
}
return 1;
}
//------------------------------------------------------------------------------
// OnPlayerDisconnect
//------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Color",GetPlayerColor(playerid));
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// OnPlayerDeath +kills +Deaths etc..
//------------------------------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
//==============================================================================
Also, when player login/register add
pawn Код:
GetPlayerIp(playerid,PlayerInfo[playerid][pIP],20);
for auto login feature.
Re: Registration + (auto) Login [problem] -
mickos - 03.08.2012
No the script that I just sended is not full he is not finished:P
Thanks for help I go test it now
Ty
Re: Registration + (auto) Login [problem] -
mickos - 03.08.2012
Ok, I got it so:
PHP код:
#include <a_samp>
#include <YSI\y_ini>
#include <ZCMD>
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Defines
//------------------------------------------------------------------------------
#define COLOR_GREEN 0x00FF04FF
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFB00FF
#define COLOR_ORANGE 0xFFA200FF
#define COLOR_GREY 0xBABABAFF
#pragma tabsize 0
#define PATH "/Users/%s.ini"
//------------------------------------------------------------------------------
enum pInfo
{
pPass,
pSkin,
pColor,
pCash,
pAdmin,
pKills,
pDeaths,
pIP[20]
}
new PlayerInfo[MAX_PLAYERS][pInfo];
//------------------------------------------------------------------------------
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Color",PlayerInfo[playerid][pColor]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}
//------------------------------------------------------------------------------
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
//------------------------------------------------------------------------------
stock udb_hash(buf[]){
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// OnPlayerConnect (Register, Login, Auto Login...
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new tmpip[20];
GetPlayerIp(playerid,tmpip,20);
if(!strcmp(tmpip,PlayerInfo[playerid][pIP],true))
{
Login(playerid);
SendClientMessage(playerid,COLOR_GREEN,"You have been automatically logged in.");
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"There was something wrong, you are not automatically logged in. Please /login.");
}
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"Welcome, you are NOT registered. Please /register.");
}
return 1;}
//------------------------------------------------------------------------------
// OnPlayerDisconnect
//------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Color",GetPlayerColor(playerid));
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// OnPlayerDeath +kills +Deaths etc..
//------------------------------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
//==============================================================================
//------------------------------------------------------------------------------
// Register command (/register)
//------------------------------------------------------------------------------
CMD:register(playerid,params[])
{
new name[90];
GetPlayerIp(playerid,PlayerInfo[playerid][pIP],20);
GetPlayerName(playerid,name,sizeof(name));
if (pInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_GREEN,"You have been succesfully logged in.");
if (udb_Exists(name)) return SendClientMessage(playerid,COLOR_ORANGE,"Sorry, this account is already exists, please login or choose another nickname.");
if (strlen(params) == 0) return SendClientMessage(playerid,COLOR_ORANGE,"You must be type /register <password>");
if (udb_Create(name,params))
{
new file[256],ip[100],tmp[260];
GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"%s.ini",udb_encode(name));
GetPlayerIp(playerid,ip,100);
dini_Set(file,"ip",tmp);
dUserSetINT(name).("Skin",0);
dUserSetINT(name).("Color",0);
dUserSetINT(name).("Cash",0);
dUserSetINT(name).("Admin",0);
dUserSetINT(name).("Kills",0);
dUserSetINT(name).("Deaths",0);
Stats[playerid][LoggedIn] = 1;
SendClientMessage(playerid,COLOR_GREEN, "You have been succesfully registered and logged in.");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
return 1;
}
return 1;
}
//------------------------------------------------------------------------------
// Login command (/login)
//------------------------------------------------------------------------------
CMD:login(playerid,params[])
{
new name[24];
GetPlayerIp(playerid,PlayerInfo[playerid][pIP],20);
GetPlayerName(playerid,name,sizeof(name));
if (Stats[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_ORANGE,"Sorry, you are already logged in.");
if (!udb_Exists(name)) return SendClientMessage(playerid,COLOR_ORANGE,"This account doesn't exist, please use /register <password>.");
if (strlen(params)==0) return SendClientMessage(playerid,COLOR_ORANGE,"You must be type login <password>");
if (udb_CheckLogin(name,params))
{
new file[256], tmp3[100];
format(file,sizeof(file),"%s.ini",udb_encode(name));
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
Login(playerid);
SendClientMessage(playerid,COLOR_GREEN,"You have been successfully logged in");
}
else
{
Failed[playerid]++;
if(Failed[playerid] == 5)
{
new string[128];
format(string, sizeof(string), "%s has been kicked for bad login attempts.",name);
SendClientMessageToAll(COLOR_RED, string);
Kick(playerid);
}
return SendClientMessage(playerid,COLOR_ORANGE,"Login failed! incorrect password.");
}
return 1;
}
I have just add a /register and /login command, and I have added the ip check in the /register and /login command.
but I got errors...
Namely:
PHP код:
C:\Users\Edward\Desktop\Samp\pawno\RegLog.pwn(79) : error 017: undefined symbol "Login"
C:\Users\Edward\Desktop\Samp\pawno\RegLog.pwn(128) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Users\Edward\Desktop\Samp\pawno\RegLog.pwn(128) : warning 215: expression has no effect
C:\Users\Edward\Desktop\Samp\pawno\RegLog.pwn(128) : error 001: expected token: ";", but found "]"
C:\Users\Edward\Desktop\Samp\pawno\RegLog.pwn(128) : error 029: invalid expression, assumed zero
C:\Users\Edward\Desktop\Samp\pawno\RegLog.pwn(128) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
5 Errors.
Re: Registration + (auto) Login [problem] -
[MM]RoXoR[FS] - 03.08.2012
I am sure what you are doing is copy pasting script from somewhere without even knowing what it does.
I can surely say that wont work.
I suggest you to start from Basics.
Here, I fixed your code
pawn Код:
#include <a_samp>
#include <YSI\y_ini>
#include <ZCMD>
#include <dudb>
#include <dini>
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//Defines
//------------------------------------------------------------------------------
#define COLOR_GREEN 0x00FF04FF
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFB00FF
#define COLOR_ORANGE 0xFFA200FF
#define COLOR_GREY 0xBABABAFF
#pragma tabsize 0
#define PATH "/Users/%s.ini"
//------------------------------------------------------------------------------
enum pInfo
{
pPass,
pSkin,
pColor,
pCash,
pAdmin,
pKills,
pDeaths,
pIP[20],
LoggedIn
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new Failed[MAX_PLAYERS];
//------------------------------------------------------------------------------
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Color",PlayerInfo[playerid][pColor]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
return 1;
}
//------------------------------------------------------------------------------
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
//------------------------------------------------------------------------------
/*stock udb_hash(buf[]){
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}*/
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// OnPlayerConnect (Register, Login, Auto Login...
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new tmpip[20];
GetPlayerIp(playerid,tmpip,20);
if(!strcmp(tmpip,PlayerInfo[playerid][pIP],true))
{
SendClientMessage(playerid,COLOR_GREEN,"You have been automatically logged in.");
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"There was something wrong, you are not automatically logged in. Please /login.");
}
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"Welcome, you are NOT registered. Please /register.");
}
return 1;}
//------------------------------------------------------------------------------
// OnPlayerDisconnect
//------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
INI_WriteInt(File,"Color",GetPlayerColor(playerid));
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// OnPlayerDeath +kills +Deaths etc..
//------------------------------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
//==============================================================================
//------------------------------------------------------------------------------
// Register command (/register)
//------------------------------------------------------------------------------
CMD:register(playerid,params[])
{
new name[90];
GetPlayerIp(playerid,PlayerInfo[playerid][pIP],20);
GetPlayerName(playerid,name,sizeof(name));
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_GREEN,"You have been succesfully logged in.");
if (udb_Exists(name)) return SendClientMessage(playerid,COLOR_ORANGE,"Sorry, this account is already exists, please login or choose another nickname.");
if (strlen(params) == 0) return SendClientMessage(playerid,COLOR_ORANGE,"You must be type /register <password>");
if (udb_Create(name,params))
{
new file[256],ip[100],tmp[260];
GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"%s.ini",udb_encode(name));
GetPlayerIp(playerid,ip,100);
dini_Set(file,"ip",tmp);
dUserSetINT(name).("Skin",0);
dUserSetINT(name).("Color",0);
dUserSetINT(name).("Cash",0);
dUserSetINT(name).("Admin",0);
dUserSetINT(name).("Kills",0);
dUserSetINT(name).("Deaths",0);
PlayerInfo[playerid][LoggedIn] = 1;
SendClientMessage(playerid,COLOR_GREEN, "You have been succesfully registered and logged in.");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
return 1;
}
return 1;
}
//------------------------------------------------------------------------------
// Login command (/login)
//------------------------------------------------------------------------------
CMD:login(playerid,params[])
{
new name[24];
GetPlayerIp(playerid,PlayerInfo[playerid][pIP],20);
GetPlayerName(playerid,name,sizeof(name));
if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_ORANGE,"Sorry, you are already logged in.");
if (!udb_Exists(name)) return SendClientMessage(playerid,COLOR_ORANGE,"This account doesn't exist, please use /register <password>.");
if (strlen(params)==0) return SendClientMessage(playerid,COLOR_ORANGE,"You must be type login <password>");
if (udb_CheckLogin(name,params))
{
new file[256], tmp3[100];
format(file,sizeof(file),"%s.ini",udb_encode(name));
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
SendClientMessage(playerid,COLOR_GREEN,"You have been successfully logged in");
}
else
{
Failed[playerid]++;
if(Failed[playerid] == 5)
{
new string[128];
format(string, sizeof(string), "%s has been kicked for bad login attempts.",name);
SendClientMessageToAll(COLOR_RED, string);
Kick(playerid);
}
return SendClientMessage(playerid,COLOR_ORANGE,"Login failed! incorrect password.");
}
return 1;
}
Re: Registration + (auto) Login [problem] -
mickos - 03.08.2012
Thanks, nah it isnt copying:P
Me and me friend just created it:P
Thx man plus rep for you