Bug vehicle color
#1

Код:
CMD:vcolor(playerid, vehicleid, params[])
{
	new c1;
	new c2;
	new string[127];
	new id = GetVehicleID(playerid);
	new incar = IsPlayerInAnyVehicle(playerid);
	if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You are not driving a vehicle!");
	if(sscanf(params,"dD",c1,c2)) return SendClientMessage(playerid, -1, "INFO: /vcolor [color1] [color2]");
	if(c1<0||c1>127) return SendClientMessage( playerid, -1, "Invalid id color one.") ;
	if(c2<0||c2>127) return SendClientMessage( playerid, -1, "invalid id color two.") ;
	//new query[128],string[128];
	//format(query,sizeof(query),"UPDATE cars SET color1='%i',color2,='%i'WHERE id='%i'",cInfo[i][c_c1],cInfo[i][c_c2],cInfo[i][db_id]);
	//mysql_function_query(dbhandle,query,false,"","");
	format(string, sizeof(string), "Ti-ai setat culorile dorite !!");
	SendClientMessage(playerid, -1, string);
	ChangeVehicleColor(vehicleid, c1, c2);
	SaveVehicle(vehicleid);
	return 1;
}
When I write /vcolor the game do not change color to the car. What's not well done?

Sorry for my bad english
Reply
#2

BUMP.
Reply
#3

You writed :
PHP код:
ChangeVehicleColor(vehicleidc1c2); 
Try to put :
PHP код:
ChangeVehicleColor(idc1c2); 
Reply
#4

pawn Код:
CMD:vcolor(playerid, vehicleid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You are not driving a vehicle!");
    new c1, c2;
    if(sscanf(params,"dd",c1,c2)) return SendClientMessage(playerid, -1, "INFO: /vcolor [color1] [color2]");
    if(c1<0||c1>127) return SendClientMessage( playerid, -1, "Invalid id color one.") ;
    if(c2<0||c2>127) return SendClientMessage( playerid, -1, "invalid id color two.") ;
    new veh_ID = GetPlayerVehicleID(playerid);
    //new query[60];
    //format(query,sizeof(query),"UPDATE cars SET color1=%i,color2=%i WHERE id=%i",cInfo[veh_ID][c_c1],cInfo[veh_ID][c_c2],cInfo[veh_ID][db_id]);
    //mysql_function_query(dbhandle,query,false,"","");
    SendClientMessage(playerid, -1, "Ti-ai setat culorile dorite !!");
    ChangeVehicleColor(veh_ID, c1, c2);
    SaveVehicle(veh_ID);
    return 1;
}
Reply
#5

PHP код:
dcmd_carcolour(playeridvehicleidparams[])
{
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_RED"You are not driving a vehicle!");
    new 
c1c2;
    if(
sscanf(params,"dd",c1,c2)) return SendClientMessage(playerid, -1"INFO: /vcolor [color1] [color2]");
    if(
c1<0||c1>127) return SendClientMessageplayerid, -1"Invalid id color one.") ;
    if(
c2<0||c2>127) return SendClientMessageplayerid, -1"invalid id color two.") ;
    new 
veh_ID GetPlayerVehicleID(playerid);
    
//new query[60];
    //format(query,sizeof(query),"UPDATE cars SET color1=%i,color2=%i WHERE id=%i",cInfo[veh_ID][c_c1],cInfo[veh_ID][c_c2],cInfo[veh_ID][db_id]);
    //mysql_function_query(dbhandle,query,false,"","");
    
SendClientMessage(playerid, -1"Ti-ai setat culorile dorite !!");
    
ChangeVehicleColor(veh_IDc1c2);
    
SaveVehicle(veh_ID);
    return 
1;

Reply
#6

Quote:
Originally Posted by gekas
Посмотреть сообщение
PHP код:
dcmd_carcolour(playeridvehicleidparams[])
{
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_RED"You are not driving a vehicle!");
    new 
c1c2;
    if(
sscanf(params,"dd",c1,c2)) return SendClientMessage(playerid, -1"INFO: /vcolor [color1] [color2]");
    if(
c1<0||c1>127) return SendClientMessageplayerid, -1"Invalid id color one.") ;
    if(
c2<0||c2>127) return SendClientMessageplayerid, -1"invalid id color two.") ;
    new 
veh_ID GetPlayerVehicleID(playerid);
    
//new query[60];
    //format(query,sizeof(query),"UPDATE cars SET color1=%i,color2=%i WHERE id=%i",cInfo[veh_ID][c_c1],cInfo[veh_ID][c_c2],cInfo[veh_ID][db_id]);
    //mysql_function_query(dbhandle,query,false,"","");
    
SendClientMessage(playerid, -1"Ti-ai setat culorile dorite !!");
    
ChangeVehicleColor(veh_IDc1c2);
    
SaveVehicle(veh_ID);
    return 
1;

Copying-pasting the code I posted and changing the command from ZCMD to dcmd and its name is just stupid. He uses ZCMD..
Reply
#7

Not working.
Reply
#8

UP !?
Reply
#9

pawn Код:
CMD:vcolor(playerid, vehicleid, params[])
{
    vehicleid = GetPlayerVehicleID(playerid);
    new c1,c2,string[127];
    new incar = IsPlayerInAnyVehicle(playerid);
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "You are not driving a vehicle!");
    if(sscanf(params,"dD",c1,c2)) return SendClientMessage(playerid, -1, "INFO: /vcolor [color1] [color2]");
    if(c1<0||c1>127) return SendClientMessage( playerid, -1, "Invalid id color one.") ;
    if(c2<0||c2>127) return SendClientMessage( playerid, -1, "invalid id color two.") ;
    //new query[128],string[128];
    //format(query,sizeof(query),"UPDATE cars SET color1='%i',color2,='%i'WHERE id='%i'",cInfo[i][c_c1],cInfo[i][c_c2],cInfo[i][db_id]);
    //mysql_function_query(dbhandle,query,false,"","");
    format(string, sizeof(string), "Ti-ai setat culorile dorite !!");
    SendClientMessage(playerid, -1, string);
    ChangeVehicleColor(vehicleid, c1, c2);
    SaveVehicle(vehicleid);
    return 1;
}
It's GetPlayerVehicleID not GetVehicleID, however you're not using the vehicleid parameter in GetPlayerVehicleID you're using the one "id" I've removed it in my code above because it's useless.
pawn Код:
vehicleid = GetPlayerVehicleID(playerid);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)