Modelo: || Cor1: || Cor2: || Setado por: || IP:
CMD:setcar(playerid, params[]){
new Float:poscarx, Float:poscary, Float:poscarz, Float:posangle;
new pIp[25], Name[MAX_PLAYER_NAME], descrisao[20];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
GetPlayerIp(playerid, pIp, sizeof(pIp));
GetPlayerPos(playerid, poscarx, poscary, poscarz);
GetVehicleZAngle(GetPlayerVehicleID(playerid),posangle);
if(sscanf(params,"ddds",model,Cor01,Cor02,descrisao)) return SendClientMessage(playerid, corsscanf, "/setcar [modelo] [cor1] [cor2]");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, ERRO, "| ERRO | Vocк nгo estб em um veнculo");
SetTimerEx("CriarVeiculo", 5000, false, "dffffdd",model,poscarx,poscary,poscarz,posangle,Cor01,Cor02);
SendClientMessage(playerid, Verde, "| INFO | Veнculo setado com sucesso");
return 1;
}
forward CriarVeiculo(m,Float:x,Float:y,Float:z,Float:r,c,d);
public CriarVeiculo(m,Float:x,Float:y,Float:z,Float:r,c,d) CreateVehicle(m,x,y,z,r,Cor01,Cor02,60000);
new Float:X,Float:Y,Float:Z;
format(str, sizeof(str), "carros.ini");
new VeiculoID =GetPlayerVehicleID(playerid);
GetVehiclePos(VeiculoID, X, Y, Z);
DOF2::SetFloat(str, "X", X);
DOF2::SetFloat(str, "Y", Y);
DOF2::SetFloat(str, "Z", Z);
//topo
enum VInfo
{
Float:X,
Float:Y,
Float:Z,
};
new CarrosInfo[MAX_VEHICLES][VInfo];
//no comando
new fstring[60];
new Float:cX,Float:cY,Float:cZ;
new VeiculoID = GetPlayerVehicleID(playerid);
GetVehiclePos(VeiculoID, cX, cY, cZ);
for(i = 0; i != MAX_VEHICLES; ++i)
{
format(fstring, 60, "Carros/%d.ini", i);
if(!DOF2_FileExists(fstring)) break;//verifica
}
format(fstring, 60, "Carros/%d.ini", i);//irб setar em ordem na pasta,0,1,2,3,4......
DOF2_SetFloat(fstring, "X", cX);
DOF2_SetFloat(fstring, "Y", cY);
DOF2_SetFloat(fstring, "Z", cZ);
//para carregar exemplo:
new fstring[60];
for(new i = 0; i < sizeof(CarrosInfo); i++)
{
format(fstring,sizeof(fstring),Carros/%d.ini,i);
if(DOF2_FileExists(fstring))
{
CarrosInfo[i][X] = DOF2_GetFloat(fstring, "X");
CarrosInfo[i][Y] = DOF2_GetFloat(fstring, "Y");
CarrosInfo[i][Z] = DOF2_GetFloat(fstring, "Z");
Olб, queria salvar os veiculos setados no meu server em DOF2, exemplo:
a cada veiculo criado Salva no arquivo "carros.txd": Код:
Modelo: || Cor1: || Cor2: || Setado por: || IP: |