Problem with server starting
#1

Hello guys.
I just downloaded an old server from 2013.
I made all good and now I got a error when start the server.

Code:
[03:38:47] Number of vehicle models: 10
[03:38:47] [connection] 127.0.0.1:52980 requests connection cookie.
[03:38:47] [connection] 127.0.0.1:52982 requests connection cookie.
[03:38:47] [connection] 127.0.0.1:52981 requests connection cookie.
Every time I try to start it, it shows me others "ports" after 127.0.0.1orts

CrashDetect:

Code:
[03:43:36] [debug] Server crashed while executing rp.amx
[03:43:36] [debug] AMX backtrace:
[03:43:36] [debug] #0 native mysql_fetch_field_row () [100065e0] from mysql.DLL
[03:43:36] [debug] #1 0005f86c in public OnQueryFinish () from rp.amx
[03:43:36] [debug] System backtrace:
Please help me.
Reply
#2

Please compile with the debug. To compile with the debug, you need to follow the steps below;

Code:
1.) Open your pawno folder.
2.) Create a new configuration (.cfg) file into it, same as server configuration file type.
3.) Type -d3.
4.) Save and Compile.
Once compiled with the debug, restart the server and give us the log.
Reply
#3

Code:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[02:45:17] filterscripts = ""  (string)
[02:45:17] 
[02:45:17] Server Plugins
[02:45:17] --------------
[02:45:17]  Loading plugin: mysql
[02:45:17] 

  > MySQL plugin R5 successfully loaded.

[02:45:17]   Loaded.
[02:45:17]  Loading plugin: audio
[02:45:17] 

*** Audio Plugin v0.5 R2 by Incognito loaded ***

[02:45:17]   Loaded.
[02:45:17]  Loading plugin: regex
[02:45:17] 


[02:45:17] ______________________________________


[02:45:17]  Regular Expression Plugin v0.2.1 loaded
[02:45:17] ______________________________________


[02:45:17]  By: Fro © Copyright <TBG> 2009-2011
[02:45:17] ______________________________________


[02:45:17]   Loaded.
[02:45:17]  Loading plugin: Whirlpool
[02:45:17]  
[02:45:17]  ==================
[02:45:17]  
[02:45:17]   Whirlpool loaded
[02:45:17]  
[02:45:17]  ==================
[02:45:17]  
[02:45:17]   Loaded.
[02:45:17]  Loading plugin: crashdetect
[02:45:17]   CrashDetect v4.10 is OK.
[02:45:17]   Loaded.
[02:45:17]  Loaded 5 plugins.

[02:45:17] 
[02:45:17] Filterscripts
[02:45:17] ---------------
[02:45:17]   Loaded 0 filterscripts.

[02:45:18] *** Audio Plugin: Started TCP server on port 7777
[02:45:18] Connecting to MySQL server..
[02:45:18] Connected to MySQL server
[02:45:18] Server Enviroment: DEV
[02:45:18] Text Draws Created.
[02:45:18] Menus Created.
[02:45:18] Running new race
[02:45:18] Job Vehicles Created.
[02:45:18] Job Pickups Created.
[02:45:18] Invalid modelid for object: F_CreateObject(0, 1415.430053, 373.579986, 20.649999, 0.000000, 0.000000, -110.400001);

[02:45:18] Streamed Objects: 903
[02:45:18] 37 Gates Added
[02:45:18] 6 Speed Cameras Added
[02:45:18] Refreshing Population
[02:45:18] Refreshing Market Prices...
[02:45:18] 

[02:45:18] Number of vehicle models: 10
[02:45:18] [connection] 127.0.0.1:58925 requests connection cookie.
[02:45:18] [connection] 127.0.0.1:58926 requests connection cookie.
[02:45:18] [connection] 127.0.0.1:58927 requests connection cookie.
[02:45:18] [connection] 127.0.0.1:58928 requests connection cookie.
[02:45:18] [debug] Server crashed while executing rp.amx
[02:45:18] [debug] AMX backtrace:
[02:45:18] [debug] #0 native mysql_fetch_field_row () [100065e0] from mysql.DLL
[02:45:18] [debug] #1 0005f86c in public OnQueryFinish () from rp.amx
[02:45:18] [debug] System backtrace:
[02:45:18] [debug] #0 100090b4 in ?? () from E:\SAMP Server\plugins\mysql.DLL
[02:45:18] [debug] #1 100066b3 in ?? () from E:\SAMP Server\plugins\mysql.DLL
[02:45:18] [debug] #2 004010b6 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #3 731a340a in ?? () from E:\SAMP Server\plugins\crashdetect.DLL
[02:45:18] [debug] #4 731a5aa6 in ?? () from E:\SAMP Server\plugins\crashdetect.DLL
[02:45:18] [debug] #5 7319d621 in ?? () from E:\SAMP Server\plugins\crashdetect.DLL
[02:45:18] [debug] #6 731a345a in ?? () from E:\SAMP Server\plugins\crashdetect.DLL
[02:45:18] [debug] #7 10007f7d in ?? () from E:\SAMP Server\plugins\mysql.DLL
[02:45:18] [debug] #8 00469a66 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #9 0048d4db in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #10 0049b4a1 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #11 0049b4b1 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #12 ffc30000 in ?? ()
[02:45:18] [debug] #13 e8042474 in ?? ()
[02:45:18] [debug] #14 ffffffbf in ?? ()
[02:45:18] [debug] #15 c01bd8f7 in ?? ()
[02:45:18] [debug] #16 4859d8f7 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #17 247c83c3 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #18 06740008 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #19 412d01c6 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #20 8b56d8f7 in ?? ()
[02:45:18] [debug] #21 f7d233f1 in ?? ()
[02:45:18] [debug] #22 83082474 in ?? ()
[02:45:18] [debug] #23 057609fa in ?? ()
[02:45:18] [debug] #24 eb57c280 in ?? ()
[02:45:18] [debug] #25 30c28003 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #26 85411188 in ?? ()
[02:45:18] [debug] #27 c6e677c0 in ?? ()
[02:45:18] [debug] #28 8a490001 in ?? ()
[02:45:18] [debug] #29 88018a16 in ?? ()
[02:45:18] [debug] #30 06884911 in ?? ()
[02:45:18] [debug] #31 72f13b46 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #32 55c35ef2 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #33 7d83ec8b in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #34 458b0a10 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #35 850a7508 in ?? ()
[02:45:18] [debug] #36 6a067dc0 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #37 eb0a6a01 in ?? ()
[02:45:18] [debug] #38 ff006a05 in ?? ()
[02:45:18] [debug] #39 4d8b1075 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #40 ff9fe80c in ?? ()
[02:45:18] [debug] #41 458bffff in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #42 5d59590c in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #43 244c8bc3 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #44 24448b08 in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #45 ff006a04 in ?? ()
[02:45:18] [debug] #46 e8102474 in ?? ()
[02:45:18] [debug] #47 ffffff85 in ?? ()
[02:45:18] [debug] #48 1024448b in ?? () from E:\SAMP Server\samp-server.exe
[02:45:18] [debug] #49 e8c35959 in ?? ()
This is all server_log.
P.S. Server get close after all this.
Reply
#4

Re-download the latest SAMP package from www.sa-mp.com and copy the includes over as well as samp-server.exe to the server files folder and then re-compile and start it again.
Reply
#5

Post your 'OnQueryFinish' function.
Reply
#6

