What's wrong on that?
#1

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(playerid, Car[i][c_id]+1))
            {
                new 
m[126];
                
format(m, sizeof(m), "Car parked successfully.", Car[i][c_id]);
                
                new 
query[512];
                
format(query, sizeof(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(dbhandle, query, false, "", "");
                
SendClientMessage(playerid, -1, m);
                return 
1;
            }
        }
        
    } 
It's not saving on MySql db also not showing any mysql error on mysql log file..

please help me
Reply
#2

Код:
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)
Reply
#3

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(query, sizeof(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]); 
Reply
#4

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(query, sizeof(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...
Reply


Forum Jump:


Users browsing this thread: