Aqui o comando para mudar o modelo do carro:
pawn Код:
if(strcmp(cmd, "/acarmodel", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTORANGE, "[Comando]: /acarmodel [modelid]");
return 1;
}
new thecar = strval(tmp);
new Float:PosXX, Float:PosYY, Float:PosZZ;
GetVehicleVelocity(GetPlayerVehicleID(playerid), PosXX, PosYY, PosZZ);
if (PlayerInfo[playerid][mstrvbcAdmin] >= 5)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(thecar > 399 && thecar < 612)
{
if(Car[GetPlayerVehicleID(playerid)][Owned] == 1)
{
return 1;
}
new car = GetPlayerVehicleID(playerid) - 1;
new vehicleid = GetPlayerVehicleID(playerid);
DynamicCars[car][CarModel] = thecar;
new wstring[128];
format(wstring, sizeof(wstring), "Tu escolheste o veiculo ID %d e alteras-te o modelo: %d.", vehicleid,thecar);
SendClientMessage(playerid,COLOR_ADMINCMD, wstring);
new Float:cx,Float:cy,Float:cz;
GetVehiclePos(vehicleid,cx,cy,cz);
new Float:angle;
GetVehicleZAngle(vehicleid, angle);
DestroyVehicle(vehicleid);
CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1);
PutPlayerInVehicle(playerid,vehicleid,0);
SetVehiclePos(vehicleid, cx, cy, cz);
SetVehicleZAngle(vehicleid, angle);
LoadComponents(vehicleid);
SaveDynamicCars();
if(EngineStatus[GetPlayerVehicleID(playerid)] == 1)
{
SetVehicleEngineOn(GetPlayerVehicleID(playerid));
}
if(LuzesStatus[GetPlayerVehicleID(playerid)] == 1)
{
SetVehicleLightsOn(GetPlayerVehicleID(playerid));
}
if(vehicleid <= 10)
{
format(string, sizeof(string), "0%d-%s-%d", vehicleid, MatriculasNames[vehicleid], vehicleid+15);
SetVehicleNumberPlate(vehicleid,string);
}
else if(vehicleid <= 100 && vehicleid >= 10)
{
format(string, sizeof(string), "%d-%s-%d", vehicleid, MatriculasNames[vehicleid], vehicleid+15);
SetVehicleNumberPlate(vehicleid,string);
}
else
{
format(string, sizeof(string), "%d-%s-%d", vehicleid-100, MatriculasNames[vehicleid], vehicleid-85);
SetVehicleNumberPlate(vehicleid,string);
}
SetVehicleVelocity(GetPlayerVehicleID(playerid), PosXX, PosYY, PosZZ);
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Incorrecto Modelo ID, Model ID's: 400-611.");
}
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:]Nгo estas dentro de um veiculo!");
}
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Nгo tens nivel suficiente para usufruires deste comando.");
}
}
return 1;
Para meter em factions/organizaзхes:
pawn Код:
if(strcmp(cmd, "/acarfaction", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTORANGE, "[Comando]: /acarfaction [faction]");
return 1;
}
new thecar = strval(tmp);
if (PlayerInfo[playerid][mstrvbcAdmin] >= 10)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(thecar < 1 || 255)
{
if(Car[GetPlayerVehicleID(playerid)][Owned] == 1)
{
return 1;
}
new car = GetPlayerVehicleID(playerid) - 1;
new vehicleid = GetPlayerVehicleID(playerid);
DynamicCars[car][FactionCar] = thecar;
new wstring[128];
format(wstring, sizeof(wstring), "Tu escolheste o veiculo ID %d's para a faction: %d.", vehicleid,thecar);
SendClientMessage(playerid,COLOR_ADMINCMD, wstring);
SaveDynamicCars();
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Incorrecta faciton ID, Faction ID's: 1-10.");
}
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Nгo tens nivel suficiente para usufruires deste comando.");
}
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Nгo tens nivel suficiente para usufruires deste comando.");
}
}
return 1;
Comando para comprar veiculos no stand:
pawn Код:
if(strcmp(cmd, "/comprarveiculo", true) == 0)
{
if(PlayerInfo[playerid][msNCarKey] != 4)
{
for(new i = 0; 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]][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;
Comando para mudar o tipo de veiculo:
pawn Код:
if(strcmp(cmd, "/acartype", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTORANGE, "[Comando]: /acartype [tipo]");
return 1;
}
new thecar = strval(tmp);
if (PlayerInfo[playerid][mstrvbcAdmin] >= 5)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(Car[GetPlayerVehicleID(playerid)][Owned] == 1)
{
return 1;
}
new car = GetPlayerVehicleID(playerid) - 1;
new vehicleid = GetPlayerVehicleID(playerid);
DynamicCars[car][CarType] = thecar;
new wstring[128];
format(wstring, sizeof(wstring), "Tu escolheste o veiculo ID %d's para o tipo: %d.", vehicleid,thecar);
SendClientMessage(playerid,COLOR_ADMINCMD, wstring);
SaveDynamicCars();
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Nгo estas dentro de um veiculo.");
}
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Nгo tens nivel suficiente para usufruires deste comando.");
}
}
return 1;