Quote:
Originally Posted by iLearner
View Post
Post your 'OnQueryFinish' function.
Code:
forward OnQueryFinish( query[], resultid, extraid, connectionHandle );
public OnQueryFinish( query[], resultid, extraid, connectionHandle )
{

	mysql_store_result();
	new playerid = resultid;
	new rows = 0;
	new type = extraid;

	/************/

	if(type == QUERY_LOGIN_USER)
	{
		rows = mysql_num_rows();
        if(rows)
		{
			SendClientMessageA(playerid,COLOR_LIGHTRED,"Welcome to our server, use /login to continue playing.");
			ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login","Enter your password below:","Login","Cancel");
			registered[playerid] = 1;

		}
		else
		{

			new str[1024];
			format(str,sizeof(str),"Hello! Welcome to Just Roleplay! A roleplaying server for the serious gamer.\n\nThe following tutorial will help you get playing on our server! We'll try to get you playing as \nsoon as possible! As we use a User Control Panel on our server, we need to first verify \nyour email address.\n\nAll that we ask, is that you read the following information, very, very carefully.\n\n\n\nClick next as soon as you're ready!");
			ShowPlayerDialog(playerid,DIALOG_REG1,DIALOG_STYLE_MSGBOX,"Welcome!",str,"Next >>","");
			registered[playerid] = 0;

		}
		SetPlayerScreenSaver(playerid);
		player_thread_inuse[playerid] = false;

	}
	else if(type == QUERY_LOGIN_SEND)
	{

	    rows = mysql_num_rows();
	    if(rows)
	    {

			mysql_retrieve_row();
			new secure_check[128];
			mysql_fetch_field_row(secure_check,"secure_ip");
			if(strlen(secure_check)) { //Secure IP enabled
			    new ip[128];
			    GetPlayerIp(playerid,ip,sizeof(ip));
			    if(!(strcmp(ip,secure_check,true) == 0)) {
					ShowPlayerDialog(playerid,999,DIALOG_STYLE_MSGBOX,"Connection Rejected","The account you are trying to login with is protected by Just Roleplays Secure IP system\n You cannot access this account without first authorising this IP address.\n\n To authorize this IP address please access your settings at: http://ucp.justrp.net/","Ok","");
					new clean_ip[128];
					mysql_real_escape_string(ip,clean_ip);
					new secure_query[256];
					new secure_user_id[32];
					mysql_fetch_field_row(secure_user_id,"id");
					format(secure_query,sizeof(secure_query),"INSERT INTO rp_secure_ip_logs (user_id,ip) VALUES ('%s','%s')",secure_user_id,clean_ip);
					mysql_query(secure_query,player_threads[playerid]);
					Kick(playerid);
			    }
			}
  	        screen_saver[playerid] = 0;
	        if(Audio_IsClientConnected(playerid) && intro_music[playerid] > -1) { Audio_Stop(playerid,intro_music[playerid]); intro_music[playerid] = -1; }
			if(screen_saver_timer[playerid] > -1)
			{

			    KillTimer(screen_saver_timer[playerid]);

			}
	        SendClientMessage(playerid,COLOR_GREEN,"Logged in. Welcome.");
	        SendClientMessage(playerid,COLOR_FACTION,"Welcome to Just Roleplay. For assistance please use /assistme");
	        SendClientMessage(playerid,COLOR_YELLOW,"To change your skin or create new characters, please visit our UCP: http://ucp.justrp.net/");
	        logged[playerid] = true;
	        player_thread_inuse[playerid] = false;
	        LoadStats(playerid);
	        SetSpawnInfo(playerid,0,177,414.1235,-17.7988,991.8047,90.0,0,0,0,0,0,0);
	        SendConnectMessage(playerid);
	        return 1;

     	}
     	else
     	{

			SendClientMessageA(playerid,COLOR_RED,"Invalid Login.");
			ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login","Enter your password below:","Login","Cancel");
			logged[playerid] = false;
			player_thread_inuse[playerid] = false;
			return 1;

     	}

	}
	else if(type == QUERY_LOGIN_STATS)
	{

		new str[256]; new data[17][256];
		mysql_fetch_row_format(str);
		explode(data,str,"|");
		AccountInfo[playerid][aID] = strval(data[0]);
		format(AccountInfo[playerid][aName],MAX_PLAYER_NAME,"%s",data[1]);
		AccountInfo[playerid][aMaxChars] = strval(data[3]);
		AccountInfo[playerid][aAdmin] = strval(data[4]);
		AccountInfo[playerid][aJailTime] = strval(data[5]);
		AccountInfo[playerid][aTutorial] = strval(data[7]);
		AccountInfo[playerid][aAssistant] = strval(data[8]);
		AccountInfo[playerid][aBikePerm] = strval(data[14]);
		player_thread_inuse[playerid] = QUERY_LOGIN_CHARS;
		format(str,sizeof(str),"SELECT * FROM rp_characters WHERE rp_characters.owner = '%d' ORDER BY id DESC LIMIT %d",AccountInfo[playerid][aID],AccountInfo[playerid][aMaxChars]);
		mysql_query(str,player_threads[playerid],QUERY_LOGIN_CHARS);

	}
	else if(type == QUERY_LOGIN_CHARS)
	{

		new ii = 0;
	    new bb[256];
	    while(mysql_retrieve_row())
	    {

			mysql_fetch_field_row(bb,"id");
			CharacterInfo[playerid][ii][cID] = strval(bb);
			mysql_fetch_field_row(bb,"name");
			format(CharacterInfo[playerid][ii][cName],MAX_PLAYER_NAME,"%s",bb);
			mysql_fetch_field_row(bb,"skin");
			CharacterInfo[playerid][ii][cSkin] = strval(bb);
			mysql_fetch_field_row(bb,"spawn_x");
			CharacterInfo[playerid][ii][cSpawnX] = floatstr(bb);
			mysql_fetch_field_row(bb,"spawn_y");
			CharacterInfo[playerid][ii][cSpawnY] = floatstr(bb);
			mysql_fetch_field_row(bb,"spawn_z");
			CharacterInfo[playerid][ii][cSpawnZ] = floatstr(bb);
			mysql_fetch_field_row(bb,"money");
			CharacterInfo[playerid][ii][cMoney] = strval(bb);
			mysql_fetch_field_row(bb,"spawn_r");
			CharacterInfo[playerid][ii][cSpawnR] = floatstr(bb);
			mysql_fetch_field_row(bb,"spawn_i");
			CharacterInfo[playerid][ii][cSpawnI] = strval(bb);
			mysql_fetch_field_row(bb,"renting");
			CharacterInfo[playerid][ii][cRenting] = strval(bb);
			mysql_fetch_field_row(bb,"faction");
			CharacterInfo[playerid][ii][cFaction] = strval(bb);
			mysql_fetch_field_row(bb,"phone_number");
			CharacterInfo[playerid][ii][cPhone] = strval(bb);
			mysql_fetch_field_row(bb,"weapons");
			format(CharacterInfo[playerid][ii][cWeapons],256,"%s",bb);
			mysql_fetch_field_row(bb,"bank");
			CharacterInfo[playerid][ii][cBank] = strval(bb);
			mysql_fetch_field_row(bb,"payday");
			CharacterInfo[playerid][ii][cPayday] = strval(bb);
			mysql_fetch_field_row(bb,"faction_perm");
			CharacterInfo[playerid][ii][cFactionPermissions] = strval(bb);
			mysql_fetch_field_row(bb,"rank_name");
			format(CharacterInfo[playerid][ii][cRankName],64,"%s",bb);
			mysql_fetch_field_row(bb,"jail_time");
			CharacterInfo[playerid][ii][cJailTime] = strval(bb);
			mysql_fetch_field_row(bb,"car_lic");
			CharacterInfo[playerid][ii][cCarLic] = strval(bb);
			mysql_fetch_field_row(bb,"wep_lic");
			CharacterInfo[playerid][ii][cWepLic] = strval(bb);
			mysql_fetch_field_row(bb,"pay_time");
			CharacterInfo[playerid][ii][cPayTime] = strval(bb);
			mysql_fetch_field_row(bb,"level");
			CharacterInfo[playerid][ii][cLevel] = strval(bb);
			mysql_fetch_field_row(bb,"exp");
			CharacterInfo[playerid][ii][cExp] = strval(bb);
			mysql_fetch_field_row(bb,"spawn_world");
			CharacterInfo[playerid][ii][cSpawnWorld] = strval(bb);
			mysql_fetch_field_row(bb,"radio");
			CharacterInfo[playerid][ii][cRadio] = strval(bb);
			mysql_fetch_field_row(bb,"rc");
			CharacterInfo[playerid][ii][cRadioChannel] = strval(bb);
			mysql_fetch_field_row(bb,"radio_auth");
			format(CharacterInfo[playerid][ii][cRadioAuth],16,"%s",bb);
			if(!strlen(CharacterInfo[playerid][ii][cRadioAuth])) { format(CharacterInfo[playerid][ii][cRadioAuth],16,"none"); }
			mysql_fetch_field_row(bb,"job");
			CharacterInfo[playerid][ii][cJob] = strval(bb);
			mysql_fetch_field_row(bb,"jcool");
			CharacterInfo[playerid][ii][cJobCooldown] = strval(bb);
			mysql_fetch_field_row(bb,"addict");
			CharacterInfo[playerid][ii][cAddiction] = strval(bb);
			mysql_fetch_field_row(bb,"alvl");
			CharacterInfo[playerid][ii][cAddictionLevel] = strval(bb);
			mysql_fetch_field_row(bb,"savings");
			CharacterInfo[playerid][ii][cSavings] = strval(bb);
			mysql_fetch_field_row(bb,"fly_lic");
		   	CharacterInfo[playerid][ii][cFlyLic] = strval(bb);
		   	mysql_fetch_field_row(bb,"duty_skin");
		   	CharacterInfo[playerid][ii][cDutySkin] = strval(bb);
			mysql_fetch_field_row(bb,"health");
			CharacterInfo[playerid][ii][cHealth] = floatstr(bb);
			mysql_fetch_field_row(bb,"armor");
			CharacterInfo[playerid][ii][cArmor] = floatstr(bb);
			if(CharacterInfo[playerid][ii][cHealth] < 10.0) { CharacterInfo[playerid][ii][cHealth] = 10.0; }
			mysql_fetch_field_row(bb,"employed");
			CharacterInfo[playerid][ii][cEmployed] = strval(bb);
			mysql_fetch_field_row(bb,"hotel");
			CharacterInfo[playerid][ii][cHotel] = strval(bb);
			mysql_fetch_field_row(bb,"lic_warns");
			CharacterInfo[playerid][ii][cCarLicWarnings] = strval(bb);
			mysql_fetch_field_row(bb,"dob");
			format(CharacterInfo[playerid][ii][cDob],32,"%s",bb);
			mysql_fetch_field_row(bb,"duplicate");
			CharacterInfo[playerid][ii][cDuplicate] = strval(bb);
			mysql_fetch_field_row(bb,"badge");
			CharacterInfo[playerid][ii][cBadge] = strval(bb);
			mysql_fetch_field_row(bb,"ccool");
			CharacterInfo[playerid][ii][cChopCooldown] = strval(bb);
			mysql_fetch_field_row(bb,"deaths");
			CharacterInfo[playerid][ii][cDeaths] = strval(bb);
			mysql_fetch_field_row(bb,"hins");
			CharacterInfo[playerid][ii][cHealthInsurance] = strval(bb);
			mysql_fetch_field_row(bb,"fstyle");
			CharacterInfo[playerid][ii][cFstyle] = strval(bb);
			mysql_fetch_field_row(bb,"comp");
			CharacterInfo[playerid][ii][cCompany] = strval(bb);
			mysql_fetch_field_row(bb,"comp_perms");
			CharacterInfo[playerid][ii][cCompanyPerms] = strval(bb);
			mysql_fetch_field_row(bb,"comp_rank");
			format(CharacterInfo[playerid][ii][cCompanyRank],32,"%s",bb);
			mysql_fetch_field_row(bb,"acc");
			format(CharacterInfo[playerid][ii][cAccent],16,"%s",bb);
			mysql_fetch_field_row(bb,"lang");
			CharacterInfo[playerid][ii][cLanguage] = strval(bb);
			mysql_fetch_field_row(bb,"skill");
			CharacterInfo[playerid][ii][cSkill] = strval(bb);
			mysql_fetch_field_row(bb,"skill_lvl");
			CharacterInfo[playerid][ii][cSkillLevel] = strval(bb);
			mysql_fetch_field_row(bb,"pmodel");
			CharacterInfo[playerid][ii][cPhoneModel] = strval(bb);
			mysql_fetch_field_row(bb,"bail");
			CharacterInfo[playerid][ii][cBail] = strval(bb);
	        ii ++;

	    }
	    player_thread_inuse[playerid] = false;
	    BanCheck(playerid);
	    SpawnPlayer(playerid);

	}
	else if(type == QUERY_LOGIN_NOTES)
	{

	    new i = 0;
	    new b[256];
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(b,"id");
	        NoteInfo[playerid][i][nID] = strval(b);
	        mysql_fetch_field_row(b,"text");
	        format(NoteInfo[playerid][i][nText],256,"%s",b);
	        NoteInfo[playerid][i][nActive] = 1;
	        i ++;

	    }
	    format(b,sizeof(b),"* You are carrying %d notes.",i);
	    SendClientMessage(playerid,COLOR_YELLOW2,b);

	}
	else if(type == QUERY_LOAD_VEHICLES)
	{

	    new i = 0;
	    new b[256];
	    while(mysql_retrieve_row())
	    {

			mysql_fetch_field_row(b,"id");
			VehicleInfo[i][vID] = strval(b);
			mysql_fetch_field_row(b,"model");
			VehicleInfo[i][vModel] = strval(b);
			mysql_fetch_field_row(b,"spawn_x");
			VehicleInfo[i][vSpawnX] = floatstr(b);
			mysql_fetch_field_row(b,"spawn_y");
			VehicleInfo[i][vSpawnY] = floatstr(b);
			mysql_fetch_field_row(b,"spawn_z");
			VehicleInfo[i][vSpawnZ] = floatstr(b);
			mysql_fetch_field_row(b,"spawn_r");
			VehicleInfo[i][vSpawnR] = floatstr(b);
			mysql_fetch_field_row(b,"color1");
			VehicleInfo[i][vColor1] = strval(b);
			mysql_fetch_field_row(b,"color2");
			VehicleInfo[i][vColor2] = strval(b);
			mysql_fetch_field_row(b,"owning_character");
			VehicleInfo[i][vOwner] = strval(b);
			mysql_fetch_field_row(b,"mileage");
			VehicleInfo[i][vMileage] = strval(b);
			mysql_fetch_field_row(b,"lock");
			VehicleInfo[i][vLock] = strval(b);
			mysql_fetch_field_row(b,"locked");
			VehicleInfo[i][vLocked] = strval(b);
			mysql_fetch_field_row(b,"times_destroyed");
			VehicleInfo[i][vDestroyed] = strval(b);
			VehicleInfo[i][vEngine] = 0;
			mysql_fetch_field_row(b,"fuel");
			VehicleInfo[i][vFuel] = strval(b);
			mysql_fetch_field_row(b,"faction");
			VehicleInfo[i][vFaction] = strval(b);
			mysql_fetch_field_row(b,"owner_name");
			format(VehicleInfo[i][vOwnerName],MAX_PLAYER_NAME,"%s",b);
			mysql_fetch_field_row(b,"death_time");
			VehicleInfo[i][vDeathTime] = strval(b);
			mysql_fetch_field_row(b,"plate");
			format(VehicleInfo[i][vPlate],32,"%s",b);
			mysql_fetch_field_row(b,"insurance");
			VehicleInfo[i][vInsurance] = strval(b);
			mysql_fetch_field_row(b,"mods");
			format(VehicleInfo[i][vMods],256,"%s",b);
			mysql_fetch_field_row(b,"weapons");
			AssignVehicleWeapons(i,b);
			mysql_fetch_field_row(b,"paintjob");
			VehicleInfo[i][vPaintjob] = strval(b);
			mysql_fetch_field_row(b,"imp");
			VehicleInfo[i][vImpounded] = strval(b);
			mysql_fetch_field_row(b,"gps");
			VehicleInfo[i][vGps] = strval(b);
			mysql_fetch_field_row(b,"comp");
			VehicleInfo[i][vCompany] = strval(b);
			mysql_fetch_field_row(b,"dmg1");
			VehicleInfo[i][vDamage][0] = strval(b);
			mysql_fetch_field_row(b,"dmg2");
			VehicleInfo[i][vDamage][1] = strval(b);
			mysql_fetch_field_row(b,"dmg3");
			VehicleInfo[i][vDamage][2] = strval(b);
			mysql_fetch_field_row(b,"dmg4");
			VehicleInfo[i][vDamage][3] = strval(b);
			mysql_fetch_field_row(b,"hp");
			VehicleInfo[i][vHealth] = floatstr(b);
			mysql_fetch_field_row(b,"neon");
			VehicleInfo[i][vNeon] = strval(b);
			mysql_fetch_field_row(b,"immob");
			VehicleInfo[i][vImmob] = strval(b);
			if(!strlen(VehicleInfo[i][vPlate]) && VehicleInfo[i][vModel]) FetchVehiclePlate(i,VehicleInfo[i][vPlate]);
			mysql_fetch_field_row(b,"selling");
			VehicleInfo[i][vSelling] = strval(b);
			mysql_fetch_field_row(b,"sprice");
			VehicleInfo[i][vSellingPrice] = strval(b);
			mysql_fetch_field_row(b,"sexpire");
			VehicleInfo[i][vSellingExpire] = strval(b);
			i ++;

	    }
		CreateVehicles();

	}
	else if(type == QUERY_LOAD_HOUSES)
	{

	    new i = 0;
	    new b[256];
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(b,"id");
	        HouseInfo[i][hID] = strval(b);
	        mysql_fetch_field_row(b,"owning_character");
	        HouseInfo[i][hOwner] = strval(b);
	        mysql_fetch_field_row(b,"owner_name");
	        format(HouseInfo[i][hOwnerName],MAX_PLAYER_NAME,"%s",b);
	        mysql_fetch_field_row(b,"price");
	        HouseInfo[i][hPrice] = strval(b);
	        mysql_fetch_field_row(b,"spawn_x");
	        HouseInfo[i][hSpawnX] = floatstr(b);
	        mysql_fetch_field_row(b,"spawn_y");
	        HouseInfo[i][hSpawnY] = floatstr(b);
	        mysql_fetch_field_row(b,"spawn_z");
	        HouseInfo[i][hSpawnZ] = floatstr(b);
	        mysql_fetch_field_row(b,"interior_x");
			HouseInfo[i][hInteriorX] = floatstr(b);
			mysql_fetch_field_row(b,"interior_y");
			HouseInfo[i][hInteriorY] = floatstr(b);
			mysql_fetch_field_row(b,"interior_z");
			HouseInfo[i][hInteriorZ] = floatstr(b);
			mysql_fetch_field_row(b,"interior_r");
			HouseInfo[i][hInteriorR] = floatstr(b);
			mysql_fetch_field_row(b,"interior");
			HouseInfo[i][hInterior] = strval(b);
			mysql_fetch_field_row(b,"locked");
			HouseInfo[i][hLocked] = strval(b);
			mysql_fetch_field_row(b,"rent_price");
			HouseInfo[i][hRentPrice] = strval(b);
			mysql_fetch_field_row(b,"bank");
			HouseInfo[i][hBank] = strval(b);
			mysql_fetch_field_row(b,"inv");
			format(HouseInfo[i][hInventory],256,"%s",b);
			LoadHouseInventory(i);
			mysql_fetch_field_row(b,"weapons");
			AssignHouseWeapons(i,b);
			mysql_fetch_field_row(b,"upgrades");
			AssignHouseUpgrades(i,b);
			mysql_fetch_field_row(b,"rentable");
			HouseInfo[i][hRentable] = strval(b);
			mysql_fetch_field_row(b,"level");
			HouseInfo[i][hLevel] = strval(b);
			i ++;

	    }
	    CreateHouses();

	}
	else if(type == QUERY_LOAD_BIZES)
 	{

		new i = 0;
		new b[256];
		while(mysql_retrieve_row())
		{

		    for(new z = 0; z < 5; z ++){ used_vehicle_slots[i][z] = -1; }
	        mysql_fetch_field_row(b,"id");
	        BizInfo[i][bID] = strval(b);
	        mysql_fetch_field_row(b,"owning_character");
	        BizInfo[i][bOwner] = strval(b);
	        mysql_fetch_field_row(b,"owner_name");
	        format(BizInfo[i][bOwnerName],MAX_PLAYER_NAME,"%s",b);
	        mysql_fetch_field_row(b,"price");
	        BizInfo[i][bPrice] = strval(b);
	        mysql_fetch_field_row(b,"spawn_x");
	        BizInfo[i][bSpawnX] = floatstr(b);
	        mysql_fetch_field_row(b,"spawn_y");
	        BizInfo[i][bSpawnY] = floatstr(b);
	        mysql_fetch_field_row(b,"spawn_z");
	        BizInfo[i][bSpawnZ] = floatstr(b);
	        mysql_fetch_field_row(b,"interior_x");
			BizInfo[i][bInteriorX] = floatstr(b);
			mysql_fetch_field_row(b,"interior_y");
			BizInfo[i][bInteriorY] = floatstr(b);
			mysql_fetch_field_row(b,"interior_z");
			BizInfo[i][bInteriorZ] = floatstr(b);
			mysql_fetch_field_row(b,"interior");
			BizInfo[i][bInterior] = strval(b);
			mysql_fetch_field_row(b,"type");
			BizInfo[i][bType] = strval(b);
			mysql_fetch_field_row(b,"open");
			BizInfo[i][bOpen] = strval(b);
			mysql_fetch_field_row(b,"vehicle_spawn_x");
			BizInfo[i][bVX] = floatstr(b);
			mysql_fetch_field_row(b,"vehicle_spawn_y");
			BizInfo[i][bVY] = floatstr(b);
			mysql_fetch_field_row(b,"vehicle_spawn_z");
			BizInfo[i][bVZ] = floatstr(b);
			mysql_fetch_field_row(b,"vehicle_spawn_r");
			BizInfo[i][bVR] = floatstr(b);
			mysql_fetch_field_row(b,"open");
			BizInfo[i][bOpen] = strval(b);
			mysql_fetch_field_row(b,"bank");
			BizInfo[i][bBank] = strval(b);
			mysql_fetch_field_row(b,"fuel_price");
			BizInfo[i][bFuelPrice] = strval(b);
			mysql_fetch_field_row(b,"name");
			format(BizInfo[i][bName],256,"%s",b);
			mysql_fetch_field_row(b,"bill_time");
			BizInfo[i][bBillTime] = strval(b);
			mysql_fetch_field_row(b,"efee");
			BizInfo[i][bEntranceFee] = strval(b);
			mysql_fetch_field_row(b,"level");
			BizInfo[i][bLevel] = strval(b);
			stock_value_oldchange[i] = (BizInfo[i][bBank] != 0) ? (BizInfo[i][bBank] / 100) : 0;
			i ++;

		}
		CreateBizes();

	}
	else if(type == QUERY_LOAD_MODELS)
	{

		new b[256];
		new i = 0;
		while(mysql_retrieve_row())
		{

			mysql_fetch_field_row(b,"model");
			VehicleModelInfo[i][vmModel] = strval(b);
			mysql_fetch_field_row(b,"name");
			format(VehicleModelInfo[i][vmName],256,"%s",b);
			mysql_fetch_field_row(b,"price");
			VehicleModelInfo[i][vmPrice] = strval(b);
			mysql_fetch_field_row(b,"emergency_vehicle");
			VehicleModelInfo[i][vmEmerVeh] = strval(b);
			mysql_fetch_field_row(b,"donator_vehicle");
			VehicleModelInfo[i][vmDonatorVeh] = floatstr(b);
			mysql_fetch_field_row(b,"vehicle_type");
			VehicleModelInfo[i][vmType] = strval(b);
			mysql_fetch_field_row(b,"insurance_price");
			VehicleModelInfo[i][vmInsurancePrice] = strval(b);
			mysql_fetch_field_row(b,"news");
			VehicleModelInfo[i][vmNews] = strval(b);
			mysql_fetch_field_row(b,"fuel_interval");
			VehicleModelInfo[i][vmFuelInterval] = strval(b);
			i ++;

		}
		vehicle_creating = 0;
		print("Vehicle Models Loaded.");
		CreateBuyVehicles();

	}
	else if(type == QUERY_LOAD_FACTIONS)
	{

		new b[256];
		new i = 0;
		while(mysql_retrieve_row())
		{

		    mysql_fetch_field_row(b,"id");
			FactionInfo[i][fID] = strval(b);
			mysql_fetch_field_row(b,"name");
			format(FactionInfo[i][fName],256,"%s",b);
			mysql_fetch_field_row(b,"short_name");
			format(FactionInfo[i][fShortName],256,"%s",b);
			mysql_fetch_field_row(b,"bank");
			FactionInfo[i][fBank] = strval(b);
			mysql_fetch_field_row(b,"type");
			FactionInfo[i][fType] = strval(b);
			i ++;

		}

	}
	else if(type == QUERY_LOGIN_MAIL)
	{

	    new b[256];
	    new i = 0;
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(b,"id");
			MailInfo[playerid][i][mID] = strval(b);
			mysql_fetch_field_row(b,"sender");
			format(MailInfo[playerid][i][mSender],MAX_PLAYER_NAME,"%s",b);
			mysql_fetch_field_row(b,"subject");
			format(MailInfo[playerid][i][mSubject],64,"%s",b);
			mysql_fetch_field_row(b,"msg");
			format(MailInfo[playerid][i][mMsg],256,"%s",b);
			mysql_fetch_field_row(b,"active");
			MailInfo[playerid][i][mActive] = strval(b);
			mysql_fetch_field_row(b,"read");
			MailInfo[playerid][i][mRead] = strval(b);
			i ++;

	    }
	    RefreshCharacterMail(GetCharacterID(playerid));

	}
	else if(type == QUERY_FIND_MAIL)
	{

		new id = mysql_retrieve_row();
		if(id > -1)
		{
	        composing_mail[playerid] = 2;
	        composing_mail_to[playerid] = id;
	        SendClientMessageA(playerid,COLOR_GREEN,"Pleae type the subject for your message.");

		}
		else
		{

			SendClientMessageA(playerid,COLOR_LIGHTRED,"Could Not Find Player. Please make sure you spelt the name correctlly.");

		}

	}
	else if(type == QUERY_SEND_MAIL)
	{

     	if(composing_mail[playerid]) { SendClientMessageA(playerid,COLOR_GREEN,"Your message has been sent"); }
	    composing_mail[playerid] = 0;
	    TogglePlayerControllable(playerid,1);

	}
	else if(type == QUERY_LOAD_INTERIORS)
	{

	    new b[256];
	    new i = 0;
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(b,"id");
			InteriorInfo[i][iID] = strval(b);
			mysql_fetch_field_row(b,"spawn_x");
			InteriorInfo[i][iSpawnX] = floatstr(b);
			mysql_fetch_field_row(b,"spawn_y");
			InteriorInfo[i][iSpawnY] = floatstr(b);
			mysql_fetch_field_row(b,"spawn_z");
			InteriorInfo[i][iSpawnZ] = floatstr(b);
			mysql_fetch_field_row(b,"interior_x");
			InteriorInfo[i][iInteriorX] = floatstr(b);
			mysql_fetch_field_row(b,"interior_y");
			InteriorInfo[i][iInteriorY] = floatstr(b);
			mysql_fetch_field_row(b,"interior_z");
			InteriorInfo[i][iInteriorZ] = floatstr(b);
			mysql_fetch_field_row(b,"interior");
			InteriorInfo[i][iInterior] = strval(b);
			mysql_fetch_field_row(b,"lock");
			InteriorInfo[i][iLock] = strval(b);
			mysql_fetch_field_row(b,"faction");
			InteriorInfo[i][iFaction] = strval(b);
			i ++;

	    }
	    CreateInteriors();

	}
	else if(type == QUERY_LOGIN_BANCHECK)
	{

		new num = mysql_num_rows();
		if(num > 0) { SendClientMessageA(playerid,COLOR_LIGHTRED,"This account or IP address is BANNED! You cannot continue playing."); Kick(playerid); }

	}
	else if(type == QUERY_HOUSE_SAVE)
	{

	    active_house_save ++;
		SaveHouses();

	}
	else if(type == QUERY_BIZ_SAVE)
	{

	    active_biz_save ++;
		SaveBizes();

	}
	else if(type == QUERY_VEHICLES_SAVE)
	{

		SaveVehicles();

	}
	else if(type == QUERY_LOAD_RADIO)
	{

 		new b[256];
	    new i = 0;
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(b,"id");
			RadioInfo[i][rID] = strval(b);
			mysql_fetch_field_row(b,"channel");
			RadioInfo[i][rChannel] = strval(b);
			mysql_fetch_field_row(b,"owning_character");
			RadioInfo[i][rOwner] = strval(b);
			mysql_fetch_field_row(b,"password");
			format(RadioInfo[i][rPassword],16,"%s",b);
			i ++;

	    }
	    print("Radio Channels Loaded.");

	}
	else if(type == QUERY_RADIO_CREATE)
	{

	    RadioInfo[playerid][rID] = mysql_insert_id();

	}
	else if(type == QUERY_SAVE_INTERIORS)
	{

	    active_interior_save ++;
	    SaveInteriors();

	}
	else if(type == QUERY_SAVE_PLAYER)
	{

	    if(server_restarting) { active_player_saves --; CheckRestartState(); }
		if(afk_reset[(playerid - 1000)]) { StopPlayerRadio((playerid - 1000)); character_chosen[(playerid - 1000)] = 0; active_character[(playerid - 1000)] = -1; ResetStats((playerid - 1000)); ProcessSpawn((playerid - 1000)); }

	}
	else if(type == QUERY_CREATE_NOTE)
	{

	    if(creating_note[playerid] > -1)
	    {

			NoteInfo[playerid][creating_note[playerid]][nID] = mysql_insert_id();
			creating_note[playerid] = -1;

		}

	}
	else if(type == QUERY_LOGIN_INVENTORY)
	{

 		new b[256];
	    new i = 0;
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(b,"id");
			InventoryInfo[playerid][i][inID] = strval(b);
			mysql_fetch_field_row(b,"item");
			InventoryInfo[playerid][i][inItem] = strval(b);
			mysql_fetch_field_row(b,"amount");
			InventoryInfo[playerid][i][inAmount] = strval(b);
			i ++;

	    }

	}
	else if(type == QUERY_LOAD_DRUGS)
	{

	 	new b[256];
	    new i = 0;
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(b,"id");
			DrugInfo[i][dID] = strval(b);
			mysql_fetch_field_row(b,"type");
			DrugInfo[i][dType] = strval(b);
			mysql_fetch_field_row(b,"spawn_x");
			DrugInfo[i][dSpawnX] = floatstr(b);
			mysql_fetch_field_row(b,"spawn_y");
			DrugInfo[i][dSpawnY] = floatstr(b);
			mysql_fetch_field_row(b,"spawn_z");
			DrugInfo[i][dSpawnZ] = floatstr(b);
			mysql_fetch_field_row(b,"planted");
			DrugInfo[i][dTime] = strval(b);
			i ++;

	    }
	    CreateDrugs();

	}
	else if(type == QUERY_DRUG_SAVE)
	{

	    active_drug_save ++;
		SaveDrugs();

	}
	else if(type == QUERY_LOAD_VINVENTORY)
	{

		new b[256];
	    new i = 0;
	    while(mysql_retrieve_row())
	    {

			mysql_fetch_field_row(b,"owning_vehicle");
			new slot = GetVehicleSlotFromID(strval(b));
			new a = 0;
			new is = -1;
			do{

				if(VehicleInventory[slot][a][vinItem] == -1) { is = a; }
				a ++;

			} while(is == -1 && a < MAX_INVENTORY);
			if(is > -1)
			{
		        mysql_fetch_field_row(b,"id");
				VehicleInventory[slot][is][vinID] = strval(b);
				mysql_fetch_field_row(b,"item");
				VehicleInventory[slot][is][vinItem] = strval(b);
				mysql_fetch_field_row(b,"amount");
				VehicleInventory[slot][is][vinAmount] = strval(b);
			}
			i ++;

	    }
	    print("Vehicle Inventory Loaded.");

	}
	else if(type == QUERY_CREATE_VINVENTORY)
	{

		if(adding_vinventory[(playerid - 100000)] > -1)
	    {

			VehicleInventory[(playerid - 100000)][adding_vinventory[(playerid - 100000)]][vinID] = mysql_insert_id();
			adding_vinventory[(playerid - 100000)] = -1;

	    }

	}
	else if(type == QUERY_SAVE_VINVENTORY)
	{

	   	if(adding_vinventory[(playerid - 100000)] > -1)
	    {

			adding_vinventory[(playerid - 100000)] = -1;

	    }

	}
	else if(type == QUERY_CREATE_ACCOUNT)
	{

        tmp_account_id[playerid] = mysql_insert_id();

	}
	else if(type == QUERY_CREATE_CHAR)
	{

	    if(!mysql_num_rows())
	    {

			new skin = (strcmp(reg_sex[playerid],"male",true) == 0) ? 177 : 192;
	        new str3[1024];
		    format(str3,sizeof(str3),"INSERT INTO rp_characters (name,skin,spawn_x,spawn_y,spawn_z,spawn_r,owner,pay_time,level,gender,dob,ethnicity,radio_auth,health,money,bank) VALUES ('%s','%d','1929.0565','33.6534','33.9817','270','%d','3600','1','%s',NOW(),'White','none',100,'5000','8000')",clean_save_name[playerid],skin,tmp_account_id[playerid],reg_sex[playerid]);
		    mysql_query(str3,player_threads[playerid]);
			format(str3,sizeof(str3),"INSERT INTO ucp_donator_items (User,Type) VALUES ('%d',1)",tmp_account_id[playerid]);
			mysql_query(str3,player_threads_alt[playerid]);
		    tmp_account_id[playerid] = -1;
		    SendClientMessage(playerid,COLOR_YELLOW,"Thank you for registering on Just Roleplay. To change your characters details please visit our UCP @ http://ucp.justrp.net");
		    SendClientMessage(playerid,COLOR_YELLOW,"http://ucp.justrp.net");
		    OnPlayerConnect(playerid);

		}
		else
		{

		    SendClientMessage(playerid,COLOR_LIGHTRED,"That character name is already taken. Please choose another.");
		    ShowPlayerDialog(playerid,DIALOG_REG4,DIALOG_STYLE_INPUT,"Character Creation","Please type the FULL name of your character. In the following format: Firstname_Lastname (remember to incldue the underscore)","Confirm","");

		}

	}
	else if(type == QUERY_REQCALLS)
	{

	    new b[256];
		SendClientMessage(playerid,COLOR_YELLOW2,"|-----Recent Calls-----|");
		if(mysql_num_rows())
		{

			while(mysql_retrieve_row())
			{

			    mysql_fetch_field_row(b,"id");
			    new id = strval(b);
			    mysql_fetch_field_row(b,"situation");
			    new sit[64];
				strcat(sit,b,sizeof(sit));
				mysql_fetch_field_row(b,"stamp2");
			    new str3[256];
			    format(str3,sizeof(str3),"Call %d: %s (%s)",id,sit,b);
			    SendClientMessageA(playerid,COLOR_YELLOW2,str3);

			}

		}
		else
		{

		    SendClientMessage(playerid,COLOR_LIGHTRED,"No Calls");

		}

	}
	else if(type == QUERY_WARRANTS)
	{

		if(mysql_num_rows())
		{

			new b[256];
			while(mysql_retrieve_row())
			{

				new crime[128];
			    mysql_fetch_field_row(b,"crime");
			    strcat(crime,b);
			    mysql_fetch_field_row(b,"stamp");
			    new str3[256];
			    format(str3,sizeof(str3),"WARRANT: %s (%s)",crime,b);
			    SendClientMessageA(playerid,COLOR_LIGHTRED,str3);
			    PlayerPlaySound(playerid,1085,0.0,0.0,0.0);

			}

		}
		else
		{

		    SendClientMessage(playerid,COLOR_WHITE,"No Outstanding Warrants");

		}
		new fine_str[256];
		format(fine_str,sizeof(fine_str),"SELECT * FROM rp_fines WHERE suspect = '%d' AND paid = 0",GetPVarInt(playerid,"mdc_otherid"));
		mysql_query(fine_str,player_threads[playerid],QUERY_MDC_FINE);

	}
	else if(type == QUERY_GETCALL)
	{

	    if(mysql_num_rows())
	    {

			while(mysql_retrieve_row())
			{

			    new caller[MAX_PLAYER_NAME];
			    mysql_fetch_field_row(caller,"caller");
			    new number[64];
			    mysql_fetch_field_row(number,"phone");
			    new location[128];
			    mysql_fetch_field_row(location,"location");
			    new situation[128];
			    mysql_fetch_field_row(situation,"situation");
			    new stamp[64];
			    mysql_fetch_field_row(stamp,"stamp");
				new tmp[256];
				SendClientMessage(playerid,COLOR_YELLOW2,"|-----Call Information-----|");
				format(tmp,sizeof(tmp),"{808080}Caller: {FFFFFF}%s",caller);
				SendClientMessage(playerid,COLOR_WHITE,tmp);
				format(tmp,sizeof(tmp),"{808080}Phone: {FFFFFF}%s",number);
				SendClientMessage(playerid,COLOR_WHITE,tmp);
				format(tmp,sizeof(tmp),"{808080}Location: {FFFFFF}%s",location);
				SendClientMessage(playerid,COLOR_WHITE,tmp);
				format(tmp,sizeof(tmp),"{808080}Situation: {FFFFFF}%s",situation);
				SendClientMessageA(playerid,COLOR_WHITE,tmp);
				format(tmp,sizeof(tmp),"{808080}Called: {FFFFFF}%s",stamp);
				SendClientMessage(playerid,COLOR_WHITE,tmp);

			}

	    }
	    else
	    {

	        SendClientMessage(playerid,COLOR_LIGHTRED,"Call not found.");

	    }

	}
	else if(type == QUERY_DELETE_VINVENTORY)
	{

	    for(new slot = 0; slot < MAX_INVENTORY; slot ++)
		{

	   		if(VehicleInventory[(playerid - 100000)][slot][vinID] > 0 && VehicleInventory[(playerid - 100000)][slot][vinItem] == -1) { VehicleInventory[(playerid - 100000)][slot][vinID] = 0; }

	    }

	}
	else if(type == QUERY_REQ_STATIONS)
	{

	    if(!mysql_num_rows()) { SendClientMessage(playerid,COLOR_LIGHTRED,"No radio stations available."); } else {

	        SendClientMessage(playerid,COLOR_YELLOW2,"|------Radio Stations------|");
	        new b[64];
	        new b2[64];
	        new str3[128];
	        while(mysql_retrieve_row())
	        {

                mysql_fetch_field_row(b,"radioID");
		        mysql_fetch_field_row(b2,"Station");
				format(str3,sizeof(str3),"Station %s: %s",b,b2);
				SendClientMessage(playerid,COLOR_YELLOW2,str3);

	        }
	        SendClientMessage(playerid,COLOR_YELLOW2,"Use /radio set [Station ID] to set your radio station.");

	    }


	}
	else if(type == QUERY_SET_STATION)
	{

	    if(!mysql_num_rows()) { SendErrorMsg(playerid,"Radio Station Not Found"); } else {

		    Audio_Stop(playerid,radio_handle[playerid]);
	        new b[256];
			new d[3][256];
			mysql_fetch_row_format(b);
			explode(d,b,"|");
			new url[256];
			radio_id[playerid] = strval(d[0]);
			format(url,sizeof(url),"%s",d[2]);
			Audio_StopRadio(playerid);
			radio_handle[playerid] = Audio_PlayStreamed(playerid,url);
			Audio_SetVolume(playerid,radio_handle[playerid],radio_volume[playerid]);
			SendClientMessage(playerid,COLOR_YELLOW2,"Use /radio volume [1-100] to set the volume, or /radio stop to stop the radio station.");
			new veh = GetPlayerVehicleID(playerid);
			vehicle_radioid[veh] = radio_id[playerid];
			format(vehicle_radio[veh],256,"%s",url);
			format(player_radio[playerid],256,"%s",url);
			SyncRadioPassengers(veh);
			SendEmote(playerid,"changes the radio station.");

	    }

	}
	else if(type == QUERY_LOAD_INVENTORY)
	{

		mysql_retrieve_row();
	    new bb[256];
	    mysql_fetch_field_row(bb,"inventory");
	    GiveSavedInventory((playerid - 20000),bb);

	}
	else if(type == QUERY_CASH_CHEQUE)
	{

	    new i = 1;
	    new done = 0;
	    while(mysql_retrieve_row())
	    {

	        if(i == requesting_cheque[playerid])
	        {

		    	new bb[256];
				mysql_fetch_field_row(bb,"id");
				new id = strval(bb);
				mysql_fetch_field_row(bb,"amount");
				new amount = strval(bb);
				mysql_fetch_field_row(bb,"sender");
				new other = strval(bb);
				CompleteChequeCash(id,playerid,other,amount);
				done = 1;

			}
			i ++;

	    }
		if(!done) SendClientMessage(playerid,COLOR_LIGHTRED,"There are no cheques in this slot.");

	}
	else if(type == QUERY_VIEW_CHEQUES)
	{

		SendClientMessage(playerid,COLOR_YELLOW2,"|-----Your Cheques-----|");
		new ii = 1;
		while(mysql_retrieve_row())
		{

		    new bbb[128];
		    mysql_fetch_field_row(bbb,"amount");
			new str3[128];
			format(str3,sizeof(str3),"Cheque #%d: $%s",ii,bbb);
			SendClientMessage(playerid,COLOR_YELLOW2,str3);
			ii ++;

		}

	}
	else if(type == QUERY_TENANTS)
	{

	    SendClientMessage(playerid,COLOR_YELLOW2,"|-----Your Tenants-----|");
		new tid = 1;
		while(mysql_retrieve_row())
		{

		    new tstr[MAX_PLAYER_NAME], tstr2[128];
		    mysql_fetch_field_row(tstr,"name");
			format(tstr2,sizeof(tstr2),"#%d: %s",tid,tstr);
			SendClientMessage(playerid,COLOR_YELLOW2,tstr2);

		}
		SendClientMessage(playerid,COLOR_YELLOW2,"Usage /evict [tenant #] to evict a tenant");

	}
	else if(type == QUERY_EVICT)
	{

		new tid = 1;
		new evict_str[256];
		new evict_tmp[256];
		new evict_int = 0;
		new evict_ustr[128];
		new done = 0;
		while(mysql_retrieve_row())
		{

			if(tid == evicting_tenant[playerid])
			{

				mysql_fetch_field_row(evict_str,"id");
				evict_int = strval(evict_str);
				mysql_fetch_field_row(evict_tmp,"name");
				new other = IsCharacterOnline(evict_int);
				if(other > -1)
				{

					CharacterInfo[other][active_character[other]][cRenting] = 0;
					done = 1;

				}
				else
				{

					format(evict_str,sizeof(evict_str),"UPDATE rp_characters SET renting = '0' WHERE id = '%d' LIMIT 1",evict_int);
					mysql_query(evict_str,player_threads[playerid]);
					done = 1;

				}
				format(evict_ustr,sizeof(evict_ustr),"You have evicted %s from your house.",evict_tmp);
				SendClientMessage(playerid,COLOR_YELLOW,evict_ustr);

			}
			tid ++;

		}
		if(!done) SendClientMessage(playerid,COLOR_LIGHTRED,"No tenant in this slot.");
		evicting_tenant[playerid] = 0;

	}
	else if(type == QUERY_APB)
	{

		SendClientMessage(playerid,COLOR_LIGHTRED,"|----APBs----|");
		new apb_str[256];
		new apb_id = 0;
		new apb_suspect[64];
		new apb_send[256];
		while(mysql_retrieve_row())
		{

		    mysql_fetch_field_row(apb_str,"id");
		    apb_id = strval(apb_str);
		    mysql_fetch_field_row(apb_str,"suspect");
		    format(apb_suspect,sizeof(apb_suspect),"%s",apb_str);
		    format(apb_send,sizeof(apb_send),"#%d: %s",apb_id,apb_suspect);
		    SendClientMessage(playerid,COLOR_LIGHTRED,apb_send);

		}
		SendClientMessage(playerid,COLOR_LIGHTRED,"Usage /apb read to read an APB");

	}
	else if(type == QUERY_APB_READ)
	{

		if(mysql_num_rows())
		{

		    new read_apb_str[256];
		    new read_apb_id = 0;
		    new read_apb_suspect[128];
		    new read_apb_crime[128];
		    new read_apb_stamp[128];
			mysql_retrieve_row();
			mysql_fetch_field_row(read_apb_str,"id");
			read_apb_id = strval(read_apb_str);
			mysql_fetch_field_row(read_apb_str,"suspect");
			format(read_apb_suspect,sizeof(read_apb_suspect),"%s",read_apb_str);
			mysql_fetch_field_row(read_apb_str,"crime");
			format(read_apb_crime,sizeof(read_apb_crime),"%s",read_apb_str);
			mysql_fetch_field_row(read_apb_str,"stamp");
			format(read_apb_stamp,sizeof(read_apb_stamp),"%s",read_apb_str);
			SendClientMessage(playerid,COLOR_LIGHTRED,"|-----APB Information-----|");
			format(read_apb_str,sizeof(read_apb_str),"APB #: %d",read_apb_id);
			SendClientMessage(playerid,COLOR_LIGHTRED,read_apb_str);
			format(read_apb_str,sizeof(read_apb_str),"Suspect/Vehicle: %s",read_apb_suspect);
			SendClientMessage(playerid,COLOR_LIGHTRED,read_apb_str);
			format(read_apb_str,sizeof(read_apb_str),"Crime: %s",read_apb_crime);
			SendClientMessage(playerid,COLOR_LIGHTRED,read_apb_str);
			format(read_apb_str,sizeof(read_apb_str),"Created: %s",read_apb_stamp);
			SendClientMessage(playerid,COLOR_LIGHTRED,read_apb_str);

		}
		else
		{

		    SendClientMessage(playerid,COLOR_LIGHTRED,"No APB with this ID available.");

		}

	}
	else if(type == QUERY_APB_CREATE)
	{

		new apb_write_name[MAX_PLAYER_NAME];
		GetCharacterName(playerid,apb_write_name);
		new apb_write_str[256];
		new apb_write_id = mysql_insert_id();
		format(apb_write_str,sizeof(apb_write_str),"%s %s has just issued a new APB, use /apb read %d to read it.",CharacterInfo[playerid][active_character[playerid]][cRankName],apb_write_name,apb_write_id);
		SendFactionMessage(CharacterInfo[playerid][active_character[playerid]][cFaction],apb_write_str);

	}
	else if(type == QUERY_SAVE_FACTIONS)
	{

	    active_faction_save ++;
	    if(active_faction_save < sizeof(FactionInfo))
	    {

	        SaveFactions();

	    }
	    else
	    {
	    
	        active_faction_save = 0;
	        print("Factions Saved.");
	        SendAdminBroadcast("[SERVER] Factions Successfully Saved");
			if(server_restarting) {
			    saved_vars ++;
		        CheckRestartState();
			}

	    }

	}
	else if(type == QUERY_LOAD_COMPANIES)
	{

		new i = 0;
		while(mysql_retrieve_row())
		{

    		new comp_str[256];
		    mysql_fetch_field_row(comp_str,"id");
		    CompanyInfo[i][ciID] = strval(comp_str);
		    mysql_fetch_field_row(comp_str,"name");
			format(CompanyInfo[i][ciName],64,"%s",comp_str);
			mysql_fetch_field_row(comp_str,"bank");
			CompanyInfo[i][ciBank] = strval(comp_str);
			mysql_fetch_field_row(comp_str,"jobs_complete");
			CompanyInfo[i][ciJobsComplete] = strval(comp_str);
			mysql_fetch_field_row(comp_str,"type");
			CompanyInfo[i][ciType] = strval(comp_str);
			mysql_fetch_field_row(comp_str,"pay_rate");
			CompanyInfo[i][ciPayRate] = strval(comp_str);
			mysql_fetch_field_row(comp_str,"job_money");
			CompanyInfo[i][ciJobMoney] = strval(comp_str);
			i ++;

		}
		print("Companies Loaded.");

	}
	else if(type == QUERY_WORKLOGS)
	{

	    new dialogstr[1024];
	    while(mysql_retrieve_row())
	    {

	        new tmp[128];
	        new namestr[MAX_PLAYER_NAME];
			new paystr[128];
	        new typestr[128];
	        mysql_fetch_field_row(namestr,"name");
         	mysql_fetch_field_row(paystr,"pay");
         	mysql_fetch_field_row(typestr,"type");
			format(tmp,sizeof(tmp),"%s completed a %s | Money made: $%s\n",namestr,typestr,paystr);
			strins(dialogstr,tmp,strlen(dialogstr));

	    }
	    ShowPlayerDialog(playerid,999,DIALOG_STYLE_LIST,"Recentlly Completed Jobs...",dialogstr,"Ok","Close");

	}
	else if(type == QUERY_SAVE_RIGS)
	{

	    active_rig_save ++;
		SaveRigs();

	}
	else if(type == QUERY_LOAD_RIGS)
	{

		new i = 0;
		while(mysql_retrieve_row())
		{

    		new rig_str[256];
			mysql_fetch_field_row(rig_str,"owner");
			oil_rig_owners[i] = strval(rig_str);
			mysql_fetch_field_row(rig_str,"level");
			oil_rig_levels[i] = strval(rig_str);
			if(oil_rig_owners[i] > 0)
			{

                oil_rig_objects[i] = F_CreateObject(3426,oil_rigs[i][0],oil_rigs[i][1],oil_rigs[i][2],0.0,0.0,0.0);

			}
			i ++;

		}
		print("Rigs Loaded.");

	}
	else if(type == QUERY_SAVE_COMPANY)
	{

	    active_company_save ++;
	    SaveCompanies();

	}
	else if(type == QUERY_BUY_STOCK)
	{

	    new stype = buying_stock[playerid];
	    new amount = buying_stock_amount[playerid];
	    new bstock_str[256];
	    if(!mysql_num_rows())
	    {

         	format(bstock_str,sizeof(bstock_str),"INSERT INTO rp_stock (owner,type,amount) VALUES ('%d','%d','%d')",CharacterInfo[playerid][active_character[playerid]][cID],stype,amount);
			mysql_query(bstock_str,player_threads[playerid]);

	    }
	    else
	    {

	        format(bstock_str,sizeof(bstock_str),"UPDATE rp_stock SET amount = '%d' WHERE owner = '%d' AND type = '%d'",amount,CharacterInfo[playerid][active_character[playerid]][cID],stype);
			mysql_query(bstock_str,player_threads[playerid]);

	    }
	    buying_stock[playerid] = 0;
	    buying_stock_amount[playerid] = 0;

	}
	else if(type == QUERY_STOCK_LIST)
	{

		new i = 1;
		SendClientMessage(playerid,COLOR_YELLOW2,"|-----Your Stocks-----|");
		while(mysql_retrieve_row())
		{

    		new stock_str[256];
			mysql_fetch_field_row(stock_str,"type");
			new stype = strval(stock_str);
			mysql_fetch_field_row(stock_str,"amount");
			new amount = strval(stock_str);
			new stock_send_str[128];
			new name[64];
			GetStockName(stype,name);
			format(stock_send_str,128,"#%d: %d x %s",i,amount,name);
			SendClientMessage(playerid,COLOR_WHITE,stock_send_str);
			i ++;

		}

	}
	else if(type == QUERY_SELL_STOCK)
	{

	    new i = 1;
	    new sdone = 0;
	    while(mysql_retrieve_row())
	    {

	        new sells_str[256];
	        if(i == selling_stock_slot[playerid])
	        {

	            mysql_fetch_field_row(sells_str,"id");
	            new tmpid = strval(sells_str);
		  		mysql_fetch_field_row(sells_str,"amount");
		  		new amount = strval(sells_str);
		  		mysql_fetch_field_row(sells_str,"type");
		  		new setype = strval(sells_str);
		  		new name[64];
		  		GetStockName(setype,name);
		  		new se_send_str[256];
		  		new price = (stock_value[setype] * amount);
		  		sell_stock_price[playerid] = price;
		  		format(se_send_str,sizeof(se_send_str),"{FFFFFF}You are about to sell your stocks in {FF0000}%s {FFFFFF}for {FF0000}$%d",name,price);
		  		SendConfirmationMsg(playerid,se_send_str,DIALOG_SELLSTOCK,tmpid);
				sdone = 1;

	        }
	        i ++;

	    }
	    if(!sdone)
	    {

	        SendClientMessage(playerid,COLOR_LIGHTRED,"There is no stock in this slot.");

	    }

	}
	else if(type == QUERY_COMPMEMBERS)
	{

	    while(mysql_retrieve_row())
	    {

	        new sendstr[128];
	        new membstr[MAX_PLAYER_NAME];
	        mysql_fetch_field_row(membstr,"name");
	        new rankstr[64];
	        mysql_fetch_field_row(rankstr,"comp_rank");
	        new charstr[16];
	        mysql_fetch_field_row(charstr,"id");
			new charid = strval(charstr);
			format(sendstr,sizeof(sendstr),"%s %s",rankstr,membstr);
			new color = (IsCharacterOnline(charid) > -1) ? COLOR_YELLOW2 : COLOR_GRAD1;
			SendClientMessage(playerid,color,sendstr);

	    }

	}
	else if(type == QUERY_LOAD_RINGTONE)
	{

		mysql_retrieve_row();
		new ringtone_src[256];
		mysql_fetch_field_row(ringtone_src,"stream");
		format(ringtone_sys_stream[playerid],256,ringtone_src);

	}
	else if(type == QUERY_RINGTONES)
	{

	    SendClientMessage(playerid,COLOR_YELLOW2,"|-----Available Ringtones-----|");
	    new ringi = 1;
		while(mysql_retrieve_row())
		{

		    new ringtmp1[64];
		    mysql_fetch_field_row(ringtmp1,"name");
		    new ringsendstr[256];
		    format(ringsendstr,sizeof(ringsendstr),"#%d: %s",ringi,ringtmp1);
		    SendClientMessage(playerid,COLOR_YELLOW2,ringsendstr);
		    ringi ++;

		}
		SendClientMessage(playerid,COLOR_YELLOW2,"To preview a ringtone, use /ringtone listen [ringtone #]");

	}
	else if(type == QUERY_LISTEN_RINGTONE)
	{

	    new ringi = 1;
		while(mysql_retrieve_row())
		{

			if(ringi == listen_ringtone[playerid])
			{

			    new ringotmp1[64];
			    mysql_fetch_field_row(ringotmp1,"name");
			    new ringotmp2[256];
			    mysql_fetch_field_row(ringotmp2,"stream");
			    SendStrMsg(playerid,COLOR_YELLOW2,"Now previewing ringtone: %s",ringotmp1);
				new at = Audio_PlayStreamed(playerid,ringotmp2);
				Audio_SetVolume(playerid,at,100);

			}
			ringi ++;

		}

	}
	else if(type == QUERY_SET_RINGTONE)
	{

		new ringi = 1;
		while(mysql_retrieve_row())
		{

			if(ringi == listen_ringtone[playerid])
			{

			    new ringatmp1[64];
			    mysql_fetch_field_row(ringatmp1,"name");
			    new ringatmp2[256];
			    mysql_fetch_field_row(ringatmp2,"stream");
			    SendStrMsg(playerid,COLOR_YELLOW2,"You have set your ringtone to: %s",ringatmp1);
				format(ringtone_sys_stream[playerid],256,ringatmp2);
				new ringquery[256];
				format(ringquery,sizeof(ringquery),"INSERT INTO rp_active_ringtones (owner,stream) VALUES ('%d','%s')",CharacterInfo[playerid][active_character[playerid]][cID],ringatmp2);
				mysql_query(ringquery,player_threads[playerid]);

			}
			ringi ++;

		}

	}
	else if(type == QUERY_PURCHASE_VEHICLE)
	{

	    new slot = purchasing_vehicle[playerid];
	    if(slot > -1)
	    {

	        VehicleInfo[slot][vID] = mysql_insert_id();

     	}
     	purchasing_vehicle[playerid] = -1;

	}
	else if(type == QUERY_LOG_CON)
	{

	    AccountInfo[playerid][aConnectionID] = mysql_insert_id();

	}
	else if(type == QUERY_SIGN)
	{

	    new num = mysql_num_rows();
	    new sign_str[128];
	    format(sign_str,sizeof(sign_str),"Welcome to Palomino Creek\nPopulation: %d",num);
	    SetObjectMaterialText(sign_object_text, sign_str, 0, OBJECT_MATERIAL_SIZE_256x128,"Arial",22);

	}
	else if(type == QUERY_TUNE_BOOMBOX)
 	{

	    if(mysql_num_rows())
	    {

	        new boom_box_str[256];
	    	mysql_fetch_row_format(boom_box_str);
	    	new box = changing_boombox[playerid];
	    	changing_boombox[playerid] = -1;
	    	format(BoomBoxInfo[box][boStream],256,"%s",boom_box_str);
	    	SendEmote(playerid,"alters the radio station on the nearby boom box");
	    	RefreshBoomBoxListeners(box);

	    }
	    else
	    {

	        SendClientMessage(playerid,COLOR_LIGHTRED,"This radio station does not exist");

	    }

	}
	else if(type == QUERY_UNBAN)
	{

		if(mysql_num_rows())
		{

			new unban_str[256];
			mysql_fetch_row_format(unban_str);
			new unban_id = strval(unban_str);
			new ip[128];
			new unban_ip[128];
			GetPlayerIp(playerid,ip,sizeof(ip));
			mysql_real_escape_string(ip,unban_ip);
			new unban_query[256];
			format(unban_query,sizeof(unban_query),"DELETE FROM rp_bans WHERE banee = '%d' OR ip = '%s'",unban_id,unban_ip);
			mysql_query(unban_query,player_threads[playerid],QUERY_COMPLETE_UNBAN);

		}
		else
		{

			SendClientMessage(playerid,COLOR_LIGHTRED,"That account was not found");

		}

	}
	else if(type == QUERY_COMPLETE_UNBAN)
	{

	    SendClientMessage(playerid,COLOR_GREEN,"This user has been unbanned.");
	    new unban_final_query[256];
	    format(unban_final_query,sizeof(unban_final_query),"INSERT INTO rp_admin_logs (admin,player,action) VALUES ('%s','%s','Unban')",AccountInfo[playerid][aName],unbanning_player[playerid],player_threads[playerid]);
	    mysql_query(unban_final_query,player_threads[playerid]);

	}
	else if(type == QUERY_CHECKCLOTHES)
 	{

	    SendClientMessage(playerid,COLOR_YELLOW2,"|-----Your Clothing Items-----|");
	    new clstr[128];
	    new count = 1;
	    while(mysql_retrieve_row())
		{

		    new tmp[256];
		    new tmp2[256];
		    mysql_fetch_field_row(tmp,"name");
		    mysql_fetch_field_row(tmp2,"equip");
			new equipped = strval(tmp2);
			if(equipped) { format(tmp2,sizeof(tmp2),"Yes"); } else { format(tmp2,sizeof(tmp2),"No"); }
		    format(clstr,sizeof(clstr),"Slot #%d: %s equipped: %s",count,tmp,tmp2);
		    SendClientMessage(playerid,COLOR_YELLOW2,clstr);
		    count ++;

		}
		SendClientMessage(playerid,COLOR_YELLOW2,"Use /clothes equip [slot] to equip a peice of clothing.");

	}
	else if(type == QUERY_EQUIPCLOTHING)
	{

		if(mysql_num_rows() > 0)
		{

		    new count = 1;
			while(mysql_retrieve_row())
			{

			    if(count == cl_equipping[playerid])
			    {

					new cl_results[11][64];
					mysql_fetch_field_row(cl_results[0],"object");
					mysql_fetch_field_row(cl_results[1],"x");
					mysql_fetch_field_row(cl_results[2],"y");
					mysql_fetch_field_row(cl_results[3],"z");
					mysql_fetch_field_row(cl_results[4],"rx");
					mysql_fetch_field_row(cl_results[5],"ry");
					mysql_fetch_field_row(cl_results[6],"rz");
					mysql_fetch_field_row(cl_results[7],"bone");
					mysql_fetch_field_row(cl_results[8],"scalex");
					mysql_fetch_field_row(cl_results[9],"scaley");
					mysql_fetch_field_row(cl_results[10],"scalez");

					new cl_result = cl_SetClothing(playerid,CLOTHING_PLAYER,strval(cl_results[0]),strval(cl_results[7]),floatstr(cl_results[1]),floatstr(cl_results[2]),floatstr(cl_results[3]),floatstr(cl_results[4]),floatstr(cl_results[5]),floatstr(cl_results[6]),floatstr(cl_results[8]),floatstr(cl_results[9]),floatstr(cl_results[10]));
					if(cl_result) { SendClientMessage(playerid,COLOR_GREEN,"Clothing Equipped"); } else { SendClientMessage(playerid,COLOR_LIGHTRED,"Unable to equip clothing, you may have too many items equipped already."); }

					new cl_query[256];
					format(cl_query,sizeof(cl_query),"UPDATE rp_clothing SET equip = 1 WHERE owner = '%d'",CharacterInfo[playerid][active_character[playerid]][cID]);
					mysql_query(cl_query,player_threads[playerid]);

			    }
			    count ++;

			}

		}
		else
		{

		    SendClientMessage(playerid,COLOR_LIGHTRED,"You have nothing in this slot (/clothes list)");

		}
		cl_equipping[playerid] = 0;

	}
	else if(type == QUERY_AMMEND_LIST)
	{

	    new cl_ammend_str[32];
	    new cl_ammend_menu[1024];
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(cl_ammend_str,"name");
			new tmp[64];
			format(tmp,sizeof(tmp),"%s\n",cl_ammend_str);
	        strins(cl_ammend_menu,tmp,strlen(cl_ammend_menu));

	    }
	    ShowPlayerDialog(playerid,DIALOG_AMMENDMENU,DIALOG_STYLE_LIST,"Please choose a clothing item to ammend...",cl_ammend_menu,"Confirm","Cancel");

	}
	else if(type == QUERY_REQAMMEND)
	{

	    new cl_req_result[32];
	    new cl_req_count = 0;
	    while(mysql_retrieve_row())
	    {

	        if(cl_req_count == cl_editingitem[playerid])
	        {

				mysql_fetch_field_row(cl_req_result,"id");
				cl_editinguid[playerid] = strval(cl_req_result);

   				new cl_req_results[12][64];
				mysql_fetch_field_row(cl_req_results[0],"object");
				mysql_fetch_field_row(cl_req_results[1],"x");
				mysql_fetch_field_row(cl_req_results[2],"y");
				mysql_fetch_field_row(cl_req_results[3],"z");
				mysql_fetch_field_row(cl_req_results[4],"rx");
				mysql_fetch_field_row(cl_req_results[5],"ry");
				mysql_fetch_field_row(cl_req_results[6],"rz");
				mysql_fetch_field_row(cl_req_results[7],"bone");
				mysql_fetch_field_row(cl_req_results[8],"scalex");
				mysql_fetch_field_row(cl_req_results[9],"scaley");
				mysql_fetch_field_row(cl_req_results[10],"scalez");
				mysql_fetch_field_row(cl_req_results[11],"type");
				new cl_type = strval(cl_req_results[11]);

            	new Float:X, Float:Y, Float:Z, Float:X2, Float:Y2;
				GetPlayerPos(playerid,X,Y,Z);
				GetPosInFrontOfPlayer(playerid,X2,Y2,1.0);

				cl_SetClothing(playerid,CLOTHING_PLAYER,strval(cl_req_results[0]),strval(cl_req_results[7]),floatstr(cl_req_results[1]),floatstr(cl_req_results[2]),floatstr(cl_req_results[3]),floatstr(cl_req_results[4]),floatstr(cl_req_results[5]),floatstr(cl_req_results[6]),floatstr(cl_req_results[8]),floatstr(cl_req_results[9]),floatstr(cl_req_results[10]));
				new slot = cl_FetchObjectSlotFromObjectId(strval(cl_req_results[0]));
    			SetPlayerCameraPos(playerid,(X2 + cl_clothing_cams[cl_type][0]),(Y2 + cl_clothing_cams[cl_type][1]),(Z + cl_clothing_cams[cl_type][2]));
				SetPlayerCameraLookAt(playerid,X,Y,(Z + cl_clothing_cams[cl_type][2]));
			    cl_SetPlayerAmmendingClothing(playerid,0,"cl_OnEditAmmendClothes",slot);

	        }
	        cl_req_count ++;

	    }

	}
	else if(type == QUERY_DRESS_PLAYER)
	{

		new cl_dress_count = 1;
	    while(mysql_retrieve_row())
	    {

	    	new cl_eq_str[12][64];
			mysql_fetch_field_row(cl_eq_str[0],"object");
			mysql_fetch_field_row(cl_eq_str[1],"x");
			mysql_fetch_field_row(cl_eq_str[2],"y");
			mysql_fetch_field_row(cl_eq_str[3],"z");
			mysql_fetch_field_row(cl_eq_str[4],"rx");
			mysql_fetch_field_row(cl_eq_str[5],"ry");
			mysql_fetch_field_row(cl_eq_str[6],"rz");
			mysql_fetch_field_row(cl_eq_str[7],"bone");
			mysql_fetch_field_row(cl_eq_str[8],"scalex");
			mysql_fetch_field_row(cl_eq_str[9],"scaley");
			mysql_fetch_field_row(cl_eq_str[10],"scalez");
			mysql_fetch_field_row(cl_eq_str[11],"type");

			cl_equipping[playerid] = cl_dress_count;

			cl_SetClothing(playerid,CLOTHING_PLAYER,strval(cl_eq_str[0]),strval(cl_eq_str[7]),floatstr(cl_eq_str[1]),floatstr(cl_eq_str[2]),floatstr(cl_eq_str[3]),floatstr(cl_eq_str[4]),floatstr(cl_eq_str[5]),floatstr(cl_eq_str[6]),floatstr(cl_eq_str[8]),floatstr(cl_eq_str[9]),floatstr(cl_eq_str[10]));
			cl_dress_count ++;

	    }

	}
	else if(type == QUERY_LOAD_PRISON)
	{

	    new pr_i = 0;
	    new pr_str[256];
	    while(mysql_retrieve_row())
	    {

	        mysql_fetch_field_row(pr_str,"id");
	        PrisonInfo[pr_i][pID] = strval(pr_str);
	        mysql_fetch_field_row(pr_str,"owner");
	        PrisonInfo[pr_i][pOwner] = strval(pr_str);
	        mysql_fetch_field_row(pr_str,"expire");
			PrisonInfo[pr_i][pExpire] = strval(pr_str);
	        pr_i ++;

	    }
	    print("Prisons Loaded.");

	}
	else if(type == QUERY_FETCH_TICKETS)
	{

		new ti_i = 1;
		new ti_str[256];
		SendClientMessage(playerid,COLOR_FACTION,"|----------Your Tickets----------|");
		while(mysql_retrieve_row())
		{

		    new ti_tmp[3][128];
			mysql_fetch_field_row(ti_str,"issuer");
	        format(ti_tmp[0],128,"Ticket #%d: From: %s ",ti_i,ti_str);
	        mysql_fetch_field_row(ti_str,"amount");
	        format(ti_tmp[1],128,"Amount: $%s",ti_str);
	        format(ti_tmp[2],128,"%s %s",ti_tmp[0],ti_tmp[1]);
	        SendClientMessage(playerid,COLOR_FACTION,ti_tmp[2]);
	        ti_i ++;

		}
		SendClientMessage(playerid,COLOR_FACTION,"Use /tickets pay [ticket #] when inside the police department to pay any ticket. Or /ticket view [ticket #].");

	}
	else if(type == QUERY_VIEW_TICKETS)
	{

		new tv_i = 1;
		new tv_done = 0;
		new tv_str[128];
		new tv_print[128];
		while(mysql_retrieve_row())
		{

		    if(tv_i == GetPVarInt(playerid,"ticket_slot"))
      		{

		        SendClientMessage(playerid,COLOR_FACTION,"|---------Ticket Information--------|");
		        mysql_fetch_field_row(tv_str,"stamp");
		        format(tv_print,sizeof(tv_print),"Date of ticket: %s",tv_str);
		        SendClientMessage(playerid,COLOR_WHITE,tv_print);
		        mysql_fetch_field_row(tv_str,"issuer");
				format(tv_print,sizeof(tv_print),"Ticket Issuer: %s",tv_str);
				SendClientMessage(playerid,COLOR_WHITE,tv_print);
				mysql_fetch_field_row(tv_str,"amount");
				format(tv_print,sizeof(tv_print),"Ticket amount: $%s",tv_str);
				SendClientMessage(playerid,COLOR_WHITE,tv_print);
				mysql_fetch_field_row(tv_str,"reason");
				format(tv_print,sizeof(tv_print),"Ticket reason: %s",tv_str);
				SendClientMessage(playerid,COLOR_WHITE,tv_print);
				SendClientMessage(playerid,COLOR_FACTION,"------------------------------------");
				tv_done = 1;

		    }
		    tv_i ++;

		}
		if(!tv_done) {

		    SendClientMessage(playerid,COLOR_LIGHTRED,"No ticket in this slot.");

		}

	}
	else if(type == QUERY_PAY_TICKET)
	{

	    new tp_i = 1;
	    new tp_done = 0;
		new tp_str[128];
		while(mysql_retrieve_row())
		{

			if(tp_i == GetPVarInt(playerid,"ticket_slot"))
			{

				mysql_fetch_field_row(tp_str,"amount");
				new amount = strval(tp_str);
				if(amount > 1)
				{

				    mysql_fetch_field_row(tp_str,"id");
				    new id = strval(tp_str);
				    if(id)
				    {

						if(CharacterInfo[playerid][active_character[playerid]][cMoney] >= amount)
						{

						    CharacterInfo[playerid][active_character[playerid]][cMoney] -= amount;
						    SendClientMessage(playerid,COLOR_FACTION,"You have paid for your ticket.");
						    FactionInfo[0][fBank] += amount;
							format(tp_str,sizeof(tp_str),"UPDATE rp_fines SET paid = 1 WHERE id = '%d'",id);
							mysql_query(tp_str,player_threads[playerid]);

						}
						else
						{

						    SendClientMessage(playerid,COLOR_LIGHTRED,"You do not have enough money.");

						}

				    }

				}
				tp_done = 1;

			}
		    tp_i ++;

		}
		if(!tp_done)
		{

		    SendClientMessage(playerid,COLOR_LIGHTRED,"Invalid slot.");

		}

	}
	else if(type == QUERY_MDC_FINE)
	{

	    new fw_str[256];
		while(mysql_retrieve_row())
		{

		    new fw_tmp[128];
		    new fw_print[128];
		    mysql_fetch_field_row(fw_str,"stamp");
			format(fw_tmp,sizeof(fw_tmp),"Date Issued: %s",fw_str);
			mysql_fetch_field_row(fw_str,"reason");
			format(fw_print,sizeof(fw_print),"UNPAID TICKET, reason: %s, issued: %s",fw_tmp,fw_str);
			SendClientMessage(playerid,COLOR_LIGHTRED,fw_print);

		}

	}
	/*****END ON QUERY FINISH*******/

	mysql_free_result();
	return 1;

}
this is all it have. Is a roleplay server from 2013.
Reply
#7

Update your plugin buddy. Move to blueg's plugin
Reply
#8

Can u give me a link please? Also, what else I have to change in gm?
Reply
#9

I think the port thing are NPCs trying to connect. Are you using NPCs?

I don't know if iLearner meant this one, just did a quick ****** search:

https://sampforum.blast.hk/showthread.php?tid=56564
Reply
#10

Quote:
Originally Posted by Troydere
View Post
I think the port thing are NPCs trying to connect. Are you using NPCs?

I don't know if iLearner meant this one, just did a quick ****** search:

https://sampforum.blast.hk/showthread.php?tid=56564
Realy to say, I dont know if server got npc's. I just taked from internet, changed the plugins, updated some includes, compiled and tryed to start. I was thinking abount npc-s too because they try to connect from my pc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)