/*
SA-MP MySQL plugin R5
Copyright © 2008-2010, G-sTyLeZzZ
*/
#if defined mysql_included
#endinput
#endif
#define mysql_included
//Common error codes (http://dev.mysql.com/doc/refman/5.0/en/error-messages-(client|server).html)
#define ER_DBACCESS_DENIED_ERROR 1044
#define ER_ACCESS_DENIED_ERROR 1045
#define ER_UNKNOWN_TABLE 1109
#define ER_SYNTAX_ERROR 1149
#define CR_SERVER_GONE_ERROR 2006
#define CR_SERVER_LOST 2013
#define CR_COMMAND_OUT_OF_SYNC 2014
#define CR_SERVER_LOST_EXTENDED 2055
//Native functions
#define mysql_fetch_row(%1) mysql_fetch_row_format(%1,"|")
#define mysql_next_row() mysql_retrieve_row()
#define mysql_get_field(%1,%2) mysql_fetch_field_row(%2,%1)
native mysql_affected_rows(connectionHandle = 1);
native mysql_close(connectionHandle = 1);
native mysql_connect(const host[],const user[],const database[],const password[]);
native mysql_debug(enable = 1);
native mysql_errno(connectionHandle = 1);
native mysql_fetch_int(connectionHandle = 1);
native mysql_fetch_field(number,dest[],connectionHandle = 1);
native mysql_fetch_field_row(string[],const fieldname[],connectionHandle = 1);
native mysql_fetch_float(&Float:result,connectionHandle = 1);
native mysql_fetch_row_format(string[],const delimiter[] = "|",connectionHandle = 1);
native mysql_field_count(connectionHandle = 1);
native mysql_free_result(connectionHandle = 1);
native mysql_get_charset(destination[],connectionHandle = 1);
native mysql_insert_id(connectionHandle = 1);
native mysql_num_rows(connectionHandle = 1);
native mysql_num_fields(connectionHandle = 1);
native mysql_ping(connectionHandle = 1);
native mysql_query(query[],resultid = (-1),extraid = (-1),connectionHandle = 1);
native mysql_query_callback(index,query[],callback[],extraid = 0,connectionHandle = 1);
native mysql_real_escape_string(const source[],destination[],connectionHandle = 1);
native mysql_reconnect(connectionHandle = 1);
native mysql_reload(connectionHandle = 1);
native mysql_retrieve_row(connectionHandle = 1);
native mysql_set_charset(charset[],connectionHandle = 1);
native mysql_stat(const destination[],connectionHandle = 1);
native mysql_store_result(connectionHandle = 1);
native mysql_warning_count(connectionHandle = 1);
//forward declarations
forward OnQueryFinish(query[], resultid, extraid, connectionHandle);
forward OnQueryError(errorid, error[], resultid, extraid, callback[], query[], connectionHandle);
You will need to show us the part of the script that would show this error and anything related to it.
|
}
public OnGameModeInit()
{
InitMapSystem();
EnableStuntBonusForAll(0);
DisableInteriorEnterExits();
SetTimer("UpdateTextdraw", 1000, true);
SetTimer("AntiCheat", 1000, true);
SetTimer("timer_update",14400,true);
gettime(ghour, gminute, gsecond);
FixHour(ghour);
ghour = shifthour;
//------ Textdraws
//------ clock
Clockzz = TextDrawCreate(549.000000,38.000000,"00:00");
TextDrawAlignment(Clockzz,0);
TextDrawBackgroundColor(Clockzz,0x000000ff);
TextDrawFont(Clockzz,2);
TextDrawLetterSize(Clockzz,0.499999,3.199999);
TextDrawColor(Clockzz,0x00ffff99);
TextDrawSetOutline(Clockzz,1);
TextDrawSetProportional(Clockzz,1);
TextDrawSetShadow(Clockzz,1);
//------ Advertisement
AdTextdraw = TextDrawCreate(1.000000, 433.000000, "[Ad] Make an advertisement via /advertisement!");
TextDrawBackgroundColor(AdTextdraw, 0x000000ff);
TextDrawFont(AdTextdraw, 1);
TextDrawLetterSize(AdTextdraw, 0.300000, 1.500000);
TextDrawColor(AdTextdraw, -1);
TextDrawSetOutline(AdTextdraw, 0);
TextDrawSetProportional(AdTextdraw, 1);
TextDrawSetShadow(AdTextdraw, 1);
TextDrawUseBox(AdTextdraw, 1);
TextDrawBoxColor(AdTextdraw, 0x00000033);
TextDrawTextSize(AdTextdraw, 653.000000, 0.000000);
//-----End of textdraws
SetTimer("UpdateClock", 1000, true); //ANTI-CHEAT IN THIS.
SetTimer("ChangeWeather", 720000, true);
SetTimer("RandomMsg", 600000, true);
ConnectMySQL();
new mapname[75];
format(mapname,sizeof(mapname),"mapname %s",revision);
SendRconCommand(mapname);
SetGameModeText("Life of Flying");
new SendCommand[156]; // I don't want to count the letters, do it yourself
format(SendCommand, sizeof(SendCommand), "hostname %s", HOSTNAME); // Format the command into a string.
SendRconCommand(SendCommand); // Execute the command through Rcon.
LoadAirline(1);
LoadAirline(2);
LoadAirline(3);
LoadAirline(4);
LoadAirline(5);
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
SetWorldTime(tmphour);
randomtimer = SetTimer("RandomTimer", 1000, 1);
onlinetimer = SetTimer("OnlineTimer", 60000, 1); //DYNAMIC SIG TIMER IS IN THIS!!
LoadObjects();
AddAirlineVehiclesSTART();
AddHousesFromSQL();
AddVehiclesFromSQL();
AddPlayerVehicles();
AddMapIcons();
LoadStuff(); // Load the data, MOTD, etc.
LoadTextdraws();
for(new i=0;i<MAX_VEHICLES;i++) {
vfuel[i] = 100; //set fuel to 100 percent
}
SetTimer("UpdateIRC", 5000, true);
return 1;
public OnPlayerConnect(playerid)
{
PlayersOnline++;
SessionStatus[playerid] = 1; //Connected. Do not show messages.
if(GlobalStatus == 2)
{
SendClientMessage(playerid, COLOR_SECURITY, "A MySQL error has occured. Please visit the forums for further details.");
Kick(playerid);
}
if(PlayersOnline > ServerMaxPlayers && sTrackPlayers == 1)
{
new msg[256];
format(msg,sizeof(msg),"Life of Flying has reached a new top player count! (Previously %d online players at %s - %s)",ServerMaxPlayers,ServerMaxPlayersDate,ServerMaxPlayersTime);
SendClientMessageToAll(COLOR_VIP, msg);
ServerMaxPlayers = PlayersOnline;
new date,month,year;
getdate(date,month,year);
new hour,minute,second;
gettime(hour,minute,second);
new string[128];
format(string,sizeof(string),"%d/%d/%d",year,month,date);
strmid(ServerMaxPlayersDate, string, 0, strlen(string), 128);
format(string,sizeof(string),"%d:%d:%d",hour,minute,second);
strmid(ServerMaxPlayersTime, string, 0, strlen(string), 128);
SaveStuff();
}
CheckIPS(playerid);
PurelySpawned[playerid] = 0;
ResetMissionData(playerid);
ResetPlayerData(playerid);
CheckBanned(playerid);
RemoveObjectsForPlayer(playerid);
ResetPlayerData(playerid);
UpdatePlayerColour(playerid);
TextDrawShowForPlayer(playerid, Clockzz);
MapSystemAddPlayer(playerid);
PlayerPlaySound(playerid, 1187, 0, 0, 0); // Start the music
if(PlayerLogged[playerid] == 0)
{
mysql_reconnect();
new Query[90], EscName[MAX_PLAYER_NAME];
mysql_real_escape_string(PlayerName(playerid), EscName);
format(Query, sizeof(Query), "SELECT NULL FROM `users` WHERE `username` = '%s'", EscName);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
mysql_free_result();
SendClientMessage(playerid, COLOR_SECURITY, "Please enter your password below to continue.");
DisplayDialogForPlayer(playerid, 1);
return 0;
}
else
{
PlayerPlaySound(playerid, 44204, 0, 0, 0);
mysql_free_result();
SendClientMessage(playerid, COLOR_SECURITY, "Please enter a password below to register an account.");
DisplayDialogForPlayer(playerid, 2);
return 0;
}
}
return 1;
}