02.07.2009, 21:03
Alrighty, I tried executing a sql query which would put 224*4 variables into a table but when I execute the gamemode I get this... here's my server log..
I Use cng.pwn with a little modification so it executes a mysql query. here's the script:
Please help!
Код:
---------- Loaded log file: "server_log.txt". ---------- SA:MP Dedicated Server ---------------------- v0.2X, ©2005-2008 SA:MP Team [23:59:53] filterscripts = "" (string) [23:59:53] [23:59:53] Server Plugins [23:59:53] -------------- [23:59:53] Loading plugin: Whirpool [23:59:53] Failed. [23:59:53] Loading plugin: sampmysql [23:59:53] /************************************************/ /* SAMP-MySQL v0.14 Plugin loaded successfully ! */ /************************************************/ [23:59:53] Loaded. [23:59:53] Loaded 1 plugins. [23:59:53] [23:59:53] Filter Scripts [23:59:53] --------------- [23:59:53] Loaded 0 filter scripts. [23:59:53] Executing lol(); [23:59:53] Connection to MySQL database: Successfull ! [23:59:53] Error in mysql_query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'0\',\'1\',\'3\',\'1\')' at line 1 [23:59:53] SQL Query #1 FAILED! ... cut out here so it fits in the message limit. all messages are the same, only variables differ. [23:59:53] Error in mysql_query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'272\',\'1\',\'1\',\'1\')' at line 1 [23:59:53] SQL Query #224 FAILED! [23:59:53] ---------------------------------- [23:59:53] Cops'n'Gangs v2 by kyeman 2006 [23:59:53] ----------------------------------
pawn Код:
//---------------------------------------------------------
//
// Cop'n'Gangs v2 by kyeman 2006
//
//---------------------------------------------------------
#include <a_samp>
#include <a_sampmysql>
#include <core>
#include <float>
// Global stuff and defines for our gamemode.
static gTeam[MAX_PLAYERS]; // Tracks the team assignment for each player
#define OBJECTIVE_VEHICLE_GREEN 2
#define OBJECTIVE_VEHICLE_BLUE 1
#define TEAM_GREEN 1
#define TEAM_BLUE 2
#define OBJECTIVE_COLOR 0xAA0000FF
#define TEAM_GREEN_COLOR 0x33AA33AA
#define TEAM_BLUE_COLOR 0x3333AAAA
new gObjectiveGreenPlayer=(-1);
new gObjectiveBluePlayer=(-1);
new gObjectiveReached=0;
new all_skins[224][4] =
{
{ 0, 1, 3, 1},{105, 1, 3, 1},{106, 1, 3, 1},{107, 1, 3, 1},
{102, 1, 3, 1},{103, 1, 3, 1},{104, 1, 3, 1},{114, 1, 2, 1},
{115, 1, 2, 1},{116, 1, 2, 1},{108, 1, 3, 1},{109, 1, 3, 1},
{110, 1, 3, 1},{121, 1, 1, 1},{122, 1, 1, 1},{123, 1, 1, 3},
{173, 1, 2, 1},{174, 1, 2, 1},{175, 1, 2, 1},{117, 1, 1, 3},
{118, 1, 1, 3},{120, 1, 1, 3},{100, 1, 1, 1},{247, 1, 1, 1},
{248, 1, 1, 1},{254, 1, 1, 1},{111, 1, 1, 1},{112, 1, 1, 1},
{113, 1, 1, 3},{124, 1, 2, 1},{125, 1, 2, 1},{126, 1, 2, 1},
{127, 1, 2, 1},{190, 2, 3, 1},{191, 2, 1, 1},{192, 2, 1, 1},
{193, 2, 2, 1},{194, 2, 1, 3},{138, 2, 1, 2},{139, 2, 3, 2},
{140, 2, 2, 2},{145, 2, 1, 2},{251, 2, 2, 2},{ 92, 2, 2, 2},
{146, 1, 2, 2},{154, 1, 1, 2},{ 97, 1, 2, 2},{ 45, 1, 2, 2},
{ 18, 1, 3, 2},{128, 1, 2, 1},{129, 2, 2, 1},{130, 2, 2, 1},
{131, 2, 2, 1},{132, 1, 2, 1},{133, 1, 2, 1},{157, 2, 1, 1},
{158, 1, 1, 1},{159, 1, 1, 1},{160, 1, 1, 1},{196, 2, 2, 1},
{197, 2, 1, 1},{198, 2, 2, 1},{199, 2, 1, 1},{161, 1, 2, 1},
{162, 1, 1, 1},{200, 1, 2, 1},{201, 2, 1, 1},{202, 1, 2, 1},
{ 31, 2, 2, 1},{ 32, 1, 2, 1},{ 33, 1, 2, 1},{ 34, 1, 2, 1},
{152, 2, 1, 1},{178, 2, 2, 2},{237, 2, 2, 1},{238, 2, 3, 1},
{243, 2, 2, 1},{244, 2, 3, 2},{207, 2, 2, 1},{245, 2, 3, 1},
{246, 2, 1, 2},{256, 2, 3, 1},{257, 2, 1, 2},{ 64, 2, 2, 1},
{ 63, 2, 2, 2},{ 87, 2, 1, 2},{ 90, 2, 2, 1},{258, 1, 2, 1},
{259, 1, 1, 1},{ 26, 1, 1, 1},{ 51, 1, 3, 1},{ 52, 1, 1, 1},
{ 80, 1, 3, 1},{ 81, 1, 2, 1},{ 23, 1, 1, 1},{ 96, 1, 1, 1},
{141, 2, 1, 3},{147, 1, 1, 3},{148, 2, 3, 3},{150, 2, 2, 3},
{187, 1, 2, 3},{189, 1, 1, 3},{219, 2, 3, 3},{134, 1, 3, 1},
{135, 1, 1, 1},{137, 1, 2, 1},{181, 1, 2, 1},{213, 1, 1, 1},
{212, 1, 2, 1},{224, 2, 2, 1},{230, 1, 2, 1},{239, 1, 3, 1},
{249, 1, 2, 1},{241, 1, 2, 1},{242, 1, 1, 1},{252, 1, 1, 2},
{253, 1, 3, 3},{255, 1, 1, 3},{ 29, 1, 1, 1},{ 30, 1, 2, 1},
{ 49, 1, 1, 1},{ 50, 1, 2, 1},{ 57, 1, 1, 3},{ 61, 1, 1, 3},
{ 62, 1, 1, 2},{ 73, 1, 1, 1},{ 77, 2, 1, 1},{ 78, 1, 2, 1},
{ 79, 1, 3, 1},{ 82, 1, 1, 1},{ 83, 1, 3, 1},{ 84, 1, 2, 1},
{ 10, 2, 2, 1},{101, 1, 2, 1},{ 12, 2, 2, 1},{ 13, 2, 3, 1},
{136, 1, 3, 1},{ 14, 1, 3, 1},{142, 1, 3, 1},{143, 1, 3, 1},
{144, 1, 3, 1},{ 15, 1, 2, 1},{151, 2, 1, 1},{156, 1, 3, 1},
{168, 1, 3, 1},{169, 2, 1, 3},{ 17, 1, 3, 3},{170, 1, 1, 1},
{180, 1, 2, 1},{182, 1, 3, 1},{ 54, 2, 2, 1},{183, 1, 3, 1},
{184, 1, 2, 1},{263, 2, 2, 1},{ 75, 2, 1, 2},{186, 1, 1, 3},
{185, 1, 2, 3},{189, 1, 1, 1},{ 19, 1, 3, 1},{216, 2, 2, 1},
{ 20, 1, 2, 1},{206, 1, 1, 1},{ 21, 1, 3, 1},{ 22, 1, 3, 1},
{210, 1, 1, 1},{214, 2, 2, 1},{215, 2, 3, 1},{220, 1, 3, 1},
{221, 1, 3, 1},{225, 2, 1, 1},{226, 2, 2, 1},{222, 1, 3, 1},
{223, 1, 2, 1},{227, 1, 1, 3},{231, 2, 1, 1},{228, 1, 1, 3},
{234, 1, 1, 1},{ 76, 2, 3, 3},{235, 1, 2, 1},{236, 1, 1, 1},
{ 89, 2, 1, 1},{ 88, 2, 2, 1},{ 24, 1, 3, 1},{218, 2, 3, 1},
{240, 1, 1, 3},{ 25, 1, 3, 1},{250, 1, 1, 1},{261, 1, 2, 1},
{228, 1, 3, 1},{ 40, 2, 2, 3},{ 41, 2, 2, 1},{ 35, 1, 2, 1},
{ 37, 1, 1, 1},{ 38, 2, 2, 1},{ 36, 1, 3, 1},{ 44, 1, 2, 1},
{ 69, 2, 2, 1},{ 43, 1, 1, 3},{ 46, 1, 2, 3},{ 9, 2, 3, 3},
{ 93, 2, 2, 1},{ 39, 2, 1, 1},{ 48, 1, 2, 1},{ 47, 1, 2, 1},
{262, 1, 3, 1},{229, 1, 1, 1},{ 48, 1, 2, 1},{ 58, 1, 2, 1},
{ 59, 1, 1, 3},{ 60, 1, 1, 1},{232, 2, 1, 1},{233, 2, 2, 3},
{ 67, 1, 3, 1},{ 7, 1, 3, 1},{ 72, 1, 1, 1},{ 55, 2, 2, 1},
{ 94, 1, 1, 1},{ 95, 1, 1, 1},{ 98, 1, 2, 3},{ 56, 2, 2, 1},
{269, 1, 3, 1},{270, 1, 3, 1},{271, 1, 3, 1},{272, 1, 1, 1}
};
forward SetPlayerToTeamColor(playerid);
forward SetupPlayerForClassSelection(playerid);
forward SetPlayerTeamFromClass(playerid,classid);
forward ExitTheGameMode();
//---------------------------------------------------------
main()
{
print("\n----------------------------------");
print(" Cops'n'Gangs v2 by kyeman 2006\n");
print("----------------------------------\n");
}
//---------------------------------------------------------
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid;
if(newstate == PLAYER_STATE_DRIVER)
{
vehicleid = GetPlayerVehicleID(playerid);
if(gTeam[playerid] == TEAM_GREEN && vehicleid == OBJECTIVE_VEHICLE_GREEN)
{ // It's the objective vehicle
SetPlayerColor(playerid,OBJECTIVE_COLOR);
GameTextForPlayer(playerid,"~w~Take the ~r~van ~w~back to the spawn!",3000,5);
gObjectiveGreenPlayer = playerid;
}
if(gTeam[playerid] == TEAM_BLUE && vehicleid == OBJECTIVE_VEHICLE_BLUE)
{ // It's the objective vehicle
SetPlayerColor(playerid,OBJECTIVE_COLOR);
GameTextForPlayer(playerid,"~w~Take the ~r~van ~w~back to the spawn!",3000,5);
gObjectiveBluePlayer = playerid;
}
}
else if(newstate == PLAYER_STATE_ONFOOT)
{
if(playerid == gObjectiveGreenPlayer) {
gObjectiveGreenPlayer = (-1);
SetPlayerToTeamColor(playerid);
}
if(playerid == gObjectiveBluePlayer) {
gObjectiveBluePlayer = (-1);
SetPlayerToTeamColor(playerid);
}
}
return 1;
}
//---------------------------------------------------------
public OnGameModeInit()
{
SetGameModeText("CopsNGangs");
ShowPlayerMarkers(0);
ShowNameTags(1);
SetWorldTime(19);
// GANG CLASSES
AddPlayerClass(105,2500.2688,-1685.4584,13.4607,44.8214,9,0,25,25,32,200);
AddPlayerClass(106,2512.8611,-1673.2799,13.5104,87.7485,42,400,30,100,32,200);
AddPlayerClass(107,2508.1372,-1656.6781,13.5938,129.4222,5,0,30,100,29,200);
// POLICE CLASSES
AddPlayerClass(280,1559.3831,-1609.0282,13.3828,177.0690,42,400,31,100,29,200);
AddPlayerClass(281,1578.1378,-1608.7106,13.3828,125.6820,3,0,31,100,29,200);
AddPlayerClass(284,1569.6345,-1635.0394,13.5540,42.6713,3,0,25,25,32,200);
// OBJECTIVE VEHICLES
AddStaticVehicle(609,2473.5884,-1694.7870,13.3833,359.1481,114,1); // gr objective van
AddStaticVehicle(609,1549.3060,-1610.8313,13.5591,89.2093,0,1); // bl objective van
// GANGS VEHICLES
AddStaticVehicle(567,2509.9382,-1667.7566,13.3356,5.5935,114,1);
AddStaticVehicle(567,2506.9841,-1677.4115,13.3292,325.3867,114,1);
AddStaticVehicle(567,2501.5195,-1655.5464,13.3189,69.0657,114,1);
AddStaticVehicle(567,2484.7808,-1653.7554,13.2652,86.9443,114,1);
AddStaticVehicle(567,2468.3486,-1653.4425,13.2643,91.4342,114,1);
// COPS VEHICLES
AddStaticVehicle(596,1603.2410,-1629.1624,13.2215,88.5687,0,1);
AddStaticVehicle(596,1572.9598,-1607.0868,13.1032,177.8650,0,1);
AddStaticVehicle(596,1582.5460,-1606.9911,13.1032,177.5342,0,1);
AddStaticVehicle(596,1590.7076,-1607.5624,13.1032,181.6846,0,1);
AddStaticVehicle(596,1603.3566,-1618.9797,13.2220,90.0969,0,1);
lol();
return 1;
}
//---------------------------------------------------------
public OnPlayerConnect(playerid)
{
SetPlayerColor(playerid,0x888888FF);
GameTextForPlayer(playerid,"~r~SA-MP:~w~CopsNGangs",2000,5);
return 1;
}
//---------------------------------------------------------
public SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,11);
SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
SetPlayerFacingAngle(playerid,0.0);
}
//---------------------------------------------------------
public SetPlayerTeamFromClass(playerid,classid)
{
// Set their team number based on the class they selected.
if(classid == 0 || classid == 1 || classid == 2) {
gTeam[playerid] = TEAM_GREEN;
} else if(classid == 3 || classid == 4 || classid == 5) {
gTeam[playerid] = TEAM_BLUE;
}
}
//---------------------------------------------------------
public SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == TEAM_GREEN) {
SetPlayerColor(playerid,TEAM_GREEN_COLOR); // green
} else if(gTeam[playerid] == TEAM_BLUE) {
SetPlayerColor(playerid,TEAM_BLUE_COLOR); // blue
}
}
//---------------------------------------------------------
public OnPlayerRequestClass(playerid, classid)
{
SetupPlayerForClassSelection(playerid);
SetPlayerTeamFromClass(playerid,classid);
if(classid == 0 || classid == 1 || classid == 2) {
GameTextForPlayer(playerid,"~g~GANG ~w~TEAM",1000,5);
} else if(classid == 3 || classid == 4 || classid == 5) {
GameTextForPlayer(playerid,"~b~COP ~w~TEAM",1000,5);
}
return 1;
}
//---------------------------------------------------------
public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,0);
if(gTeam[playerid] == TEAM_GREEN) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_GREEN,playerid,1,0); // objective; unlocked
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_BLUE,playerid,1,1); // objective; locked
SetPlayerCheckpoint(playerid,2486.7344,-1679.3959,13.3358,5.0);
SetPlayerWorldBounds(playerid,2535.4392,1434.0455,-1581.9657,-1715.8713);
GameTextForPlayer(playerid,
"Defend the ~g~GANG ~w~team's ~r~Van~n~~w~Capture the ~b~COP ~w~team's ~r~Van",
6000,5);
}
else if(gTeam[playerid] == TEAM_BLUE) {
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_BLUE,playerid,1,0); // objective; unlocked
SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE_GREEN,playerid,1,1); // objective; locked
SetPlayerCheckpoint(playerid,1513.3240,-1660.7247,13.6131,7.0);
SetPlayerWorldBounds(playerid,2535.4392,1434.0455,-1581.9657,-1715.8713);
GameTextForPlayer(playerid,
"Defend the ~b~COP ~w~team's ~r~Van~n~~w~Capture the ~g~GANG ~w~team's ~r~Van",
6000,5);
}
return 1;
}
//---------------------------------------------------------
public OnPlayerEnterCheckpoint(playerid)
{
new playervehicleid = GetPlayerVehicleID(playerid);
if(gObjectiveReached) return;
if(playervehicleid == OBJECTIVE_VEHICLE_GREEN && gTeam[playerid] == TEAM_GREEN)
{ // Green OBJECTIVE REACHED.
GameTextForAll("~g~GANG ~w~team wins!",3000,5);
gObjectiveReached = 1;
SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
SetTimer("ExitTheGameMode", 4000, 0); // Set up a timer to exit this mode.
return;
}
else if(playervehicleid == OBJECTIVE_VEHICLE_BLUE && gTeam[playerid] == TEAM_BLUE)
{ // Blue OBJECTIVE REACHED.
GameTextForAll("~b~COP ~w~team wins!",3000,5);
gObjectiveReached = 1;
SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
SetTimer("ExitTheGameMode", 4000, 0); // Set up a timer to exit this mode.
return;
}
}
//---------------------------------------------------------
public ExitTheGameMode()
{
GameModeExit();
}
//---------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == INVALID_PLAYER_ID) {
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
} else {
if(gTeam[killerid] != gTeam[playerid]) {
// Valid kill
SendDeathMessage(killerid,playerid,reason);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
}
else {
// Team kill
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
}
}
return 1;
}
//---------------------------------
forward lol();
public lol()
{
printf("Executing lol();");
samp_mysql_connect ("127.0.0.1", "root", "root");
samp_mysql_select_db ("zrp-db");
new query[128]; new q;
new query2[257];
for(new i = 0; i < 224; i++)
{
format(query, sizeof(query), "INSERT INTO `skins` (`skinid`,`sex`,`tan`,`type`) VALUES ('%d','%d','%d','%d') ",
all_skins[i][0],
all_skins[i][1],
all_skins[i][2],
all_skins[i][3]);
samp_mysql_real_escape_string(query, query2);
q = samp_mysql_query(query2);
if(q == 0) printf("SQL Query #%d FAILED!", i+1);
else printf("SQL Query #%d SUCCESSFUL!", i+1);
}
samp_mysql_close();
return 1;
}