#include <a_samp>#include <zcmd>#include <sscanf2>#include <mysql>#define COLOR_GREEN 0x33AA33AA#define COLOR_BLUE 0x0000FFAA#define COLOR_RED 0xFF0606FF#define COLOR_YELLOW 0xFFFF00AA#define COLOR_GREY 0xAFAFAFAA#define COLOR_WHITE 0xFFFFFFAA#define COLOR_BROWN 0x993300AA#define COLOR_ORANGE 0xFF9933AA#define COLOR_BLACK 0x000000AA#define COLOR_LIGHTBLUE 0x00BFFFAA#define SQL_HOST \"\"#define SQL_DB \"\"#define SQL_USER \"\"#define SQL_PASS \"\"#define MAX_SLOTS 500new name1[24], name2[24], str[128];new query[500];new vehid, slot;new id;new carplay[500], color1, color2;new tun1, tun2, tun3, tun4, tun5;public OnFilterScriptInit(){mysql_debug(1);mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);if(mysql_ping() != 1){ print(!\"MySQL: Kapcsolódás sikertelen!\");return 1;}print(\"\\n--------------------------------------\");print(\" névreszóló autó | by Ryuuzaki\");print(\"--------------------------------------\\n\");for(new i; i < MAX_SLOTS; i++){ format(query, sizeof(query), \"SELECT * FROM cars WHERE slot = \'%d\'\", i); mysql_query(query); mysql_store_result();if(mysql_num_rows() != 0){ new linen[1024]; mysql_fetch_row(linen); new tarolo[5]; new Float:tarolo2[4]; sscanf(linen, \"p<|>{ds[24]}dffffdddd\", tarolo[0], Float:tarolo2[0], Float:tarolo2[1], Float:tarolo2[2], Float:tarolo2[3], tarolo[1], tarolo[2], tarolo[3], tarolo[4]); carplay = CreateVehicle(tarolo[0], tarolo2[0], tarolo2[1], tarolo2[2], tarolo2[3], tarolo[1], tarolo[2], -1); AddVehicleComponent(carplay, tarolo[3]); AddVehicleComponent(carplay, tarolo[4]); mysql_free_result();}}return 1;}public OnFilterScriptExit(){for(new i; i < MAX_SLOTS; i++){ DestroyVehicle(carplay);}return 1;}CMD:carad(playerid, params[]){new Float:x, Float:y, Float:z, Float:a;if(!IsPlayerAdmin(playerid)) return 0;else if(sscanf(params, \"iiuii\", slot, vehid, id, color1, color2)) return SendClientMessage(playerid, COLOR_GREY, \"Használat: /carad [slot] [vehid] [playerid] [color1] [color2]\");else if(400 > vehid || vehid > 611) return SendClientMessage(playerid,COLOR_GREY,\"HIBA: Rossz JármûID! A jármû ID-jének 400 és 611 közt kell lennie!\");else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: Rossz játékosID!\");else if(slot > MAX_SLOTS) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: A slot nem lehet nagyobb 500-nál!\");format(query, sizeof(query), \"SELECT * FROM cars WHERE slot = \'%d\'\", slot);mysql_query(query);mysql_store_result();if(mysql_num_rows() != 0) return format(str, sizeof(str), \"HIBA: A %d-s slot már foglalt!\", slot), SendClientMessage(playerid, COLOR_GREY, str); mysql_free_result(); GetPlayerName(playerid, name1, sizeof(name1)); GetPlayerName(id, name2, sizeof(name2)); GetPlayerPos(id, x, y, z); GetPlayerFacingAngle(id, a); carplay[slot] = CreateVehicle(vehid, x, y, z, a, color1, color2, -1); SetPlayerPos(id, x, y, z+5);format(str, sizeof(str), \"%s lespawnolt neked egy jármûvet. JármûID: %d\", name1, vehid);SendClientMessage(id, COLOR_GREEN, str);format(str, sizeof(str), \"Lespawnoltál %s-nek egy jármûvet. JármûID: %d\", name2, vehid);SendClientMessage(playerid, COLOR_GREEN, str);format(query, sizeof(query), \"INSERT INTO cars (slot, Tulaj, VehID, X, Y, Z, A, color1, color2) VALUES (%d, \'%s\', %d, %0.2f, %0.2f, %0.2f, %0.2f, %d, %d)\", slot, name2, vehid, x, y+2, z, a, color1, color2);mysql_query(query);return 1;}CMD:carelvesz(playerid, params[]){if(!IsPlayerAdmin(playerid)) return 0;else if(sscanf(params, \"iu\", slot, id)) return SendClientMessage(playerid, COLOR_GREY, \"Használat: /carelvesz [slot] [playerid]\");else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: Rossz játékosID!\");else if(slot > MAX_SLOTS) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: A slot nem lehet nagyobb 500-nál!\");GetPlayerName(playerid, name1, sizeof(name1)); GetPlayerName(id, name2, sizeof(name2));format(query, sizeof(query), \"SELECT * FROM cars WHERE Tulaj = \'%s\'\", name2);mysql_query(query);mysql_store_result();if(mysql_num_rows() == 0) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: A játékosnak nincs saját jármûve!\"), mysql_free_result();format(query, sizeof(query), \"SELECT * FROM cars WHERE Tulaj = \'%s\' AND slot = \'%d\'\", name2, slot);mysql_query(query);mysql_store_result();if(mysql_num_rows() == 0) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: A tulaj és a slot nem egy sorban van!\"), mysql_free_result();format(str, sizeof(str), \"%s törölte a saját jármûvedet!\", name1);SendClientMessage(id, COLOR_GREEN, str);format(str, sizeof(str), \"Törölted %s saját jármûvét!\", name2);SendClientMessage(playerid, COLOR_GREEN, str); DestroyVehicle(carplay[slot]);format(query, sizeof(query), \"DELETE FROM cars WHERE Tulaj = \'%s\'\", name2);mysql_query(query);return 1;}CMD:tunszerkeszt(playerid, params[]){if(!IsPlayerAdmin(playerid)) return 0;else if(sscanf(params, \"iiI(0)I(0)I(0)I(0)\", slot, tun1, tun2, tun3, tun4, tun5)) return SendClientMessage(playerid, COLOR_GREY, \"Használat: /tunszerkeszt [slot] [tun1] [tun2] [tun3] [tun4] [tun5]\");else if(slot > MAX_SLOTS) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: A slot nem lehet nagyobb 500-nál!\");format(query, sizeof(query), \"SELECT * FROM cars WHERE slot = \'%d\'\", slot);mysql_query(query);mysql_store_result();if(mysql_num_rows() == 0) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: A slot nincs létrehozva!\"), mysql_free_result();format(query, sizeof(query), \"UPDATE cars SET tuning1 = \'%d\', tuning2 = \'%d\', tuning3 = \'%d\', tuning4 = \'%d\', tuning5 = \'%d\' WHERE slot = \'%d\'\", tun1, tun2, tun3, tun4, tun5, slot);mysql_query(query);format(str, sizeof(str), \"Sikeresen szerkesztetted az autó tuningjait! tuning1: %d, tuning2: %d, tuning3: %d, tuning4: %d, tuning5: %d\", tun1, tun2, tun3, tun4, tun5);SendClientMessage(playerid, COLOR_GREY, str);return 1;}CMD:szinszerkeszt(playerid, params[]){if(!IsPlayerAdmin(playerid)) return 0;else if(sscanf(params, \"iii\", slot, color1, color2)) return SendClientMessage(playerid, COLOR_GREY, \"Használat: /szinszerkeszt [slot] [color1] [color2]\");else if(slot > MAX_SLOTS) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: A slot nem lehet nagyobb 500-nál!\");format(query, sizeof(query), \"SELECT * FROM cars WHERE slot = \'%d\'\", slot);mysql_query(query);mysql_store_result();if(mysql_num_rows() == 0) return SendClientMessage(playerid, COLOR_GREY, \"HIBA: A slot nincs létrehozva!\"), mysql_free_result();format(query, sizeof(query), \"UPDATE cars SET color1 = \'%d\', color2 = \'%d\' WHERE slot = \'%d\'\", color1, color2, slot);mysql_query(query);format(str, sizeof(str), \"Sikeresen szerkesztetted az autó színét! szín1: %d, szín2: %d\", color1, color2);SendClientMessage(playerid, COLOR_GREY, str);return 1;}public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){if(ispassenger == 0){for(new i; i < MAX_SLOTS; i++){ if(vehicleid == carplay) { new tarolo[24]; GetPlayerName(playerid, name1, sizeof(name1)); format(query, sizeof(query), \"SELECT * FROM cars WHERE slot = \'%d\'\", i); mysql_query(query); mysql_store_result(); if(mysql_num_rows() != 0) { new linen[1024]; mysql_fetch_row(linen); sscanf(linen, \"p<|>{d}s[24]{dffffdd}\", tarolo); if(strcmp(tarolo, name1)) { ClearAnimations(playerid); format(str, sizeof(str), \"Ez a jármû \'%s\' tulajdona! Te nem vezetheted!\", tarolo); SendClientMessage(playerid, COLOR_GREY, str); } mysql_free_result(); } }}}return 1;}public OnVehicleSpawn(vehicleid){for(new i; i < MAX_SLOTS; i++){ if(vehicleid == carplay) { format(query, sizeof(query), \"SELECT * FROM cars WHERE slot = \'%d\'\", i); mysql_query(query); mysql_store_result(); if(mysql_num_rows() != 0) { new linen[1024]; mysql_fetch_row(linen); new tarolo[2]; sscanf(linen, \"p<|>{ds[24]dffffdd}dd\", tarolo[0], tarolo[1]); AddVehicleComponent(carplay, tarolo[0]); AddVehicleComponent(carplay, tarolo[1]); mysql_free_result(); }}}return 1;}
CREATE TABLE IF NOT EXISTS `cars` ( `slot` int(2) NOT NULL, `Tulaj` varchar(30) CHARACTER SET utf8 COLLATE utf8_hungarian_ci NOT NULL, `VehID` int(3) NOT NULL, `X` float NOT NULL, `Y` float NOT NULL, `Z` float NOT NULL, `A` float NOT NULL, `color1` int(3) NOT NULL, `color2` int(3) NOT NULL, `tuning1` int(5) NOT NULL, `tuning2` int(5) NOT NULL, `tuning3` int(5) NOT NULL, `tuning4` int(5) NOT NULL, `tuning5` int(5) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;