MYSQL | Vehicle System
#1

Hi,

I've got this strange bug that I can't seem to solve. Ill paste the code

PHP код:
enum VehicleStats
{
    
vID,
    
vModel,
    
Float:vPosition[4],
    
vOwner[24],
    
vColor1,
    
vColor2,
}
new 
Vehicle[MAX_VEHICLES][VehicleStats];
COMMAND:createvehicle(playeridparams[])
{
    new 
vModelTiFloat:posxFloat:posyFloat:poszFloat:posavColor1TvColor2Tquery[228], string[128];
    if(
sscanf(params"ddd"vModelTvColor1TvColor2T)) return SendClientMessage(playeridCOLOR_GREY"[Command] Usage: /createvehicle [ModelID] [Color1] [Color2]");
    
GetPlayerPos(playeridposxposyposz);
    
GetPlayerFacingAngle(playeridposa);
    if(
vModelT 411 || vModelT 611) return SendClientMessage(playeridCOLOR_GREY"Model ID Must not be below 411 and not higher than 611");
     
mysql_insert_id();
    
format(querysizeof(query), "INSERT INTO vehicles (VehicleID, VehicleModel, VehiclePosx, VehiclePosy, VehiclePosz, VehiclePosa, VehicleColor1, VehicleColor2) VALUES('%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d'"ivModelTposxposyposzposavColor1TvColor2T);
    
mysql_query(query);
    
Vehicle[i][vID] = i;
    
Vehicle[i][vModel] = vModelT;
    
Vehicle[i][vPosition][0] = posx;
    
Vehicle[i][vPosition][1] = posy;
    
Vehicle[i][vPosition][2] = posz;
    
Vehicle[i][vPosition][3] = posa;
    
Vehicle[i][vColor1] = vColor1T;
    
Vehicle[i][vColor2] = vColor2T;
    
format(stringsizeof(string), "Vehicle Created! Vehicle ID : %d | Vehicle ModelID : %d | Vehicle Color1And2 : 5 | Vehicle PosX : %f | Vehicle PosY : %f | Vehicle PosZ : %f | Vehicle PosA : %f"ivModelTposxposyposzposa);
    
SendClientMessage(playeridCOLOR_GREYstring);
    return 
1;

I did create a table insise the database. When i type /createvehicle in game it will create it inside the db. But when i use it again it will repeat the same id over and over again and it doesnt create then. What am i doing wrong?

Typed from my iphone dident even bother fixing spelling mistakes haha

Thanks
Reply


Messages In This Thread
MYSQL | Vehicle System - by yoran765 - 11.12.2013, 20:11
Re: MYSQL | Vehicle System - by Vince - 11.12.2013, 20:53
Re: MYSQL | Vehicle System - by HK - 11.12.2013, 21:24
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 05:51
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 05:56
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 15:49
Re: MYSQL | Vehicle System - by Tayab - 12.12.2013, 17:27
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 18:10
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 18:29
Re: MYSQL | Vehicle System - by yoran765 - 16.12.2013, 06:24

Forum Jump:


Users browsing this thread: 1 Guest(s)