Setting Job Plate
#1

Im making dynamic jobs but for some reason the plate does not change or updates the mysql DB when i use /setjplate
pawn Код:
CMD:setjplate(playerid,params[])
{
    new jobid,plate[11];
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"is[11]",jobid,plate)) return SCM(playerid,grey,"USAGE: /setjplate [jobid] [plate]");
    if(!DoesJobExist(jobid)) return SCM(playerid,red,"ERROR: That Job does not exist.");
    format(str,sizeof(str),"SELECT * FROM Jobs WHERE ID = '%d'",jobid);
    mysql_query(str);
    format(str,sizeof(str),"UPDATE Jobs SET Plate = '%s' WHERE ID = %d",plate,jobid);
    mysql_query(str);
    format(str,sizeof(str),"You have updated %s (jobid %d) vehicle's plate to %s",JobInfo[jobid][Jobname],jobid,plate);
    SCM(playerid,COLOR_YELLOW,str);
    format(JobInfo[jobid][Plate],11,"%s",plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car1],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car2],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car3],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car4],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car5],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car6],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car7],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car8],plate);
    return 1;
}
Код:
[17:44:34] CMySQLHandler::Query(UPDATE Jobs SET Plate = 'Pizza' WHERE ID = 1) - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)
Reply
#2

You need respawn vehicle after setting plate.

SetVehicleToRespawn(JobInfo[jobid][Car1]); etc.
Reply
#3

i did but nothing happens, on debug i get this
Код:
[17:44:34] CMySQLHandler::Query(UPDATE Jobs SET Plate = 'Pizza' WHERE ID = 1)
 - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)
Reply
#4

You are calling client functions in the wrong order. You cannot query twice at the same time. You need to free the result then query it.
Reply
#5

i did
pawn Код:
CMD:setjplate(playerid,params[])
{
    new jobid,plate[11];
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"is[11]",jobid,plate)) return SCM(playerid,grey,"USAGE: /setjplate [jobid] [plate]");
    if(!DoesJobExist(jobid)) return SCM(playerid,red,"ERROR: That Job does not exist.");
    format(str,sizeof(str),"UPDATE Jobs SET Plate = '%s' WHERE ID = '%d'",plate,jobid);
    mysql_query(str);
    format(str,sizeof(str),"You have updated %s (jobid %d) vehicle's plate to %s",JobInfo[jobid][Jobname],jobid,plate);
    SCM(playerid,COLOR_YELLOW,str);
    format(JobInfo[jobid][Plate],11,"%s",plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car1],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car2],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car3],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car4],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car5],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car6],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car7],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car8],plate);
    return 1;
}
but it still doesnt work now
Reply
#6

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
i did
pawn Код:
CMD:setjplate(playerid,params[])
{
    new jobid,plate[11];
    if(!IsPlayerAdmin(playerid)) return 0;
    if(sscanf(params,"is[11]",jobid,plate)) return SCM(playerid,grey,"USAGE: /setjplate [jobid] [plate]");
    if(!DoesJobExist(jobid)) return SCM(playerid,red,"ERROR: That Job does not exist.");
    format(str,sizeof(str),"UPDATE Jobs SET Plate = '%s' WHERE ID = '%d'",plate,jobid);
    mysql_query(str);
    format(str,sizeof(str),"You have updated %s (jobid %d) vehicle's plate to %s",JobInfo[jobid][Jobname],jobid,plate);
    SCM(playerid,COLOR_YELLOW,str);
    format(JobInfo[jobid][Plate],11,"%s",plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car1],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car2],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car3],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car4],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car5],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car6],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car7],plate);
    SetVehicleNumberPlate(JobInfo[jobid][Car8],plate);
    return 1;
}
but it still doesnt work now
Do you get the same error?
Reply
#7

Yes i do
Reply
#8

where is your new str and how long is it?

Quote:
Originally Posted by Dave Haines
[21 May 2007 22:38] Dave Haines
I upgraded to 1.2.12 as advised and that resolved the problem. Thank you
What version are you currently using ? Also have you tried any different MySQL plugins?
Reply
#9

I fixed it, thank you guys for helping
Reply
#10

how?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)