[COD] Salva Tuning

Adicione a Forwards:
PAWN Code:
forward IniciandoDraKoN();
forward CarregarPecas(vehicleid);
forward CarregarMods();
forward SalvarModosDraKoN();
forward splitDraKoN(const strsrc[], strdest[][], delimiter);

em OnGameModeInit:

PAWN Code:
CarregarMods();
SetTimer("IniciandoDraKoN", 10000, 0);

Em OnPlayerSpawn:
PAWN Code:
CarregarPecas(vehicleid);

Adiciona Esta Publics
PAWN Code:
public OnVehicleMod(playerid,vehicleid,componentid)
{

SendClientMessage(playerid,0xFFFFFF96,"Peca do Veiculos Custa 100 Reais Dãã.");
GivePlayerMoney(playerid,-100);
SalvarModosDraKoN();

if(ModosVeiculosDRK[vehicleid][0] == 0)
{
ModosVeiculosDRK[vehicleid][0] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][1] == 0)
{
ModosVeiculosDRK[vehicleid][1] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][2] == 0)
{
ModosVeiculosDRK[vehicleid][2] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][3] == 0)
{
ModosVeiculosDRK[vehicleid][3] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][4] == 0)
{
ModosVeiculosDRK[vehicleid][4] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][5] == 0)
{
ModosVeiculosDRK[vehicleid][5] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][6] == 0)
{
ModosVeiculosDRK[vehicleid][6] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][7] == 0)
{
ModosVeiculosDRK[vehicleid][7] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][8] == 0)
{
ModosVeiculosDRK[vehicleid][8] = componentid;
}
else if(ModosVeiculosDRK[vehicleid][9] == 0)
{
ModosVeiculosDRK[vehicleid][9] = componentid;
}
else
{
SendClientMessage(playerid,0xFFFFFF96,"Seu Veiculo Tem Todas Pecas.");
}
return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
ModosVeiculosDRK[vehicleid][10] = paintjobid;
return 1;
}

public CarregarPecas(vehicleid)
{
if(ModosVeiculosDRK[vehicleid][0] >= 1000 && ModosVeiculosDRK[vehicleid][0] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][0])) != ModosVeiculosDRK[vehicleid][0])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][0]);
}
}
if(ModosVeiculosDRK[vehicleid][1] >= 1000 && ModosVeiculosDRK[vehicleid][1] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][1])) != ModosVeiculosDRK[vehicleid][1])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][1]);
}
}
if(ModosVeiculosDRK[vehicleid][2] >= 1000 && ModosVeiculosDRK[vehicleid][2] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][2])) != ModosVeiculosDRK[vehicleid][2])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][2]);
}
}
if(ModosVeiculosDRK[vehicleid][3] >= 1000 && ModosVeiculosDRK[vehicleid][3] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][3])) != ModosVeiculosDRK[vehicleid][3])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][3]);
}
}
if(ModosVeiculosDRK[vehicleid][4] >= 1000 && ModosVeiculosDRK[vehicleid][4] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][4])) != ModosVeiculosDRK[vehicleid][4])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][4]);
}
}
if(ModosVeiculosDRK[vehicleid][5] >= 1000 && ModosVeiculosDRK[vehicleid][5] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][5])) != ModosVeiculosDRK[vehicleid][5])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][5]);
}
}
if(ModosVeiculosDRK[vehicleid][6] >= 1000 && ModosVeiculosDRK[vehicleid][6] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][6])) != ModosVeiculosDRK[vehicleid][6])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][6]);
}
}
if(ModosVeiculosDRK[vehicleid][7] >= 1000 && ModosVeiculosDRK[vehicleid][7] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][7])) != ModosVeiculosDRK[vehicleid][7])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][7]);
}
}
if(ModosVeiculosDRK[vehicleid][8] >= 1000 && ModosVeiculosDRK[vehicleid][8] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][8])) != ModosVeiculosDRK[vehicleid][8])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][8]);
}
}
if(ModosVeiculosDRK[vehicleid][9] >= 1000 && ModosVeiculosDRK[vehicleid][9] <= 1193)
{
if(GetVehicleComponentInSlot(vehicleid,GetVehicleComponentType(ModosVeiculosDRK[vehicleid][9])) != ModosVeiculosDRK[vehicleid][9])
{
AddVehicleComponent(vehicleid,ModosVeiculosDRK[vehicleid][9]);
}
}
if(ModosVeiculosDRK[vehicleid][10] > 0)
{
ChangeVehiclePaintjob(vehicleid,ModosVeiculosDRK[vehicleid][10]);
}
return 1;
}

