Jump to content

[REZOLVAT] Problema /carcolor


CosminAK
 Share

Recommended Posts


cmd:carcolor(playerid, params[])
{
	new colorid,colorpart, string[256];
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Nu esti in vehiculul tau.");
	if(sscanf(params, "ii",colorpart,colorid)) return SendClientMessage(playerid, COLOR_GREY, "Sintaxa: {FFFFFF}/carcolor [1/2] <Culoarea>");
	if(GetPlayerCash(playerid, 5000) < 5000) return SendClientMessage(playerid, COLOR_WHITE, "Your don't have $5,000!");
	new car = GetPlayerVehicleID(playerid);
	if(PersonalCar(playerid) == -1) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu esti in unul dintre vehiculele tale personale!");
	if(GetPlayerState(playerid) != 2) return SCM(playerid, COLOR_LGREEN, "* Trebuie sa fii la volan pentru a putea folosi aceasta comanda!");
	new idd = PersonalCar(playerid);
	if(CarInfo[idd][Spawned] != car) return SendClientMessage(playerid, COLOR_WHITE, "Nu esti in vehiculul tau personal.");
	if(strlen(PlayerInfo[playerid][pPin]) != 0 && PlayerInfo[playerid][pPinLogged] == 0) {
		 SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda deoarece nu te-ai autentificat cu codul de securitate.");
		 SendClientMessage(playerid, COLOR_GREY, "Pentru a te autentifica, foloseste comanda '/loginpin'!");
		 return 1;
	}	
	if(colorpart==1) {
		if(CarInfo[idd][cColorOne] > 127) if(colorid <= 127) return SCM(playerid,-1, "Nu poti pune o culoare normal deoarece ai hidden");
                if(PlayerInfo[playerid][pHiddenColor] <= 0 && colorid > 127) return SendClientMessage(playerid, COLOR_WHITE, "Ai nevoie de macar 1 hidden color, pentru a pune o culoare speciala (127-256) pe masina.");
		if(colorid < 0 || colorid > 255) return SendClientMessage(playerid, COLOR_WHITE, "ID-ul culorilor este cuprins intre 0 si 255.");
 		CarInfo[idd][cColorOne] = colorid;
  		GivePlayerCash(playerid, -5000);
  		if(colorid > 127) {
   			PlayerInfo[playerid][pHiddenColor] -= 1;
   			UpdateVar(playerid, "HiddenColor", PlayerInfo[playerid][pHiddenColor]);
		}
		Update(playerid, pCashx);
		ChangeVehicleColor(car, colorid, CarInfo[idd][cColorTwo]);
  		SendClientMessage(playerid,COLOR_WHITE, "Vehicle color changed!");
  		GameTextForPlayer(playerid, "~r~-$5000", 5000, 1);
  		mysql_format(SQL, string, sizeof(string), "UPDATE cars SET ColorOne = %d WHERE ID=%d", colorid, idd);
	    mysql_tquery(SQL, string, "", "");
		return 1;
	}
	if(colorpart==2) {
		if(CarInfo[idd][cColorTwo] > 127) if(colorid <= 127) return SCM(playerid,-1, "Nu poti pune o culoare normal deoarece ai hidden");		
                if(PlayerInfo[playerid][pHiddenColor] <= 0 && colorid > 127) return SendClientMessage(playerid, COLOR_WHITE, "Ai nevoie de macar 1 hidden color, pentru a pune o culoare speciala (127-256) pe masina.");
		if(colorid < 0 || colorid > 255) return SendClientMessage(playerid, COLOR_WHITE, "ID-ul culorilor este cuprins intre 0 si 255.");
 		CarInfo[idd][cColorTwo] = colorid;
  		GivePlayerCash(playerid, -5000);
  		if(colorid > 127) {
   			PlayerInfo[playerid][pHiddenColor] -= 1;
   			Update(playerid, pHiddenColorx);
   			UpdateVar(playerid, "HiddenColor", PlayerInfo[playerid][pHiddenColor]);
		}
		Update(playerid, pCashx);
		ChangeVehicleColor(car, CarInfo[idd][cColorOne], colorid);
  		SendClientMessage(playerid,COLOR_WHITE, "Vehicle color changed!");
  		GameTextForPlayer(playerid, "~r~-$5000", 5000, 1);
  		mysql_format(SQL, string, sizeof(string), "UPDATE cars SET ColorTwo = %d WHERE ID=%d", colorid, idd);
	    mysql_tquery(SQL, string, "", "");
		return 1;
	}
	return 0;
}

ms  T/C

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...