Carcolor
#6

So, the color won't change eh?

why don't you just print what
vehid+PreVehicle, color1 and color2 are holding?

what's this preVehicle anyways?
you might've fucked up there...
like the id of the vehicle which'll get it's color changed ain't the one the player is inside.

So just add some printf's and see what exactly your code is doing.
You'll see where you fucked up like this, it's called debugging


just in case you don't know how to do this:
PHP код:
if(strcmp(cmd"/culoaremasina"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
                if(
PlayerData[playerid][pPcarkey] == 999)
                {
                    
SendClientMessage(playeridCOLOR_GREY,"Nu ai o masina personala.");
                    return 
1;
                }
                if(
GetPlayerCash(playerid) < 1000)
                {
                    
SendClientMessage(playeridCOLOR_GREY," Nu ai destui bani la tine.");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendUsage(playerid,"/culoaremasina [ID culoare 1] [ID culoare 2]");
                    return 
1;
                }
                new 
color1;
                
color1 strval(tmp);
                if(
color1 && color1 126)
                {
                    
SendClientMessage(playeridCOLOR_GREY"Id-ul culorii trebuie sa fie cuprins intre 0 si 126!");
                    return 
1;
                }
                
tmp strtok(cmdtextidx);
                if(!
strlen(tmp))
                {
                    
SendUsage(playerid,"/culoaremasina [ID culoare 1] [ID culoare 2]");
                    return 
1;
                }
                new 
color2;
                
color2 strval(tmp);
                if(
color2 && color2 126)
                {
                    
SendClientMessage(playeridCOLOR_GREY"ID-ul culorii trebuie sa fie cuprins intre 0 si 126!");
                    return 
1;
                }
                new 
vehid;
                if(
GetPlayerVehicleID(playerid) == PlayerData[playerid][pPcarkey]+PreVehicle)
                {
                    
vehid PlayerData[playerid][pPcarkey];
                }
                else { return 
1; }
                if(
IsPlayerInVehicle(playeridvehid+PreVehicle))
                {
                    
printf("IsInMainControlStructure with veh-ID: %d",vehid+PreVehicle);//////setp1
                     
CarData[vehid][cColorOne] = color1;
                    
CarData[vehid][cColorTwo] = color2;
                    
GivePlayerCash(playerid, -1000);
                    
GameTextForPlayer(playerid"~w~Costul vopsiri~n~~r~-$1000"50001);
                    
ChangeVehicleColor(vehid+PreVehiclecolor1color2);
                    
printf("Vehicle-ID %d got it's color changed to: %d and %d",vehid+PreVehiclecolor1color2);//////step2
                    
new query[MAX_STRING];
                    
format(querysizeof(query), "UPDATE cars SET ColorOne='%d' WHERE id=%d"CarData[vehid][cColorOne], vehid);
                    
mysql_query(query);
                    
format(querysizeof(query), "UPDATE cars SET ColorTwo='%d' WHERE id=%d"CarData[vehid][cColorTwo], vehid);
                    
mysql_query(query);
                    return 
1;
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GREY,"Nu esti in masina.");
                    return 
1;
                }
         }
        return 
1;
    } 
Reply


Messages In This Thread
Carcolor - by nastasescu - 21.01.2014, 16:55
Re: Carcolor - by FallweN - 21.01.2014, 16:59
Re: Carcolor - by nastasescu - 21.01.2014, 17:12
Re: Carcolor - by edzis84 - 21.01.2014, 17:34
Re: Carcolor - by nastasescu - 21.01.2014, 17:55
Re: Carcolor - by CutX - 21.01.2014, 18:10

Forum Jump:


Users browsing this thread: 2 Guest(s)