03.08.2012, 15:20
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:
And, this is the script self.
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
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.
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;
}
//==============================================================================
Anyone that can help me out of this?,
Thank you