Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Isso deve ser adicionado no topo do GM, ele salvara todas as informações do veiculo, você pode alterar conforme sua necessidade
- #define Hook%0(%1) stock%0_k2(%1)
- Hook AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2)
- {
- TotalCarros++;
- new vehicleid = AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2);
- VehicleInfo[vehicleid][VehModelo] = modelid;
- VehicleInfo[vehicleid][VehCor1] = color1;
- VehicleInfo[vehicleid][VehCor2] = color2;
- VehicleInfo[vehicleid][VehX] = spawn_x;
- VehicleInfo[vehicleid][VehY] = spawn_y;
- VehicleInfo[vehicleid][VehZ] = spawn_z;
- VehicleInfo[vehicleid][VehR] = z_angle;
- VehicleInfo[vehicleid][VehMultas] = 0;
- VehicleInfo[vehicleid][VehPaintJob] = 3;
- new str[128];
- format(str, sizeof(str), "%c%c%c%i%c%i%i", Random_Maiuscula(),Random_Maiuscula(),Random_Maiuscula(),
- Random_Numero(),Random_Maiuscula(),Random_Numero(), Random_Numero());
- format(VehicleInfo[vehicleid][VehPlaca], MAX_PLAYER_NAME, str);
- format(VehicleInfo[vehicleid][VehDono], 25, "Server");
- SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][VehPlaca]);
- for(new i = 0; i < 14; ++i)
- {
- RemoveVehicleComponent(vehicleid, GetVehicleComponentInSlot(vehicleid, i));
- }
- ChangeVehiclePaintjob(vehicleid, 3);
- switch(GetVehicleModel(vehicleid))
- {
- case 432: SetVehicleHealth(vehicleid, 10000);//rhino
- case 427: SetVehicleHealth(vehicleid, 1500);//enforce
- case 490: SetVehicleHealth(vehicleid, 4000);//FBI rancher
- case 528: SetVehicleHealth(vehicleid, 4500);//FBI truck
- case 601: SetVehicleHealth(vehicleid, 4500);//S.W.A.T
- case 470: SetVehicleHealth(vehicleid, 4000);//PATRIOT
- case 428: SetVehicleHealth(vehicleid, 4500);//Securicar
- }
- return vehicleid;
- }
- Hook AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay, addsiren=0)
- {
- TotalCarros++;
- new vehicleid = AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay, addsiren=0);
- VehicleInfo[vehicleid][VehModelo] = modelid;
- VehicleInfo[vehicleid][VehCor1] = color1;
- VehicleInfo[vehicleid][VehCor2] = color2;
- VehicleInfo[vehicleid][VehX] = spawn_x;
- VehicleInfo[vehicleid][VehY] = spawn_y;
- VehicleInfo[vehicleid][VehZ] = spawn_z;
- VehicleInfo[vehicleid][VehR] = z_angle;
- VehicleInfo[vehicleid][VehMultas] = 0;
- VehicleInfo[vehicleid][VehPaintJob] = 3;
- new str[10];
- format(str, sizeof(str), "%c%c%c%i%c%i%i", Random_Maiuscula(),Random_Maiuscula(),Random_Maiuscula(),
- Random_Numero(),Random_Maiuscula(),Random_Numero(), Random_Numero());
- format(VehicleInfo[vehicleid][VehPlaca], 10, str);
- format(VehicleInfo[vehicleid][VehDono], 25, "Server");
- SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][VehPlaca]);
- for(new i = 0; i < 14; ++i)
- {
- RemoveVehicleComponent(vehicleid, GetVehicleComponentInSlot(vehicleid, i));
- }
- ChangeVehiclePaintjob(vehicleid, 3);
- switch(GetVehicleModel(vehicleid))
- {
- case 432: SetVehicleHealth(vehicleid, 10000);//rhino
- case 427: SetVehicleHealth(vehicleid, 1500);//enforce
- case 490: SetVehicleHealth(vehicleid, 4000);//FBI rancher
- case 528: SetVehicleHealth(vehicleid, 4500);//FBI truck
- case 601: SetVehicleHealth(vehicleid, 4500);//S.W.A.T
- case 470: SetVehicleHealth(vehicleid, 4000);//PATRIOT
- case 428: SetVehicleHealth(vehicleid, 4500);//Securicar
- }
- return vehicleid;
- }
- Hook CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0)
- {
- TotalCarros++;
- new vehicleid = CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0);
- VehicleInfo[vehicleid][VehModelo] = vehicletype;
- VehicleInfo[vehicleid][VehCor1] = color1;
- VehicleInfo[vehicleid][VehCor2] = color2;
- VehicleInfo[vehicleid][VehX] = x;
- VehicleInfo[vehicleid][VehY] = y;
- VehicleInfo[vehicleid][VehZ] = z;
- VehicleInfo[vehicleid][VehMultas] = 0;
- VehicleInfo[vehicleid][VehR] = rotation;
- VehicleInfo[vehicleid][VehPaintJob] = 3;
- new str[10];
- format(str, sizeof(str), "%c%c%c%i%c%i%i", Random_Maiuscula(),Random_Maiuscula(),Random_Maiuscula(),
- Random_Numero(),Random_Maiuscula(),Random_Numero(), Random_Numero());
- format(VehicleInfo[vehicleid][VehPlaca], 10, str);
- format(VehicleInfo[vehicleid][VehDono], 25, "Server");
- SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][VehPlaca]);
- for(new i = 0; i < 14; ++i)
- {
- RemoveVehicleComponent(vehicleid, GetVehicleComponentInSlot(vehicleid, i));
- }
- ChangeVehiclePaintjob(vehicleid, 3);
- switch(GetVehicleModel(vehicleid))
- {
- case 432: SetVehicleHealth(vehicleid, 10000);//rhino
- case 427: SetVehicleHealth(vehicleid, 1500);//enforce
- case 490: SetVehicleHealth(vehicleid, 4000);//FBI rancher
- case 528: SetVehicleHealth(vehicleid, 4500);//FBI truck
- case 601: SetVehicleHealth(vehicleid, 4500);//S.W.A.T
- case 470: SetVehicleHealth(vehicleid, 4000);//PATRIOT
- case 428: SetVehicleHealth(vehicleid, 4500);//Securicar
- }
- return vehicleid;
- }
- #undef AddStaticVehicleEx
- #undef AddStaticVehicle
- #undef CreateVehicle
- #define AddStaticVehicle AddStaticVehicle_k2
- #define AddStaticVehicleEx AddStaticVehicleEx_k2
- #define CreateVehicle CreateVehicle_k2
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //Aqui é as unfirmações que todos os veiculos irá ter, isso pode ser evitado para hack de tunagem de carros, etc...
- //Não é necessario usar todas essas informações, isso vai de sua necessidade
- enum vInfo
- {
- Float:VehX,
- Float:VehY,
- Float:VehZ,
- Float:VehR,
- Float:VehLataria,
- VehEstacionado,
- VehPreco,
- VehMod[MAX_MODS],
- VehPaintJob,
- VehModelo,
- VehCor1,
- VehCor2,
- VehCombustivel,
- VehDono[MAX_PLAYER_NAME],
- VehValorVenda,
- VehPlaca[25],
- VehPreso,
- VehMultas,
- bool:VehOrg,
- Text3D:Label
- };
- new VehicleInfo[MAX_VEHICLES][vInfo];
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //Aqui será o modelo de salvamento dos veiculos das organizações, como eu uso DOF2, será salvo nesse modelo
- SalvarVeiculosOrgs()
- {
- new str[500], string[800], file[64];
- for(new i; i < MAX_ORG; ++i)
- {
- format(file, 64, /*O CAMINHO DA PASTA DAS ORGANIZAÇÕES*/, i);
- for(new vehicleid = 0, maxveh = GetVehiclePoolSize(); vehicleid <= maxveh; ++vehicleid)
- {
- if(!strcmp(InfoOrg[i][Nome], VehicleInfo[vehicleid][VehDono]))
- {
- format(str, sizeof(str), "VehOrg_%d", veh);
- format(string, sizeof(string), "%d|%d|%d|%d|%d|%f|%f|%f|%f|%s",
- VehicleInfo[vehicleid][VehModelo],
- VehicleInfo[vehicleid][VehCor1],
- VehicleInfo[vehicleid][VehCor2],
- VehicleInfo[vehicleid][VehPreso],
- VehicleInfo[vehicleid][VehMultas],
- VehicleInfo[vehicleid][VehX],
- VehicleInfo[vehicleid][VehY],
- VehicleInfo[vehicleid][VehZ],
- VehicleInfo[vehicleid][VehR],
- VehicleInfo[vehicleid][VehPlaca]);
- DOF2_SetString(file, str, string);
- DestroyVehicle(vehicleid);
- }
- }
- }
- return true;
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- CarregarVehOrgs()
- {
- new file[64], str[256], key[256], string[11][256];
- for(new i; i < MAX_ORG; ++i)
- {
- format(file, 64, /*O CAMINHO DA PASTA DAS ORGANIZAÇÕES*/, i);
- for(new veh = 0; veh < MAX_VEHORGS; ++veh)
- {
- format(key, sizeof(key), "VehOrg_%d", veh);
- format(str, sizeof(str), DOF2_GetString(file, key));
- split(str, string, '|');
- if(strval(string[0]))
- {
- new vehicleid = INVALID_VEHICLE_ID;
- vehicleid = AddStaticVehicleEx(
- strval(string[0]),
- floatstr(string[5]),
- floatstr(string[6]),
- floatstr(string[7]),
- floatstr(string[8]),
- strval(string[1]),
- strval(string[2]),
- -1);
- VehicleInfo[vehicleid][VehModelo] = strval(string[0]);
- VehicleInfo[vehicleid][VehCor1] = strval(string[1]);
- VehicleInfo[vehicleid][VehCor2] = strval(string[2]);
- VehicleInfo[vehicleid][VehPreso] = strval(string[3]);
- VehicleInfo[vehicleid][VehMultas] = strval(string[4]);
- VehicleInfo[vehicleid][VehX] = floatstr(string[5]);
- VehicleInfo[vehicleid][VehY] = floatstr(string[6]);
- VehicleInfo[vehicleid][VehZ] = floatstr(string[7]);
- VehicleInfo[vehicleid][VehR] = floatstr(string[8]);
- if(strlen(string[9]) < 6)
- {
- format(str, sizeof(str), "%c%c%c%i%c%i%i", Random_Maiuscula(),Random_Maiuscula(),Random_Maiuscula(),
- Random_Numero(),Random_Maiuscula(),Random_Numero(), Random_Numero());
- format(VehicleInfo[vehicleid][VehPlaca], MAX_PLAYER_NAME, str);
- }
- else
- {
- format(VehicleInfo[vehicleid][VehPlaca], MAX_PLAYER_NAME, string[9]);
- }
- format(VehicleInfo[vehicleid][VehDono], 25, NomeOrg(i));
- VehicleInfo[vehicleid][VehOrg] = true;
- SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][VehPlaca]);
- if(VehicleInfo[vehicleid][VehPreso])
- {
- FixVehicleDetra(vehicleid);
- }
- }
- }
- }
- return true;
- }
- stock split(const strsrc[], const strdest[][], delimiter)
- {
- new i, li;
- new aNum;
- new len;
- while(i <= strlen(strsrc))
- {
- if(strsrc[i]==delimiter || i==strlen(strsrc))
- {
- len = strmid(strdest[aNum], strsrc, li, i, 128);
- strdest[aNum][len] = 0;
- li = i+1;
- aNum++;
- }
- i++;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment