Jump to content
  • 0

problema la comanda /carcolor


AddisoN

Question

Nick: AddisoN

Problem? întâlnit?: Folosec comanda carcolor, imi schimba culorile masinii dar daca dau restart nu face update in baza de date si gand intru din nou o gasesc neagra(in baza de date imi ramane mereu 0 la ambele culori)

Erori / warnings: nu am in script

Lini/script:  -

Ai incercat sa rezolvi singur ?:Da dar nu am reusit

Asta e comanda creata de mine.

[pawn]ocmd:carcolor(playerid, params[])

{

for(new i=0; i<sizeof(cInfo);i++)

{

new incar = IsPlayerInAnyVehicle(playerid);

new cowner = cInfo[owner];

new c1=cInfo[c_c1];

new c2=cInfo[c_c2];

if(!cowner) SCM(playerid,RED,"Nu ai masina!");

if(!incar) return SCM(playerid,RED,"Trebuie sa fii in masina!");

if(sscanf(params,"dD",c1,c2)) return SendClientMessage(playerid, -1, "INFO: /colorcar [color1] [color2]");

if(c1<0||c1>127)return SendClientMessage(playerid,RED,"Invalid id color one.");

if(c2<0||c2>127)return SendClientMessage(playerid,RED,"invalid id color two.");

new query[128],string[128];

format(query,sizeof(query),"UPDATE cars SET color1='%i',color2,='%i'WHERE id='%i'",cInfo[c_c1],cInfo[c_c2],cInfo[db_id]);

mysql_function_query(dbhandle,query,false,"","");

format(string, sizeof(string), "You have change the vehicle's color 1 to %d and color 2 to %d!",c1,c2);

SendClientMessage(playerid, RED, string);

ChangeVehicleColor(cInfo[id_x],c1,c2);

return 1;

}

return 1;

}[/pawn]

Multumesc anticipat!

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

incearca asa , daca nu functioneaza lasa reply

UPDATE cars SET color1= '%d', color2 = '%d' WHERE id = '%d'
sau...
UPDATE cars SET color1= '%d' WHERE id = '%d'
UPDATE cars SET color2 = '%d' WHERE id =  '%d' 

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

Incearca asa:

[pawn]

mysql_format(query,sizeof(query),"UPDATE `cars` SET `color1`='%d', `color2`='%d' WHERE `id`='%d'",cInfo[c_c1],cInfo[c_c2],cInfo[db_id]);

mysql_tquery(dbhandle, query);[/pawn]

In R38 trebuie sa-ti mearga fara sa faci un callback la "mysql_tquery".

Link to comment
Share on other sites

akm primesc erorile astea :

G_M.pwn(591) : error 035: argument type mismatch (argument 1)

G_M.pwn(591) : error 035: argument type mismatch (argument 2)

asta e randul cu erorile:

[pawn]mysql_format(query,sizeof(query),"UPDATE `cars` SET `color1`=%d', `color2`='%d' WHERE `id`='%d'",cInfo[c_c1],cInfo[c_c2],cInfo[db_id]);[/pawn]

Link to comment
Share on other sites

akm primesc erorile astea :

G_M.pwn(591) : error 035: argument type mismatch (argument 1)

G_M.pwn(591) : error 035: argument type mismatch (argument 2)

asta e randul cu erorile:

[pawn]mysql_format(query,sizeof(query),"UPDATE `cars` SET `color1`=%d', `color2`='%d' WHERE `id`='%d'",cInfo[c_c1],cInfo[c_c2],cInfo[db_id]);[/pawn]

uitai, uite aici,

[pawn]mysql_format(dbhandle, query,sizeof(query),"UPDATE `cars` SET `color1`=%d', `color2`='%d' WHERE `id`='%d'",cInfo[c_c1],cInfo[c_c2],cInfo[db_id]);[/pawn]

Link to comment
Share on other sites

[pawn][19:06:49] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', `color2`='0' WHERE `id`='12'' at line 1

[19:10:02] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '', `color2`='87' WHERE `id`='12'' at line 1[/pawn]

asta zice

Link to comment
Share on other sites

Am o intrebare, tu vrei sa modifici la toate masinile, sau doar la ce-a pe care o detine player-ul?

Si uite intrusul!

[pawn]color2,='%i[/pawn] Ai acolo "," inainte de "=".

Uite mai jos, putin optimizat. Apropo de ce aveai return in for?

[pawn]ocmd:carcolor(playerid, params[])

{

    new c1, c2, query[128], string[128];

   

for(new i = 0; i < sizeof(cInfo); i++)

{

if(cInfo[owner] == 0)

return SCM(playerid,RED,"Nu ai masina!");

if(IsPlayerInAnyVehicle(playerid) == 0)

return SCM(playerid,RED,"Trebuie sa fii in masina!");

if(sscanf(params, "ii", c1, c2))

return SendClientMessage(playerid, -1, "INFO: /colorcar [color1] [color2]");

if(c1 < 0 ||c1 > 127)

return SendClientMessage(playerid,RED,"Invalid id color one.");

if(c2 < 0 || c2 > 127)

return SendClientMessage(playerid,RED,"invalid id color two.");

format(query,sizeof(query),"UPDATE `cars` SET `color1` = '%i', `color2` = '%i' WHERE `id`='%i'", c1, c2, cInfo[db_id]);

mysql_function_query(dbhandle, query, false, "", "");

format(string, sizeof(string), "You have change the vehicle color 1 to %d and color 2 to %d!", c1, c2);

SendClientMessage(playerid, RED, string);

ChangeVehicleColor(cInfo[id_x], c1, c2);

}

return 1;

}[/pawn]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.