14.07.2012, 22:23
Boas malta,eu uso o GM Carlitos roleplay como base,bla bla bla etc,so que tou tendo problema no comando de comprar carro,pois quando o compro aquilo vai sendo da faction 0,ta ai o cmd
atao eu adicinei a linha
logo no topo,em primeiro lugar mas continua dando como sendo da faction 0 ainda e agora? to enervando com esta merd* falei com um tipo e ele disse que era mudar a variavel,mas nao percebi nadinha que ele falou e agora? como resolvo esta merdinha?
pawn Код:
if(strcmp(cmd, "/comprarveiculo", true) == 0)
{
if(PlayerInfo[playerid][msNCarKey] != 4)
{
for(new i = 1; i < sizeof(Businesses); i++)
{
if (PlayerToPoint(25.0, playerid,Businesses[i][ExitX], Businesses[i][ExitY], Businesses[i][ExitZ]))
{
if(GetPlayerVirtualWorld(playerid) == i)
{
if(Businesses[i][BizType] == 9)
{
if(PlayerToPoint(10.0, playerid,345.5447,160.1090,1014.1875))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Comando: /comprarveiculo [modelo]");
return 1;
}
new TCarModel = strval(tmp);
ShopCar[playerid] = CreateVehicle(TCarModel, -538.8217, 2599.4775, 53.0267, 271.4271, 1, 1, 1);
if(IsValidModel(TCarModel))
{
new valor= TCarModel-400;
new price = VehiclePrices[valor][0];
new ctill = VehiclePrices[valor][0]/4;
new vprice;
if(PlayerInfo[playerid][msVipActive] != 0)
{
vprice = VehiclePrices[valor][0]/2;
}
else
{
vprice = VehiclePrices[valor][0];
}
if (vprice <= GetPlayerEuros(playerid))
{
PlayerActionMessage(playerid,15.0,"entrega um cheque ao gerente do Stand, que dб em troca a chave do carro");
SendClientMessage(playerid, COLOR_YELLOW2, "Compraste o carro com sucesso.");
Car[ShopCar[playerid]][FactionCar] = 255;
Car[ShopCar[playerid]][CarModel] = TCarModel;
Car[ShopCar[playerid]][CarID] = ShopCar[playerid];
Car[ShopCar[playerid]][ParkX] = 2461.6431;
Car[ShopCar[playerid]][ParkY] = -41.9446;
Car[ShopCar[playerid]][ParkZ] = 26.1095;
Car[ShopCar[playerid]][ParkAngle] = 0.0;
Car[ShopCar[playerid]][CarColor1] = 1;
Car[ShopCar[playerid]][CarColor2] = 1;
Car[ShopCar[playerid]][Owned] = 1;
Car[ShopCar[playerid]][Materials] = 0;
Car[ShopCar[playerid]][cCocaina] = 0;
Car[ShopCar[playerid]][cHeroina] = 0;
Car[ShopCar[playerid]][cExtasy] = 0;
Car[ShopCar[playerid]][cErva] = 0;
Car[ShopCar[playerid]][cPolen] = 0;
Car[ShopCar[playerid]][Sell] = 0;
Car[ShopCar[playerid]][Locked] = 0;
new Matri = random(sizeof(MatriculasNames));
if(Car[ShopCar[playerid]][Matriculed]==0)
{
if(ShopCar[playerid] <= 10)
{
format(string, sizeof(string), "0%d-%s-%d", ShopCar[playerid], MatriculasNames[Matri], ShopCar[playerid]+15);
strmid(Car[ShopCar[playerid]][Matricula], string, 0, strlen(string), 999);
Car[ShopCar[playerid]][Matriculed]= 1;
}
else if(ShopCar[playerid] <= 80 && ShopCar[playerid] >= 10)
{
format(string, sizeof(string), "%d-%s-%d", ShopCar[playerid], MatriculasNames[Matri], ShopCar[playerid]+15);
strmid(Car[ShopCar[playerid]][Matricula], string, 0, strlen(string), 999);
Car[ShopCar[playerid]][Matriculed]= 1;
}
else if(ShopCar[playerid] <= 100 && ShopCar[playerid] >= 80)
{
format(string, sizeof(string), "%d-%s-%d", ShopCar[playerid], MatriculasNames[Matri], ShopCar[playerid]-15);
strmid(Car[ShopCar[playerid]][Matricula], string, 0, strlen(string), 999);
Car[ShopCar[playerid]][Matriculed]= 1;
}
else
{
format(string, sizeof(string), "%d-%s-%d", ShopCar[playerid]-90, MatriculasNames[Matri], ShopCar[playerid]-85);
strmid(Car[ShopCar[playerid]][Matricula], string, 0, strlen(string), 999);
Car[ShopCar[playerid]][Matriculed]= 1;
}
}
format(string, sizeof(string), "%s", Car[ShopCar[playerid]][Matricula]);
SetVehicleNumberPlate(ShopCar[playerid],string);
ShowMenuForPlayer(Colors, playerid);
SaveCars();
if(PlayerInfo[playerid][msVipActive] != 0)
{
GivePlayerEuros(playerid, -price/2);
Businesses[i][Products]--;
Businesses[i][Till]+=price/2-ctill;
}
else
{
GivePlayerEuros(playerid, -price);
Businesses[i][Products]--;
Businesses[i][Till]+=price-ctill;
}
for(new h = 0; h < sizeof(Car); h++)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
strmid(Car[ShopCar[playerid]][Owner], playername, 0, strlen(playername), 999);
}
if(PlayerInfo[playerid][msNCarKey] == 0)
{
PlayerInfo[playerid][msCarKey1] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msNCarKey] == 1)
{
if(PlayerInfo[playerid][msCarKey1] == 255)
{
PlayerInfo[playerid][msCarKey1] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey2] == 255)
{
PlayerInfo[playerid][msCarKey2] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey3] == 255)
{
PlayerInfo[playerid][msCarKey3] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey4] == 255)
{
PlayerInfo[playerid][msCarKey4] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
}
else if(PlayerInfo[playerid][msNCarKey] == 2)
{
if(PlayerInfo[playerid][msCarKey1] == 255)
{
PlayerInfo[playerid][msCarKey1] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey2] == 255)
{
PlayerInfo[playerid][msCarKey2] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey3] == 255)
{
PlayerInfo[playerid][msCarKey3] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey4] == 255)
{
PlayerInfo[playerid][msCarKey4] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
}
else if(PlayerInfo[playerid][msNCarKey] == 3)
{
if(PlayerInfo[playerid][msCarKey1] == 255)
{
PlayerInfo[playerid][msCarKey1] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey2] == 255)
{
PlayerInfo[playerid][msCarKey2] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey3] == 255)
{
PlayerInfo[playerid][msCarKey3] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
else if(PlayerInfo[playerid][msCarKey4] == 255)
{
PlayerInfo[playerid][msCarKey4] = ShopCar[playerid];
PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
OnPlayerDataSave(playerid);
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "ERRO: Nгo tens dinheiro!");
DestroyVehicle(ShopCar[playerid]);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "ERRO: Modelo invбlido.");
DestroyVehicle(ShopCar[playerid]);
}
}
}
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "ERRO: Jб tens carros sufecientes!");
}
return 1;
}
pawn Код:
Car[ShopCar[playerid]][FactionCar] = 255;