Abaixo de OnPlayerCommandText
PAWN Code:
if(strcmp("/semmod",cmd,true)==0)
{
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,0xFFFFFF96,"Você deve estar um veículo.");
return 1;
}
new vehicleid = GetPlayerVehicleID(playerid);
if(ModosVeiculosDRK[vehicleid][0] > 0)
{
ModosVeiculosDRK[vehicleid][0] = 0;
ModosVeiculosDRK[vehicleid][1] = 0;
ModosVeiculosDRK[vehicleid][2] = 0;
ModosVeiculosDRK[vehicleid][3] = 0;
ModosVeiculosDRK[vehicleid][4] = 0;
ModosVeiculosDRK[vehicleid][5] = 0;
ModosVeiculosDRK[vehicleid][6] = 0;
ModosVeiculosDRK[vehicleid][7] = 0;
ModosVeiculosDRK[vehicleid][8] = 0;
ModosVeiculosDRK[vehicleid][9] = 0;
ModosVeiculosDRK[vehicleid][10] = 0;
SendClientMessage(playerid,0xFFFFFF96,"Veiculos Resetado e Spawnada.");
SetVehicleToRespawn(vehicleid);
return 1;
}
else
{
SendClientMessage(playerid,0xFFFFFF96,"Veiculo Ja Não Te MOD");
}
return 1;
}

Final do Gm Abaixo de Tudo

PAWN Code:
public CarregarMods()
{
new arrCoords[11][64];
new strFromFile2[256];
new File: file = fopen("carmods.cfg", io_read);
if (file)
{
new idx;
while((idx < MAX_VEHICLES))
{
fread(file, strFromFile2);
splitDraKoN(strFromFile2, arrCoords, '|');
ModosVeiculosDRK[idx][0] = strval(arrCoords[0]);
ModosVeiculosDRK[idx][1] = strval(arrCoords[1]);
ModosVeiculosDRK[idx][2] = strval(arrCoords[2]);
ModosVeiculosDRK[idx][3] = strval(arrCoords[3]);
ModosVeiculosDRK[idx][4] = strval(arrCoords[4]);
ModosVeiculosDRK[idx][5] = strval(arrCoords[5]);
ModosVeiculosDRK[idx][6] = strval(arrCoords[6]);
ModosVeiculosDRK[idx][7] = strval(arrCoords[7]);
ModosVeiculosDRK[idx][8] = strval(arrCoords[8]);
ModosVeiculosDRK[idx][9] = strval(arrCoords[9]);
ModosVeiculosDRK[idx][10] = strval(arrCoords[10]);
idx++;
}
fclose(file);
}
return 1;
}

public SalvarModosDraKoN()
{
new idx;
new File: file2;
while((idx < MAX_VEHICLES))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
ModosVeiculosDRK[idx][0],
ModosVeiculosDRK[idx][1],
ModosVeiculosDRK[idx][2],
ModosVeiculosDRK[idx][3],
ModosVeiculosDRK[idx][4],
ModosVeiculosDRK[idx][5],
ModosVeiculosDRK[idx][6],
ModosVeiculosDRK[idx][7],
ModosVeiculosDRK[idx][8],
ModosVeiculosDRK[idx][9],
ModosVeiculosDRK[idx][10]);
if(idx == 0)
{
file2 = fopen("pecascarros.cfg", io_write);
}
else
{
file2 = fopen("pecascarros.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}

stock SalvarPontoCar(string[], argument, schar)
{
new length = strlen(string), arg, result[128], index;
for (new i = 0; i < length; i++)
{
if (string[i] == schar || i == length || string[i + 1] == 10)
{
arg++;
if (arg == argument + 1)
{
result[i-index] = EOS;
return result;
}
else if (arg == argument)
index = i+1;
}
else if (arg == argument)
result[i - index] = string[i];
}
return result;
}

public splitDraKoN(const strsrc[], strdest[][], delimiter)
{
new i, li;
new NumDraKoN;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[NumDraKoN], strsrc, li, i, 128);
strdest[NumDraKoN][len] = 0;
li = i+1;
NumDraKoN++;
}
i++;
}
return 1;
}

StumbleDiggTechnoratiRedditDelicious