SA-MP Forums Archive
What's wrong on that? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What's wrong on that? (/showthread.php?tid=658233)



What's wrong on that? - akib - 30.08.2018

Hello, i am trying to create /v park system...

here is my script :
PHP код:
if(!strcmp(action"park"false))
    {
        if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"/v park command is currently disabled");
        for(new 
i=0;i<sizeof(Car);i++)
        {
            if(
IsPlayerInVehicle(playeridCar[i][c_id]+1))
            {
                new 
m[126];
                
format(msizeof(m), "Car parked successfully."Car[i][c_id]);
                
                new 
query[512];
                
format(querysizeof(query), "UPDATE cars SET c_x='%f', c_y='%f', c_z='%f', c_a='%f' WHERE id='%i'"Car[i][c_x],Car[i][c_y],Car[i][c_z],Car[i][c_a],Car[i][c_id]);
                
mysql_function_query(dbhandlequeryfalse"""");
                
SendClientMessage(playerid, -1m);
                return 
1;
            }
        }
        
    } 
It's not saving on MySql db also not showing any mysql error on mysql log file..

please help me


Re: What's wrong on that? - Sew_Sumi - 30.08.2018

Код:
print(query);
after the format section, and see what it's given in the log file.


Why do you check +1 on the car, then not do it for the rest?

Код:
if(IsPlayerInVehicle(playerid, Car[i][c_id]+1)) 
            { 
                new m[126]; 
                format(m, sizeof(m), "Car parked successfully.", Car[i][c_id]);
Your format is also broken.... That's why it's not doing anything. You're missing the %i. (That's what's breaking your code)


Re: What's wrong on that? - Shinja - 30.08.2018

Your position variable arent updated
PHP код:
GetVehiclePos(Car[i][c_id],Car[i][c_x],Car[i][c_y],Car[i][c_z]);
GetVehicleZAngle(Car[i][c_id],Car[i][c_a]);
format(querysizeof(query), "UPDATE cars SET c_x='%f', c_y='%f', c_z='%f', c_a='%f' WHERE id='%i'"Car[i][c_x],Car[i][c_y],Car[i][c_z],Car[i][c_a],Car[i][c_id]); 



Re: What's wrong on that? - akib - 31.08.2018

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Your position variable arent updated
PHP код:
GetVehiclePos(Car[i][c_id],Car[i][c_x],Car[i][c_y],Car[i][c_z]);
GetVehicleZAngle(Car[i][c_id],Car[i][c_a]);
format(querysizeof(query), "UPDATE cars SET c_x='%f', c_y='%f', c_z='%f', c_a='%f' WHERE id='%i'"Car[i][c_x],Car[i][c_y],Car[i][c_z],Car[i][c_a],Car[i][c_id]); 
Yea bro :P ty <3 fixed...