04.08.2010, 19:17
Well, I think that the problem is that my gamemode doesn't connect to the database.
When I run the samp-server.exe it opens and closes after 1 second.
This is the samp-server log file:
I've downloaded wamp server and via the Nevigate for MYSQL software I logged into the database and executed the database.sql file that I've recieved from the seller when I bought the gamemode.
This is my OnGameModeInit:
This is my SQL defines on the top of the script:
Could somebody please tell me what am I doing wrong here? I really can't understand..
Thank you.
When I run the samp-server.exe it opens and closes after 1 second.
This is the samp-server log file:
Код:
SA-MP Dedicated Server ---------------------- v0.3a R7, ©2005-2010 SA-MP Team [22:12:51] filterscripts = "" (string) [22:12:51] [22:12:51] Server Plugins [22:12:51] -------------- [22:12:51] Loading plugin: mysql [22:12:51] > MySQL plugin R4-2 successfully loaded. [22:12:51] Loaded. [22:12:51] Loaded 1 plugins. [22:12:51] [22:12:51] Filter Scripts [22:12:51] --------------- [22:12:51] Loaded 0 filter scripts. [22:12:51] tick
This is my OnGameModeInit:
Код:
print("tick"); #if DEBUG 1 format(debugs,256,"DEBUG | OngameModeInit start."); debugLog(debugs); #endif /*admintext = TextDrawCreate(1.000000,430.000000,"crap"); TextDrawAlignment(admintext,0); TextDrawBackgroundColor(admintext,0x000000ff); TextDrawFont(admintext,3); TextDrawLetterSize(admintext,0.500000,1.000000); TextDrawColor(admintext,0xffffff99); TextDrawSetOutline(admintext,1); TextDrawSetProportional(admintext,1); TextDrawSetShadow(admintext,2);*/ //ShowPlayerMarkers(false); SetGameModeText(scriptVersion); AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); mysql_debug(1); mysql_connect("192.168.42.1", "Exodus", "Exodus_one", "prawnfuckingcrackers"); new string[MAX_STRING1]; format(String,256,"TRUNCATE TABLE `donated`"); mysql_query(String); format(String,256,"TRUNCATE TABLE `drugpos`"); mysql_query(String); format(String,256,"UPDATE `users` SET `online`='0'"); mysql_query(String); format(String,256,"UPDATE `objects` SET `state`='0'"); mysql_query(String); carmenu = CreateMenu("Private Car Menu:", 1, 200.0, 100.0, 150.0, 150.0); SetMenuColumnHeader(carmenu,0,"Select:"); AddMenuItem(carmenu,0,"Lock vehicle."); AddMenuItem(carmenu,0,"Unlock vehicle."); AddMenuItem(carmenu,0,"Purchase locks."); AddMenuItem(carmenu,0,"Repaint your vehicle."); AddMenuItem(carmenu,0,"Buy a GPS system."); AddMenuItem(carmenu,0,"Install Tinted Windows."); AddMenuItem(carmenu,0,"Repark your vehicle."); AddMenuItem(carmenu,0,"Sell vehicle."); semicarmenu=CreateMenu("faction/job Car Menu:", 1, 200.0, 100.0, 150.0, 150.0); SetMenuColumnHeader(semicarmenu,0,"Select:"); AddMenuItem(semicarmenu,0,"Park vehicle."); AddMenuItem(semicarmenu,0,"Delete vehicle."); lockmenu= CreateMenu("Locks Menu:",2, 200.0, 100.0, 150.0, 150.0); SetMenuColumnHeader(lockmenu,0,"Lock Name:"); SetMenuColumnHeader(lockmenu,1,"Price:"); for(new i=0;i<sizeof(locks);i++) { AddMenuItem(lockmenu,0,locks[i][lockname]); format(string,MAX_STRING1,"%d",locks[i][lockprice],100-locks[i][percents]); AddMenuItem(lockmenu,1,string); } carcolor= CreateMenu("Colors Menu:",1,200.0, 100.0, 150.0, 150.0); SetMenuColumnHeader(carcolor,0,"Select:"); AddMenuItem(carcolor,0,"Black"); AddMenuItem(carcolor,0,"White"); AddMenuItem(carcolor,0,"Red"); AddMenuItem(carcolor,0,"Green"); AddMenuItem(carcolor,0,"Blue"); AddMenuItem(carcolor,0,"Orange"); AddMenuItem(carcolor,0,"Purple"); AddMenuItem(carcolor,0,"Pink"); new hour,mins,secs; gettime(hour,mins,secs); AllowAdminTeleport(1); // ray tp //new File:hFile; //---------------------------/eatmenu------------------------------------------- eatmenu = CreateMenu("Food", 1, 200.0, 100.0, 150.0, 150.0); SetMenuColumnHeader(eatmenu,0,"Food type"); SetMenuColumnHeader(eatmenu,1,"Price"); for(new i=0;i<sizeof(foods);i++) { AddMenuItem(eatmenu,0,foods[i][fname]); AddMenuItem(eatmenu,1,foods[i][fprice]); } //----------------------------[City Hall menu]---------------------------------- cityhallmenu = CreateMenu("Employment", 1, 200.0, 100.0, 150.0, 150.0); SetMenuColumnHeader(cityhallmenu,0,"Select:"); for(new i=1;i<sizeof(jobs);i++) AddMenuItem(cityhallmenu, 0, jobs[i][jname]); //----------------------------[Help Menu---------------------------------------- helpmenu = CreateMenu("Helps", 1, 200.0, 100.0, 150.0, 150.0); new File:hFile=fopen("helps/types.txt",io_read); SetMenuColumnHeader(helpmenu,0,"Select:"); while(fread(hFile,String)) AddMenuItem(helpmenu, 0, String); fclose(hFile); shopmenu1 = CreateMenu("24/7", 2, 200.0, 100.0, 150.0, 150.0); SetMenuColumnHeader(shopmenu1,0,"Product:"); SetMenuColumnHeader(shopmenu1,1,"Price:"); AddMenuItem(shopmenu1,0,"Cell Phone"); AddMenuItem(shopmenu1,1,"100$"); AddMenuItem(shopmenu1,0,"Cell Phone Memory Card"); AddMenuItem(shopmenu1,1,"500$"); AddMenuItem(shopmenu1,0,"Phone Book"); AddMenuItem(shopmenu1,1,"10$"); AddMenuItem(shopmenu1,0,"Camera"); AddMenuItem(shopmenu1,1,"100$"); AddMenuItem(shopmenu1,0,"Scratch Card"); AddMenuItem(shopmenu1,1,"50$"); AddMenuItem(shopmenu1,0,"Dice"); AddMenuItem(shopmenu1,1,"30$"); AddMenuItem(shopmenu1,0,"Spray color"); AddMenuItem(shopmenu1,1,"13$"); AddMenuItem(shopmenu1,0,"Pager"); AddMenuItem(shopmenu1,1,"50$"); AddMenuItem(shopmenu1,0,"A shaker"); AddMenuItem(shopmenu1,1,"120$"); AddMenuItem(shopmenu1,0,"A small bin"); //instead of condome AddMenuItem(shopmenu1,1,"35$"); AddMenuItem(shopmenu1,0,"A bottle kerosene"); AddMenuItem(shopmenu1,1,"60$"); AddMenuItem(shopmenu1,0,"A filter"); AddMenuItem(shopmenu1,1,"40$"); shopmenu2 = CreateMenu("24/7", 2, 200.0, 100.0, 150.0, 150.0); //rayshop SetMenuColumnHeader(shopmenu2,0,"Product:"); SetMenuColumnHeader(shopmenu2,1,"Price:"); AddMenuItem(shopmenu2,0,"Gas Can"); AddMenuItem(shopmenu2,1,"150$"); AddMenuItem(shopmenu2,0,"Oxidizing Agent"); AddMenuItem(shopmenu2,1,"250$"); AddMenuItem(shopmenu2,0,"Mask"); AddMenuItem(shopmenu2,1,"100$"); AddMenuItem(shopmenu2,0,"Baseball Bat"); AddMenuItem(shopmenu2,1,"50$"); AddMenuItem(shopmenu2,0,"A knife"); AddMenuItem(shopmenu2,1,"150$"); format(String,256,"SELECT `mid`,`x`,`y`,`z`,`rx`,`ry`,`rz`,`id` FROM `objects`"); mysql_query(String); mysql_store_result(); while(mysql_fetch_row_default(String)) { magicstrtok(string,"|",String); new mid=strvalEx(string); magicstrtok(string,"|",""); new Float:x=floatstr(string); magicstrtok(string,"|",""); new Float:y=floatstr(string); magicstrtok(string,"|",""); new Float:z=floatstr(string); magicstrtok(string,"|",""); new Float:rx=floatstr(string); magicstrtok(string,"|",""); new Float:ry=floatstr(string); magicstrtok(string,"|",""); new Float:rz=floatstr(string); new oid=CreateObject(mid,x,y,z,rx,ry,rz); magicstrtok(string,"|",""); format(string,MAX_STRING1,"UPDATE `objects` SET `oid`='%d' WHERE `id`='%d'",oid,strvalEx(string)); mysql_query(string); } mysql_free_result(); AllowInteriorWeapons(1); SetNameTagDrawDistance(10.0); //UsePlayerPedAnims(); DisableInteriorEnterExits(); format(string,MAX_STRING1,"SELECT `id`,`x`,`y`,`z`,`owner` FROM `houses` WHERE `price`>0"); mysql_query(string); mysql_store_result(); while(mysql_fetch_row_default(String)) { magicstrtok(string,"|",String); new id=strvalEx(string); magicstrtok(string,"|",""); new Float:x=floatstr(string); magicstrtok(string,"|",""); new Float:y=floatstr(string); magicstrtok(string,"|",""); new Float:z=floatstr(string); magicstrtok(string,"|",""); new pid; if(!strcmp(string,"No",true)) pid=CreatePickup(GREEN_PICKUP,1,x,y,z); else pid=CreatePickup(BLUE_PICKUP,1,x,y,z); format(String,256,"UPDATE `houses` SET `pid`='%d' WHERE `id`='%d' AND `price`>0",pid,id); mysql_query(String); } mysql_free_result(); format(string,MAX_STRING1,"SELECT `id`,`x`,`y`,`z`,`owner` FROM `houses` WHERE `price`<0"); mysql_query(string); mysql_store_result(); while(mysql_fetch_row_default(String)) { magicstrtok(string,"|",String); new id=strvalEx(string); magicstrtok(string,"|",""); new Float:x=floatstr(string); magicstrtok(string,"|",""); new Float:y=floatstr(string); magicstrtok(string,"|",""); new Float:z=floatstr(string); magicstrtok(string,"|",""); new pid; pid=CreatePickup(INFO_PICKUP,1,x,y,z); format(String,256,"UPDATE `houses` SET `pid`='%d' WHERE `id`='%d' AND `price`<0",pid,id); mysql_query(String); } mysql_free_result(); for(new i=1;i<sizeof(jobs);i++) CreatePickup(INFO_PICKUP,1,jobs[i][jx],jobs[i][jy],jobs[i][jz]); format(string,MAX_STRING1,"SELECT `id`,`x`,`y`,`z` FROM `houses` WHERE `price`='0'"); mysql_query(string); mysql_store_result(); while(mysql_fetch_row_default(String)) { magicstrtok(string,"|",String); new id=strvalEx(string); magicstrtok(string,"|",""); new Float:x=floatstr(string); magicstrtok(string,"|",""); new Float:y=floatstr(string); magicstrtok(string,"|",""); new Float:z=floatstr(string); new pid=CreatePickup(INFO_PICKUP,1,x,y,z); format(String,256,"UPDATE `houses` SET `pid`='%d' WHERE `id`='%d'",pid,id); mysql_query(String); } mysql_free_result(); // UsePlayerPedAnims(); EnableStuntBonusForAll(0); SetTimer("SecTimer",1000,1); SetTimer("keepfrizing",1000,1); SetTimer("eatgeneretor",45*1000,1); SetTimer("moneycheat",1137,1); // SetTimer("weaponcheat",1000,1); SetTimer("AntiWeaponHack",1000,1); SetTimer("Afk",1000,1); SetTimer("update",1000*60*5,1); SetTimer("recover",MAX_STRING1,1); SetTimer("CarSpeed",1000,1); // LoadBusiness(); CV(); for(new i=0; i < MAX_PLAYERS; i++) { PMAllowed[i] = true; } #if DEBUG 1 format(debugs,256,"DEBUG | OngameModeInit end."); debugLog(debugs); #endif return 1;
Код:
#define SQL_HOST "localhost" #define SQL_USER "root" #define SQL_PASS "" #define SQL_DB "samp"
Thank you.