30.06.2012, 16:11
hello, i get these errors in my console
and here is the gamemode im running:
Код:
7:09:32] Error: Function not registered: 'mysql_connect' [17:09:32] Error: Function not registered: 'mysql_query' [17:09:32] Error: Function not registered: 'mysql_store_result' [17:09:32] Error: Function not registered: 'mysql_num_rows' [17:09:32] Error: Function not registered: 'mysql_free_result' [17:09:32] Error: Function not registered: 'mysql_real_escape_string' [17:09:32] Error: Function not registered: 'mysql_fetch_row_format'
pawn Код:
// i take hardly any credits for the include as i made only 50% of it
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*\
|| ||
|| Started Creating on the 22nd June 2012 By Brennan Butler (brennan9723@hotmail.com). ||
|| This is a script for SFCNR(San Fierro Cops And Robbers) ||
|| This game mode is using mysql for better saving and a custom ucp ||
|| ||
|| ||
\*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
//==============================[INCLUDES]======================================//
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <a_mysql>
#include <streamer>
#include <foreach>
#include <sfcnr>
//============================[FORWADS]=========================================//
//============================[DEFINES]==========================================//
#define DIALOG_REG 1
#define DIALOG_LOG 2
#define DIALOG_ADMIN 3
#define COLOR_ORANGE 0xFF8000FF
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BLUE1 0x0066FFFF
#define COLOR_RED 0xAA3333AA
#define COLOR_RED2 0xFF0000FF
#define COLOR_REALRED 0xFF0606FF
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_VIP 0xC93CCE00
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_BLACK 0x000000AA
#define COLOR_MAROON #800000
//================================[MYSQL]===============================================//
#define mysql_host "localhost"
#define mysql_user "root"
#define mysql_password ""
#define mysql_database "sfcnr"
//============================[CLASS DEFINES]==========================================//
#define STAT 1
#define SWAT 2
#define ARMY 3
#define POLICE 4
#define CIVILIAN 5
#define MECHANIC 6
#define PARAMEDIC 7
#define HITMAN 8
#define COLOR_STAT COLOR_ORANGE
#define COLOR_SWAT COLOR_LIGHTBLUE
#define COLOR_ARMY COLOR_TAN
#define COLOR_POLICE COLOR_BLUE
#define COLOR_CIVILIAN COLOR_WHITE
#define COLOR_MECHANIC COLOR_GREY
#define COLOR_PARAMEDIC COLOR_INDIGO
#define COLOR_HITMAN COLOR_WHITE
new gTeam[MAX_PLAYERS];
main()
{
print("\n||====================================================||");
print("|| Sfcnr Include made by brennan butler(not all) ||");
print("|| only for the use of sfcnr made by Brennan &||");
print("|| Josip ||");
print("||====================================================||\n");
print("\n*********************************");
print(" San Fierro Cops And Robbers");
print(" Owned by thefatshizms and Joseph");
print(" devolped by thefatshizms");
print("**********************************\n");
}
enum PInfo
{
Pusername[25],
Ppassword[24],
Pscore,
Pmoney,
Pbank,
Pstat,
Parmy,
Pswat,
Padmin,
Pcop,
Pregdate,
Preg,
Plog,
Preport,
Pwarned,
Pprison,
Phelper,
Pemail[255],
Pvip,
Ptime,
Parrest,
Psurender,
Prob,
Prape,
Pheal,
Phitmanlvl,
Psales,
Pwepd,
Pgmem,
Pgown,
Ptruck,
}
new PlayerInfo[MAX_PLAYERS][PInfo];
public OnGameModeInit()
{
SetGameModeText("Cops And Robbers");
AddPlayerClass(0,-2237.7124,2353.5083,4.9804,134.5635,0,0,0,0,0,0);// stat spawn
AddPlayerClass(0,-1345.5194,500.1661,18.2344,10.9961,0,0,0,0,0,0);// army spawn
AddPlayerClass(0,-993.0158,-700.1477,32.0078,5.8923,0,0,0,0,0,0);// swat
AddPlayerClass(0,-1397.8112,-313.0121,14.1484,124.1484,0,0,0,0,0,0);//driver
AddPlayerClass(0,-2079.6611,-482.9718,38.7344,180.8663,0,0,0,0,0,0);// civilian 1
AddPlayerClass(0,-2718.9888,-318.4344,7.8438,55.5373,0,0,0,0,0,0);// civilian 2
AddPlayerClass(0,-2765.9897,375.4386,6.3347,278.5965,0,0,0,0,0,0);// civilian 3
AddPlayerClass(0,-2767.3179,788.7258,52.7813,262.3263,0,0,0,0,0,0);// civilian 4
AddPlayerClass(0,-2442.7800,752.9677,35.1719,179.2369,0,0,0,0,0,0); // civilian 5
AddPlayerClass(0,-2359.2136,1006.7867,50.6953,87.5064,0,0,0,0,0,0);// civilian 6
AddPlayerClass(0,-1725.3872,1356.5693,7.1799,107.8884,0,0,0,0,0,0);// civilian 7
AddPlayerClass(0,-1985.3896,665.8715,46.5683,275.6404,0,0,0,0,0,0);// civilian 8
AddPlayerClass(0,-2383.1177,-584.4406,132.1172,90.4442,0,0,0,0,0,0);// civilian 9
AddPlayerClass(0,-1989.2987,1118.1178,54.4688,272.2214,0,0,0,0,0,0);// civilian 10
AddPlayerClass(0,-2651.2454,609.7889,14.4531,191.8591,0,0,0,0,0,0);// medic
AddPlayerClass(0,-2126.3201,239.8671,37.3500,292.8224,0,0,0,0,0,0);// terosist
AddPlayerClass(0,-2030.6611,156.5619,28.8359,272.7437,0,0,0,0,0,0);// mechanic
AddPlayerClass(0,-1712.3699,7.4375,3.5547,316.8104,0,0,0,0,0,0);// hitman
mysql_connect(mysql_host,mysql_user,mysql_database,mysql_password);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
new Query[80],string[164];
GetPlayerName(playerid,PlayerName(playerid),24);
format(Query,sizeof(Query),"SELECT `Username` FROM `Users` WHERE `Username` = '%s' LIMIT 1;",PlayerName(playerid));
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)//if number of rows is different from 0 then continue
{
format(string,sizeof(string),"Hey, %s! \nYour account is registered.\nPlease enter the password to log in!",PlayerName(playerid));
ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Log in",string,"Login","");
}
else
{
format(string,sizeof(string),"Hey, %s! \nYour account is not registered. \nPlease register to continue!",PlayerName(playerid));
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register",string,"Register","");
}
mysql_free_result();
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
/*public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
*/
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have entered a vehicle use /v for the vehicle menu");
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)
{
if(!success) {
printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
new pip[16];
foreach(Player,i) {
GetPlayerIp(i, pip, sizeof(pip));
if(!strcmp(ip, pip, true)) {
SendClientMessage(i, 0xFFFFFFFF, "Wrong Password.");
Ban(i);
}
}
}
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[])
{
if(dialogid == 1)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid,DIALOG_REG,DIALOG_STYLE_INPUT,"Register - Enter your password.","You're about to register a new account! \nPlease choose the password {33CCFF}for it!","Register!","Cancel!");
}
else
{
new EscapedText[60], Query[80];
mysql_real_escape_string(inputtext, EscapedText);
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Money) VALUES ('%s','%s,'0')",PlayerName(playerid),EscapedText);
mysql_query(Query);
SendClientMessage(playerid,-1,"You have been successfully registered!");
GivePlayerMoney(playerid,5000);
SetPlayerScore(playerid,100);
}
}
if(dialogid == 0)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid,DIALOG_REG,DIALOG_STYLE_INPUT,"Register - Enter your password","You are about to register a new account! \nPlease choose the password for it! \n","Register!","");
}
else
{
LoginPlayer(playerid,inputtext);
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
//======================================[COMMANDS]==================================//
CMD:me(playerid, params[])
{
new msg[100];
if(sscanf(params,"s[100]",msg)) return SendClientMessage(playerid, -1, "USAGE: /me <messaage>");
if(GetPlayerMoney(playerid) < 30) return SendClientMessage(playerid, COLOR_RED, "You dont have enough cash");
GivePlayerMoney(playerid, -30);
format(msg, sizeof(msg), "** %s: %s", PlayerName(playerid), msg);
SendClientMessageToAll(COLOR_PURPLE, msg);
return 1;
}
CMD:pm(playerid, params[]) {
new ID, string[128], msg[56], string2[128];
if(sscanf(params,"us[56]",ID,msg)) return SendClientMessage(playerid,0xA70000FF,"Syntax: /PM [ID] [Message].");
format(string,sizeof(string),"** PM to %s: {A70000}%s",PlayerName(ID),msg);
SendClientMessage(playerid,0xFFFFFFFF,string);
format(string2,sizeof(string2),"** PM from %s: {A70000}%s",PlayerName(playerid),msg);
SendClientMessage(ID, 0xFFFFFFFF, string2);
GameTextForPlayer(playerid, "~r~PM ~b~sent!", 3000, 1);
GameTextForPlayer(ID, "~r~PM ~b~recived!", 3000, 1);
return true;
}
//==================================[ADMIN SYSTEM]===================================//
//================================[COMMANDS FOR TESTING]==========================//
CMD:cash(playerid, params[])
{
new ammount;
if(sscanf(params,"i",ammount)) return SendClientMessage(playerid, -1, "USAGE: /cash <ammount>");
GivePlayerMoney(playerid, ammount);
return 1;
}
stock LoginPlayer(playerid,const password[])
{
new EscapedText[60];
new Query[80];
mysql_real_escape_string(password, EscapedText);
format(Query,sizeof(Query),"SELECT * FROM `Users` WHERE `Username` = '%s' AND `Password` = '%s'",PlayerName(playerid),EscapedText);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
SendClientMessage(playerid,-1,"You have been logged in!");
LoadStats(playerid);
}
else
{
SendClientMessage(playerid,-1,"Wrong password!");
Kick(playerid);
}
mysql_free_result();
return 1;
}
stock LoadStats(playerid)
{
new pName[24],Query[80];
GetPlayerName(playerid,pName,24);
format(Query, sizeof(Query), "SELECT * FROM `Users` WHERE `Username` = '%s' ", pName);
mysql_query(Query);
mysql_store_result();
mysql_fetch_row_format(Query, "|");
sscanf(Query, "e<p<|>s[24]s[23]i>", PlayerInfo[playerid][Pusername]);
mysql_free_result();
GivePlayerMoney(playerid,PlayerInfo[playerid][Pmoney]);
return 1;
}