05.03.2013, 12:09
Hello Everybody!
I need your help
I creating a system, but the system dont like me, and he didnt adds what in the table!
Here is the MySQL sql Database
An this is the buy command (its a car system)
This is Stock Save and Load, but its dont adds something at the buy
I hope somebody can help me :/
And yeah, my english is shit, or?
Greetz
I need your help
I creating a system, but the system dont like me, and he didnt adds what in the table!
Here is the MySQL sql Database
Код:
CREATE TABLE `Autos` ( `Besitzer` varchar(24) NOT NULL, `Farbe1` INT(3) NOT NULL DEFAULT '0', `Farbe2` INT(3) NOT NULL DEFAULT '0', `Schluessel` INT(2) NOT NULL DEFAULT '0', `Model` INT(3) NOT NULL DEFAULT '0', `Preis` INT(5) NOT NULL DEFAULT '0', `PosX` FLOAT(15) NOT NULL DEFAULT '0', `PosY` FLOAT(15) NOT NULL DEFAULT '0', `PosZ` FLOAT(15) NOT NULL DEFAULT '0', `PosA` FLOAT(15) NOT NULL DEFAULT '0', `Nummernschild` varchar(50) NOT NULL DEFAULT '0', PRIMARY KEY (`Besitzer`) ) COLLATE='utf8_general_ci' ENGINE=InnoDB;
Код:
mysql_query("SELECT NULL FROM `Autos`"); mysql_store_result(); new rows = mysql_num_rows(); mysql_free_result(); new AutoID = rows++; if(AutoID < MAX_CARS) { new query[350]; format(query,sizeof(query),"INSERT INTO `Autos` (Name,Farbe1,Farbe2,Schluessel,Model,Preis,pX,pY,pZ,pA,Nummernschild) VALUES('%s','%d','%d','%d','%d','%d','%d','%d','%d','%d','%s')",GetName(playerid),AutoInfo[playerid][pFarbe1],AutoInfo[playerid][pFarbe2],AutoInfo[playerid][pAuto],AutoInfo[playerid][pModel],AutoInfo[playerid][pPreis],AutoInfo[playerid][pX],AutoInfo[playerid][pY],AutoInfo[playerid][pZ],AutoInfo[playerid][pA],AutoInfo[playerid][pNummernschild]); mysql_query(query); } else { print("<-|----------------------------------------- Fatal Error -----------------------------------------|->"); print("<-| Too many Vehicles at the Server! Please change the MAX_CARS or delete any Vehicles! |->"); print("<-|-----------------------------------------------------------------------------------------------|->"); }
Код:
stock LoadVehicel(playerid) { if(IsPlayerConnected(playerid)) { AutoInfo[playerid][ pFarbe1 ] = mysql_GetInt("Autos", "Farbe1", "Besitzer", GetName(playerid)); AutoInfo[playerid][ pFarbe2 ] = mysql_GetInt("Autos", "Farbe2", "Besitzer", GetName(playerid)); AutoInfo[playerid][ pAuto ] = mysql_GetInt("Autos", "Schluessel", "Besitzer", GetName(playerid)); AutoInfo[playerid][ pModel ] = mysql_GetInt("Autos", "Model", "Besitzer", GetName(playerid)); AutoInfo[playerid][ pPreis ] = mysql_GetInt("Autos", "Preis", "Besitzer", GetName(playerid)); AutoInfo[playerid][ pX ] = mysql_GetFloat("Autos", "PosX", "Besitzer", GetName(playerid)); AutoInfo[playerid][ pY ] = mysql_GetFloat("Autos", "PosY", "Besitzer", GetName(playerid)); AutoInfo[playerid][ pZ ] = mysql_GetFloat("Autos", "PosZ", "Besitzer", GetName(playerid)); AutoInfo[playerid][ pA ] = mysql_GetFloat("Autos", "PosA", "Besitzer", GetName(playerid)); format(AutoInfo[playerid][ pNummernschild ],MAX_SCHILD,"%s",mysql_GetString("Autos", "Nummernschild","Besitzer", GetName(playerid))); AutoInfo[playerid][ pAuto ] = CreateVehicle(AutoInfo[playerid][pModel],AutoInfo[playerid][pX],AutoInfo[playerid][pY],AutoInfo[playerid][pZ],AutoInfo[playerid][pA],AutoInfo[playerid][pFarbe1],AutoInfo[playerid][pFarbe2],-1); SetVehicleNumberPlate(AutoInfo[playerid][pAuto],AutoInfo[playerid][pAuto]); SetVehicleToRespawn(AutoInfo[playerid][pAuto]); } return 1; } stock SaveVehicle(playerid) { if(IsPlayerConnected(playerid)) { mysql_SetInt("Autos", "Farbe1", AutoInfo[playerid][ pFarbe1 ], "Besitzer", GetName(playerid)); mysql_SetInt("Autos", "Farbe2", AutoInfo[playerid][ pFarbe2 ], "Besitzer", GetName(playerid)); mysql_SetInt("Autos", "Schluessel", AutoInfo[playerid][ pAuto ], "Besitzer", GetName(playerid)); mysql_SetInt("Autos", "Model", AutoInfo[playerid][ pModel ], "Besitzer", GetName(playerid)); mysql_SetInt("Autos", "Preis", AutoInfo[playerid][ pPreis ], "Besitzer", GetName(playerid)); mysql_SetFloat("Autos", "PosX", AutoInfo[playerid][ pX ], "Besitzer", GetName(playerid)); mysql_SetFloat("Autos", "PosY", AutoInfo[playerid][ pY ], "Besitzer", GetName(playerid)); mysql_SetFloat("Autos", "PosZ", AutoInfo[playerid][ pZ ], "Besitzer", GetName(playerid)); mysql_SetFloat("Autos", "PosA", AutoInfo[playerid][ pA ], "Besitzer", GetName(playerid)); mysql_SetString("Autos","Nummernschild",AutoInfo[playerid][ pNummernschild ], "Besitzer", GetName(playerid)); new string[85]; format(string, sizeof(string),"Das Fahrzeug von %s wurde erfolgreich gespeichert!",GetName(playerid)); print(string); } return 1; }
And yeah, my english is shit, or?
Greetz