SA-MP Forums Archive
Setting Job Plate - 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: Setting Job Plate (/showthread.php?tid=312456)



Setting Job Plate - Tanush123 - 21.01.2012

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)



Re: Setting Job Plate - Typhome - 21.01.2012

You need respawn vehicle after setting plate.

SetVehicleToRespawn(JobInfo[jobid][Car1]); etc.


Re: Setting Job Plate - Tanush123 - 22.01.2012

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)



Re: Setting Job Plate - T0pAz - 22.01.2012

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.


Re: Setting Job Plate - Tanush123 - 22.01.2012

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


Re: Setting Job Plate - T0pAz - 22.01.2012

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?


Re: Setting Job Plate - Tanush123 - 23.01.2012

Yes i do


Re: Setting Job Plate - Snowman12 - 23.01.2012

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?


Re: Setting Job Plate - Tanush123 - 24.01.2012

I fixed it, thank you guys for helping


Re: Setting Job Plate - Snowman12 - 24.01.2012

how?