21.01.2014, 16:55
Hi, i've this code:
So.... i can have color up to 126...
Why this don't work?
Код:
if(strcmp(cmd, "/culoaremasina", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerData[playerid][pPcarkey] == 999)
{
SendClientMessage(playerid, COLOR_GREY,"Nu ai o masina personala.");
return 1;
}
if(GetPlayerCash(playerid) < 1000)
{
SendClientMessage(playerid, COLOR_GREY," Nu ai destui bani la tine.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendUsage(playerid,"/culoaremasina [ID culoare 1] [ID culoare 2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 && color1 > 126)
{
SendClientMessage(playerid, COLOR_GREY, "Id-ul culorii trebuie sa fie cuprins intre 0 si 126!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendUsage(playerid,"/culoaremasina [ID culoare 1] [ID culoare 2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 && color2 > 126)
{
SendClientMessage(playerid, COLOR_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(playerid, vehid+PreVehicle))
{
CarData[vehid][cColorOne] = color1;
CarData[vehid][cColorTwo] = color2;
GivePlayerCash(playerid, -1000);
GameTextForPlayer(playerid, "~w~Costul vopsiri~n~~r~-$1000", 5000, 1);
ChangeVehicleColor(vehid+PreVehicle, color1, color2);
new query[MAX_STRING];
format(query, sizeof(query), "UPDATE cars SET ColorOne='%d' WHERE id=%d", CarData[vehid][cColorOne], vehid);
mysql_query(query);
format(query, sizeof(query), "UPDATE cars SET ColorTwo='%d' WHERE id=%d", CarData[vehid][cColorTwo], vehid);
mysql_query(query);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY,"Nu esti in masina.");
return 1;
}
}
return 1;
}
Why this don't work?



