25.09.2011, 17:54
Im nab for Mysql Please help me with my error
Код:
E:\.....\filterscripts\...pwn(74 -- 90) : error 075: input line too long (after substitutions) E:\......\filterscripts\..pwn(91) : warning 217: loose indentation E:\.......\filterscripts\..pwn(91) : warning 215: expression has no effect E:\.....\filterscripts\..pwn(91) : error 001: expected token: ";", but found ")" E:\......\filterscripts\..pwn(91) : error 029: invalid expression, assumed zero E:\......\filterscripts\..pwn(91) : error 017: undefined symbol "ENGINE" E:\........\filterscripts\..pwn(91) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors.
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#include <a_mysql>
#include <sscanf2>
//========================= [MySQL Database Settings] ==========================
#define mysql_host ""//the IP of the host, should be displayed when created a database
#define mysql_user ""//database username
#define mysql_password ""//database password
#define mysql_database ""//database name
//========================= [MySQL Database Settings] ==========================
//============================ [Colors] ========================================
#define white 0xFFFFFFFF
#define blue 0x0073FFFF
#define liblue 0x00FFFFFF
#define green 0x00E228FF
#define ligreen 0x00FF28FF
#define green2 0x9BFF00FF
#define limegreen 0x00FF96FF
#define pink 0xFFAFD7FF
#define purple 0xDB00AFFF
#define yellow 0xF5FF00FF
#define orange 0xFFA000FF
#define red 0xFF0000FF
//============================ [Colors] ========================================
//============================ [Hex] ===========================================
#define cwhite "{FFFFFF}"
#define cblue "{00B9FF}"
#define cliblue "{00FFFA}"
#define cgreen "{05E200}"
#define cligreen "{05FF00}"
#define cgreen2 "{A5FF00}"
#define cpink "{FFA4C3}"
#define cpurple "{E500C3}"
#define cyellow "{FFFA00}"
#define cyellow2 "{FFFF11}"
#define corange "{FF9600}"
#define cred "{FF0000}"
//============================ [Hex] ===========================================
#define Logindialog 1
#define Regdialog 2
#define Reginfo 3
enum pInfo
{
AccID,
Username[24],
Password[129],
Ip[16],
Money,
Score,
Kills,
Deaths,
Logged,
FailedLogins,
FirstSpawn,
Donator,
Admin,
Plantedbombs,
Defusedbombs,
Banned,
Pending
};
native WP_Hash(buffer[], len, const str[]);
new PlayerInfo[MAX_PLAYERS][pInfo];
new Query[450];
public OnFilterScriptInit()
{
mysql_debug(1);
mysql_connect(mysql_host,mysql_user,mysql_database,mysql_password);
mysql_query(
"CREATE TABLE IF NOT EXISTS `Accounts` ("\
"`AccID` int(10) NOT NULL AUTO_INCREMENT,"\
"`Username` varchar(24) NOT NULL,"\
"`Password` varchar(64) NOT NULL,"\
"`IP` varchar(16) NULL,"\
"`Money` int(15) NULL,"\
"`Score` int(15) NULL,"\
"`Kills` int(15) NULL,"\
"`Deaths` int(15) NULL,"\
"`Donator` int(15) NULL,"\
"`Admin` int(15) NULL,"\
"`Plantedbombs` int(15) NULL,"\
"`Defusedbombs` int(15) NULL,"\
"`Banned` int(15) NULL,"\
"`Pending` int(15) NULL,"\
"PRIMARY KEY (`AccID`)"\
") ENGINE=InnoDB DEFAULT CHARSET=latin1;");
if(mysql_ping() > -1) return print("MySQL connection to database succeeded!");
else print("MySQL connection to database failed. Please check your database settings!");
return 1;
}
public OnFilterScriptExit()
{
print("Mysql Script Unloaded");
return 1;
}
public OnPlayerConnect(playerid)
{
new string[256];
format(Query,sizeof(Query),"SELECT Username FROM `Accounts` WHERE `Username` = '%s'",GetPName(playerid));
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
format(Query,sizeof Query,"SELECT IP FROM `Accounts` WHERE `Username` = '%s' AND `IP` = '%s'",GetPName(playerid),GetIP(playerid));
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
LoadStats(playerid);
PlayerInfo[playerid][Logged] = 1;
PlaySound(playerid,1057);
SendClientMessage(playerid,green,"» You have been automatically logged in! Welcome back!");
}
else
{
format(string,sizeof(string),""cblue"Hey, "cred"%s"cblue"! \nYour account is "cgreen"registered"cblue".\nPlease enter the "cred"password"cblue" to log in!",GetPName(playerid));
ShowPlayerDialog(playerid,Logindialog,DIALOG_STYLE_INPUT,""cgreen2"Log in",string,"Login","");
}
}
else
{
format(string,sizeof(string),""cblue"Hey, "cred"%s"cblue"! \nYour account is "cred"not registered"cblue". \nPlease "cgreen"register"cblue" to continue!",GetPName(playerid));
ShowPlayerDialog(playerid,Regdialog,DIALOG_STYLE_INPUT,""cpurple"Register",string,"Register","");
}
mysql_free_result();
PlayerInfo[playerid][FirstSpawn] = 1;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerInfo[playerid][Donator] = 20;
if(PlayerInfo[playerid][Logged] == 1) return SaveStats(playerid);
PlayerInfo[playerid][FailedLogins] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][FirstSpawn] == 1 && PlayerInfo[playerid][Logged] == 1)
{
GivePlayerMoney(playerid,PlayerInfo[playerid][Money]);
SetPlayerScore(playerid,PlayerInfo[playerid][Score]);
format(PlayerInfo[playerid][Ip],16,"%s",GetIP(playerid));
PlayerInfo[playerid][FirstSpawn] = 0;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][Kills]++;
PlayerInfo[playerid][Deaths]++;
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case Regdialog:
{
new string[220];
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid,Regdialog,DIALOG_STYLE_INPUT,""cblue"Register - "cyellow"Enter your password",""cblue"You are about to register a "cyellow"new account"cblue"! \nPlease choose the "corange"password"cblue" for it! \n","Register!","");
SendClientMessage(playerid,red,"Please input a password!");
}
else
{
new EscapedText[64],buffer[129];
mysql_real_escape_string(inputtext, EscapedText);
WP_Hash(buffer,sizeof(buffer),EscapedText);
format(Query,sizeof(Query),"INSERT INTO `Accounts` (Username,Password,IP,Money,Score,Kills,Deaths,Donator,Admin,Plantedbombs,Defusedbombs,Banned,Pending) VALUES('%s','%s','%s','0','0','0','0','0','0','0','0','0','0')",GetPName(playerid),buffer,GetIP(playerid));
mysql_query(Query);
mysql_store_result();
SendClientMessage(playerid,green2,"You have been successfully registered!");
format(string,sizeof(string),""cgreen"You have been successfully registered! \n"cwhite"» Your username: "cblue"%s \n"cwhite"» Your password: "cblue"%s \n"cwhite"» Your account ID: "cblue"%i ",GetPName(playerid),inputtext,mysql_insert_id());
ShowPlayerDialog(playerid,Reginfo,0,"Registered!",string,"Ok","");
mysql_free_result();
LoadStats(playerid);
PlayerInfo[playerid][Logged] = 1;
GivePlayerMoney(playerid,5000);
SetPlayerScore(playerid,1);
PlaySound(playerid,1083);
}
}
case Logindialog:
{
if(!response) return Kick(playerid);
if(strlen(inputtext) == 0)
{
new string[220];
format(string,sizeof(string),""cblue"Hey, "cred"%s"cblue"! \nYour account is "cgreen"registered"cblue".\nPlease enter the "cred"password"cblue" to log in!",GetPName(playerid));
ShowPlayerDialog(playerid,Logindialog,DIALOG_STYLE_INPUT,""cgreen2"Log in",string,"Login","");
SendClientMessage(playerid,red,"Please input a password!");
}
else
{
LoginPlayer(playerid,inputtext);
}
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
GetPName(playerid)
{
new pname[24];
GetPlayerName(playerid,pname,24);
return pname;
}
GetIP(playerid)
{
new ip[16];
GetPlayerIp(playerid,ip,16);
return ip;
}
stock PlaySound(playerid,soundid)
{
new Float:p[3];
GetPlayerPos(playerid, p[0], p[1], p[2]);
PlayerPlaySound(playerid, soundid, p[0], p[1], p[2]);
return 1;
}
stock LoadStats(playerid)
{
format(Query, sizeof(Query), "SELECT * FROM `Accounts` WHERE `Username` = '%s'", GetPName(playerid));
mysql_query(Query);
mysql_store_result();
mysql_fetch_row_format(Query, "|");
sscanf(Query, "e<p<|>is[24]s[129]s[16]iiiiiiiiii>", PlayerInfo[playerid]);//Remember to update this if you are going to add more info!
mysql_free_result();
return 1;
}
stock SaveStats(playerid)
{
format(Query,sizeof(Query),"UPDATE `Accounts` SET `IP` = '%s', `Money` = '%i', `Score` = '%i', `Kills` = '%i', `Deaths` = '%i', `Donator` = '%i', `Admin` = '%i', `Plantedbombs` = '%i', `Defusedbombs` = '%i', `Banned` = '%i', `Pending` = '%i' WHERE `Username` = '%s'",
PlayerInfo[playerid][Ip],
GetPlayerMoney(playerid),
GetPlayerScore(playerid),
PlayerInfo[playerid][Kills],
PlayerInfo[playerid][Deaths],
GetPName(playerid));
mysql_query(Query);
mysql_free_result();
return 1;
}
stock LoginPlayer(playerid,const password[])
{
new string[165], buffer[129];
WP_Hash(buffer,sizeof(buffer),password);
format(Query,sizeof(Query),"SELECT Password FROM `Accounts` WHERE `Username` = '%s' AND `Password` = '%s'",GetPName(playerid),buffer);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
format(string,sizeof(string),"You have been logged in! Welcome back, "cred"%s"cgreen"!",GetPName(playerid));
SendClientMessage(playerid,green,string);
LoadStats(playerid);
PlayerInfo[playerid][Logged] = 1;
PlaySound(playerid,1057);
}
else
{
PlayerInfo[playerid][FailedLogins]++;
format(string,sizeof(string),""cred"Attempts left: "corange"%i \n"cblue"Hey, "cred"%s"cblue"! \nYour account is "cgreen"registered"cblue".\nPlease enter the "cred"password"cblue" to log in!",3-PlayerInfo[playerid][FailedLogins],GetPName(playerid));
ShowPlayerDialog(playerid,Logindialog,DIALOG_STYLE_INPUT,""cgreen2"Log in",string,"Login","");
PlaySound(playerid,1055);
if(PlayerInfo[playerid][FailedLogins] == 3)
{
format(string,sizeof(string),"%s has been automatically kicked as he entered the wrong login password 3 times in a row",GetPName(playerid));
SendClientMessageToAll(red,string);
SendClientMessage(playerid,red,"*** You have been kicked as you have entered the wrong login password 3 times!");
PlaySound(playerid,1141);
Kick(playerid);
}
}
mysql_free_result();
return 1;
}