Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define CARROS 0
- #define MAX_CARROS 50
- #define SPAWN_X 1941.8912
- #define SPAWN_Y 1309.2141
- #define SPAWN_Z 9.2578
- #define ANGULO 129.7679
- #define Pasta "Veiculos/%s.ini"
- #define Car_Landstalker 30000
- #define Car_Perenial 30000
- #define Car_Solair 30000
- #define Car_Regina 30000
- #define Car_Rancher 30000
- #define Car_Huntley 30000
- #define Car_Moonbeam 30000
- #define Car_Bravura 30000
- #define Car_Manana 30000
- #define Car_Esperanto 30000
- #define Car_Previon 30000
- #define Car_Virgo 30000
- #define Car_Blista_Compact 30000
- #define Car_Majestic 30000
- #define Car_Fortune 30000
- #define Car_Cadrona 30000
- #define Car_Tampa 30000
- #define Car_Club 30000
- #define Car_Admiral 30000
- #define Car_Glendale 30000
- #define Car_Oceanic 30000
- #define Car_Greenwood 30000
- #define Car_Nebula 30000
- #define Car_Williard 30000
- #define Car_Intruder 30000
- #define Car_Primo 30000
- #define Car_Clover 30000
- #define Car_Sentinel 30000
- #define Car_Washington 30000
- #define Car_Premier 30000
- #define Car_Elegant 30000
- #define Car_Vincent 30000
- #define Car_Sunrise 30000
- #define Car_Merit 30000
- #define Car_Emperor 30000
- #define Car_Stafford 30000
- #define Car_Buffalo 30000
- #define Car_Sabre 30000
- #define Car_Phoenix 30000
- #define Car_Alpha 30000
- #define Car_Buccaneer 30000
- #define Car_Stallion 30000
- #define Car_Hermes 30000
- #define Car_Hustler 30000
- #define Car_Bullet 30000
- #define Car_Uranus 30000
- #define Car_Jester 30000
- #define Car_Sultan 30000
- #define Car_Stratum 30000
- #define Car_Elegy 30000
- #define Car_Flash 30000
- #define Car_Infernus 30000
- #define Car_Cheetah 30000
- #define Car_Banshee 30000
- #define Car_Hotknife 30000
- #define Car_Turismo 30000
- #define Car_ZR_350 30000
- #define Car_Comet 30000
- #define Car_Super_GT 30000
- #define Car_Windsor 30000
- #define Car_Feltzer 30000
- #define Car_Euros 30000
- #define Car_Linerunner 30000
- #define Car_Mr_Whoopee 30000
- #define Car_Flatbed 30000
- #define Car_Yankee 30000
- #define Car_Boxville 30000
- #define Car_Benson 30000
- #define Car_Petrol 30000
- #define Car_Roadtrain 30000
- #define Car_Duneride 30000
- #define Car_Pony 30000
- #define Car_Bobcat 30000
- #define Car_Rumpo 30000
- #define Car_Walton 30000
- #define Car_Burrito 30000
- #define Car_Sadler 30000
- #define Car_Yosemite 30000
- #define Car_Picador 30000
- #define Car_Remington 30000
- #define Car_Slamvan 30000
- #define Car_Blade 30000
- #define Car_Savanna 30000
- #define Car_Broadway 30000
- #define Car_Tornado 30000
- #define Car_Tahoma 30000
- #define Car_PCJ_600 30000
- #define Car_Faggio 30000
- #define Car_Freeway 30000
- #define Car_Sanchez 30000
- #define Car_BMX 30000
- #define Car_Bike 30000
- #define Car_Mountain_Bike 30000
- #define Car_FCR_900 30000
- #define Car_NRG_500 30000
- #define Car_BF_400 30000
- #define Car_Wayfarer 30000
- enum cInfo
- {
- cModel,
- Float:cLocationx,
- Float:cLocationy,
- Float:cLocationz,
- Float:cAngle,
- cColorOne,
- cColorTwo,
- cOwner[MAX_PLAYER_NAME],
- cValue,
- cOwned,
- cLock,
- cmod1,
- cmod2,
- cmod3,
- cmod4,
- cmod5,
- cmod6,
- cmod7,
- cmod8,
- cmod9,
- cmod10,
- cmod11,
- cmod12,
- cmod13,
- cmod14,
- cmod15,
- };
- new InfoCarros[MAX_CARROS][cInfo];
- new
- vNames[212][] =
- {
- "Landstalker", "Bravura", "Buffalo", "Linerunner", "Pereniel", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
- "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat", "Mr Whoopee", "BF Injection",
- "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
- "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
- "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider",
- "Glendale", "Oceanic", "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina",
- "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher", "Virgo", "Greenwood",
- "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B",
- "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropdust", "Stunt", "Tanker", "RoadTrain",
- "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune", "Cadrona", "FBI Truck",
- "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover",
- "Sadler", "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster A",
- "Monster B", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito", "Freight", "Trailer",
- "Kart", "Mower", "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "Newsvan", "Tug", "Trailer A", "Emperor",
- "Wayfarer", "Euros", "Hotdog", "Club", "Trailer B", "Trailer C", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
- "Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T. Van", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A", "Luggage Trailer B",
- "Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer"
- }
- ;
- stock ReturnVehicleID(vName[])
- {
- for(new x; x != 211; x++) if(strfind(vNames[x], vName, true) != -1) return x + 400;
- return INVALID_VEHICLE_ID;
- }
- stock split(const strsrc[], 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 1;
- }
- #pragma tabsize 0
- new Text:TDEditor_TD[4];
- #define DIALOG_CONCE 1
- #define DIALOG_CARRO 2
- #define DIALOG_CCARRO 3
- main()
- {
- print("\n----------------------------------");
- print(" Bare Script\n");
- print("----------------------------------\n");
- }
- public OnPlayerConnect(playerid)
- {
- GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new idx;
- new cmd[256];
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/conce", true) == 0) {
- TextDrawShowForPlayer(playerid, TDEditor_TD[0]);
- TextDrawShowForPlayer(playerid, TDEditor_TD[1]);
- TextDrawShowForPlayer(playerid, TDEditor_TD[2]);
- TextDrawShowForPlayer(playerid, TDEditor_TD[3]);
- SelectTextDraw(playerid, 0xC0C0C0AA);
- return 1;
- }
- if(strcmp(cmd, "/grana", true) == 0) {
- GivePlayerMoney(playerid, 999999);
- return 1;
- }
- if(!strcmp(cmdtext, "/vendercarro", true))
- {
- if(IsPlayerConnected(playerid))
- {
- if (!IsPlayerInAnyVehicle(playerid) || !GetPlayerCarID(playerid, GetPlayerVehicleID(playerid))) return SendClientMessage(playerid,0xFFFFFF96,"{AFAFAF}** Você não está em um veículo ou ele não é seu!");
- new vehid = GetPlayerVehicleID(playerid);
- InfoCarros[vehid][cLocationx] = 5000.0;
- InfoCarros[vehid][cLocationy] = 5000.0;
- InfoCarros[vehid][cLocationz] = 5000.0;
- InfoCarros[vehid][cAngle] = 30.0;
- strmid(InfoCarros[vehid][cOwner], "Ninguém", 0, 24);
- RemovePlayerFromVehicle(playerid);
- TogglePlayerControllable(playerid, 1);
- GivePlayerMoney(playerid, InfoCarros[vehid][cValue]/2);
- SalvarCarros();
- DestroyVehicle(vehid);
- CreateVehicle(InfoCarros[vehid][cModel],InfoCarros[vehid][cLocationx],InfoCarros[vehid][cLocationy],InfoCarros[vehid][cLocationz]+1.0,InfoCarros[vehid][cAngle],InfoCarros[vehid][cColorOne],InfoCarros[vehid][cColorTwo],60000);
- return 1;
- }
- }
- if(strcmp(cmd, "/meucarro", true) == 0) return ShowPlayerDialog(playerid, DIALOG_CARRO, DIALOG_STYLE_LIST, "Meu Carro", "Estacionar\nTrancar Carro\nCor\nConectar Veiculo\nDesconectar Veiculo", "Selecionar", "Sair");
- return 0;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerInterior(playerid,0);
- TogglePlayerClock(playerid,0);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- SetupPlayerForClassSelection(playerid)
- {
- SetPlayerInterior(playerid,14);
- SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
- SetPlayerFacingAngle(playerid, 270.0);
- SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
- SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetupPlayerForClassSelection(playerid);
- return 1;
- }
- public OnGameModeInit()
- {
- SetGameModeText("Bare Script");
- ShowPlayerMarkers(1);
- ShowNameTags(1);
- AllowAdminTeleport(1);
- AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);
- TDEditor_TD[0] = TextDrawCreate(120.117607, 74.499984, "box");
- TextDrawLetterSize(TDEditor_TD[0], 0.000000, 31.223527);
- TextDrawTextSize(TDEditor_TD[0], 514.706359, 0.000000);
- TextDrawAlignment(TDEditor_TD[0], 1);
- TextDrawColor(TDEditor_TD[0], -1);
- TextDrawUseBox(TDEditor_TD[0], 1);
- TextDrawBoxColor(TDEditor_TD[0], 144);
- TextDrawSetShadow(TDEditor_TD[0], 0);
- TextDrawSetSelectable(TDEditor_TD[0], true);
- TextDrawSetOutline(TDEditor_TD[0], 0);
- TextDrawBackgroundColor(TDEditor_TD[0], 255);
- TextDrawFont(TDEditor_TD[0], 1);
- TextDrawSetProportional(TDEditor_TD[0], 1);
- TextDrawSetShadow(TDEditor_TD[0], 0);
- TDEditor_TD[1] = TextDrawCreate(111.647026, 58.750015, "Concessionaria");
- TextDrawLetterSize(TDEditor_TD[1], 0.577881, 2.795834);
- TextDrawAlignment(TDEditor_TD[1], 1);
- TextDrawColor(TDEditor_TD[1], -1);
- TextDrawSetShadow(TDEditor_TD[1], 0);
- TextDrawSetOutline(TDEditor_TD[1], 1);
- TextDrawBackgroundColor(TDEditor_TD[1], 255);
- TextDrawFont(TDEditor_TD[1], 0);
- TextDrawSetProportional(TDEditor_TD[1], 1);
- TextDrawSetShadow(TDEditor_TD[1], 0);
- TDEditor_TD[2] = TextDrawCreate(125.235336, 92.000015, "");
- TextDrawLetterSize(TDEditor_TD[2], 0.000000, 0.000000);
- TextDrawTextSize(TDEditor_TD[2], 90.000000, 90.000000);
- TextDrawAlignment(TDEditor_TD[2], 1);
- TextDrawColor(TDEditor_TD[2], -1);
- TextDrawSetShadow(TDEditor_TD[2], 0);
- TextDrawSetOutline(TDEditor_TD[2], 0);
- TextDrawBackgroundColor(TDEditor_TD[2], 25168);
- TextDrawFont(TDEditor_TD[2], 5);
- TextDrawSetProportional(TDEditor_TD[2], 0);
- TextDrawSetShadow(TDEditor_TD[2], 0);
- TextDrawSetSelectable(TDEditor_TD[2], true);
- TextDrawSetPreviewModel(TDEditor_TD[2], 411);
- TextDrawSetPreviewRot(TDEditor_TD[2], 0.000000, 0.000000, 0.000000, 1.000000);
- TextDrawSetPreviewVehCol(TDEditor_TD[2], 1, 1);
- TDEditor_TD[3] = TextDrawCreate(217.421783, 91.483383, "");
- TextDrawLetterSize(TDEditor_TD[3], 0.000000, 0.000000);
- TextDrawTextSize(TDEditor_TD[3], 90.000000, 90.000000);
- TextDrawAlignment(TDEditor_TD[3], 1);
- TextDrawColor(TDEditor_TD[3], -1);
- TextDrawSetShadow(TDEditor_TD[3], 0);
- TextDrawSetOutline(TDEditor_TD[3], 0);
- TextDrawBackgroundColor(TDEditor_TD[3], 25168);
- TextDrawFont(TDEditor_TD[3], 5);
- TextDrawSetProportional(TDEditor_TD[3], 0);
- TextDrawSetShadow(TDEditor_TD[3], 0);
- TextDrawSetSelectable(TDEditor_TD[3], true);
- TextDrawSetPreviewModel(TDEditor_TD[3], 412);
- TextDrawSetPreviewRot(TDEditor_TD[3], 0.000000, 0.000000, 0.000000, 1.000000);
- TextDrawSetPreviewVehCol(TDEditor_TD[3], 1, 1);
- return 1;
- }
- public OnPlayerClickTextDraw(playerid, Text:clickedid)
- {
- if(clickedid == TDEditor_TD[2])
- {
- ShowPlayerDialog(playerid, DIALOG_CONCE, DIALOG_STYLE_MSGBOX, "Concessionaria", "Voce deseja comprar o infernus por R$350", "Sim", "Nao");
- EsconderTexts(playerid);
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new playername[20];
- if(dialogid == DIALOG_CARRO)
- {
- if(!response) return 0;
- switch (listitem)
- {
- case 0:
- {
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Você precisa estar dentro de seu carro para poder estacioná-lo!");
- new Float:x,Float:y,Float:z;
- new Float:a;
- new carid;
- if(GetPlayerCarID(playerid, GetPlayerVehicleID(playerid))) { carid = GetPlayerVehicleID(playerid); }
- else return SendClientMessage(playerid, 0xFFFFFFFF, "Você precisa estar dentro de seu carro para poder estacioná-lo!");
- GetPlayerName(playerid, playername, sizeof(playername));
- GetVehiclePos(carid, x, y, z);
- //GetPlayerFacingAngle(playerid, a);
- GetVehicleZAngle(carid, a);
- if(IsPlayerInVehicle(playerid,carid) && InfoCarros[carid][cOwned] == 1)
- {
- InfoCarros[carid][cLocationx] = x;
- InfoCarros[carid][cLocationy] = y;
- InfoCarros[carid][cLocationz] = z;
- InfoCarros[carid][cAngle] = a;
- SalvarCarros();
- DestroyVehicle(carid);
- CreateVehicle(InfoCarros[carid][cModel],InfoCarros[carid][cLocationx],InfoCarros[carid][cLocationy],InfoCarros[carid][cLocationz]+1.0,InfoCarros[carid][cAngle],InfoCarros[carid][cColorOne],InfoCarros[carid][cColorTwo],60000);
- //SetVehicleHealth(carid, InfoCarros[carid][cDamage]);
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
- }
- case 1:
- {
- new string[64];
- new keycar = GetPlayerVehicleID(playerid);
- new engine, lights, alarm, doors, bonnet, boot, objective;
- GetVehicleParamsEx(keycar,engine, lights, alarm, doors, bonnet, boot, objective);
- if(GetPlayerCarID(playerid, GetPlayerVehicleID(playerid)))
- {
- if(doors)
- {
- SetVehicleParamsEx(keycar,engine, lights, alarm, false, bonnet, boot, objective);
- format(string, sizeof(string), "~w~Veiculo~n~~g~Destrancado");
- GameTextForPlayer(playerid, string, 4000, 3);
- InfoCarros[keycar][cLock] = 0;
- SalvarCarros();
- return 1;
- }
- else
- {
- SetVehicleParamsEx(keycar,engine, lights, alarm, true, bonnet, boot, objective);
- format(string, sizeof(string), "~w~Veiculo~n~~r~Trancado");
- GameTextForPlayer(playerid, string, 4000, 3);
- InfoCarros[keycar][cLock] = 1;
- SalvarCarros();
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xFFFFFFFF, " Você não tem um veiculo no slot 1");
- return 1;
- }
- }
- case 2:
- {
- if(IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, DIALOG_CCARRO, DIALOG_STYLE_INPUT, "Cor do Carro", "Digite abaixo a cor de seu carro.\nDigite a cor 1 e a cor 2 separadas por vírgula\nExemplo: 250,35\nATENÇÃO: A COR DEVE SER ENTRE 1 E 255!!!", "Aceitar", "Voltar");
- else return SendClientMessage(playerid, 0xFFFFFFFF, "Você precisa estar dentro de seu carro para poder pintá-lo!");
- }
- }
- return 1;
- }
- if(dialogid == DIALOG_CCARRO)
- {
- if(response)
- {
- new carid;
- if(GetPlayerCarID(playerid, GetPlayerVehicleID(playerid))) { carid = GetPlayerVehicleID(playerid); }
- else return SendClientMessage(playerid, 0xFFFFFFFF, "Você precisa ter um carro para poder pintá-lo!");
- new arrCoords[2][64];
- new color1;
- new color2;
- split(inputtext, arrCoords, ',');
- color1 = strval(arrCoords[0]);
- color2 = strval(arrCoords[1]);
- if(IsPlayerInVehicle(playerid, carid))
- {
- InfoCarros[carid][cColorOne] = color1;
- InfoCarros[carid][cColorTwo] = color2;
- ChangeVehicleColor(carid, color1, color2);
- SalvarCarros();
- return 1;
- }
- }
- }
- if(dialogid == DIALOG_CONCE)
- {
- if(response)
- {
- CreateDealershipCar(playerid, "Turismo", Car_Turismo, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
- }
- else
- {
- SendClientMessage(playerid, -1, "Voce cancelou a compra do veiculo!");
- }
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SalvarCarros();
- DOF2_Exit();
- return 1;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- stock EsconderTexts(playerid)
- {
- TextDrawHideForPlayer(playerid, TDEditor_TD[0]);
- TextDrawHideForPlayer(playerid, TDEditor_TD[1]);
- TextDrawHideForPlayer(playerid, TDEditor_TD[2]);
- TextDrawHideForPlayer(playerid, TDEditor_TD[3]);
- CancelSelectTextDraw(playerid); // Função para voltar o mouse ao normal
- return 1;
- }
- stock SalvarCarros()
- {
- new file[120];
- {
- for(new idx = 1; idx < MAX_CARROS; idx ++)
- {
- format(file, 120, Pasta, CARROS, idx);
- while (idx < sizeof(InfoCarros))
- if(DOF2_FileExists(file))
- DOF2_SetInt(file, "Modelo", InfoCarros[idx][cModel]);
- DOF2_SetFloat(file, "LocalX", InfoCarros[idx][cLocationx]);
- DOF2_SetFloat(file, "LocalY", InfoCarros[idx][cLocationy]);
- DOF2_SetFloat(file, "LocalZ", InfoCarros[idx][cLocationz]);
- DOF2_SetFloat(file, "Angulo", InfoCarros[idx][cAngle]);
- DOF2_SetInt(file, "Cor1", InfoCarros[idx][cColorOne]);
- DOF2_SetInt(file, "Cor2", InfoCarros[idx][cColorTwo]);
- DOF2_SetInt(file, "Dono", InfoCarros[idx][cOwner]);
- DOF2_SetInt(file, "Valor", InfoCarros[idx][cValue]);
- DOF2_SetInt(file, "TemDono", InfoCarros[idx][cOwned]);
- DOF2_SetInt(file, "Fechado", InfoCarros[idx][cLock]);
- DOF2_SetInt(file, "Cmod1", InfoCarros[idx][cmod1]);
- DOF2_SetInt(file, "Cmod2", InfoCarros[idx][cmod2]);
- DOF2_SetInt(file, "Cmod3", InfoCarros[idx][cmod3]);
- DOF2_SetInt(file, "Cmod4", InfoCarros[idx][cmod4]);
- DOF2_SetInt(file, "Cmod5", InfoCarros[idx][cmod5]);
- DOF2_SetInt(file, "Cmod6", InfoCarros[idx][cmod6]);
- DOF2_SetInt(file, "Cmod7", InfoCarros[idx][cmod7]);
- DOF2_SetInt(file, "Cmod8", InfoCarros[idx][cmod8]);
- DOF2_SetInt(file, "Cmod9", InfoCarros[idx][cmod9]);
- DOF2_SetInt(file, "Cmod10", InfoCarros[idx][cmod10]);
- DOF2_SetInt(file, "Cmod11", InfoCarros[idx][cmod11]);
- DOF2_SetInt(file, "Cmod12", InfoCarros[idx][cmod12]);
- DOF2_SetInt(file, "Cmod13", InfoCarros[idx][cmod13]);
- DOF2_SetInt(file, "Cmod14", InfoCarros[idx][cmod14]);
- DOF2_SetInt(file, "Cmod15", InfoCarros[idx][cmod15]);
- DOF2_SaveFile();
- }
- }
- }
- stock CarregarCarros()
- {
- new arrCoords[26][64];
- new strFromFile2[256];
- new File: file = fopen("Concessionaria.cfg", io_read);
- if (file)
- {
- new idx = CARROS;
- while (idx < sizeof(InfoCarros))
- {
- fread(file, strFromFile2);
- split(strFromFile2, arrCoords, '|');
- InfoCarros[idx][cModel] = strval(arrCoords[0]);
- InfoCarros[idx][cLocationx] = floatstr(arrCoords[1]);
- InfoCarros[idx][cLocationy] = floatstr(arrCoords[2]);
- InfoCarros[idx][cLocationz] = floatstr(arrCoords[3]);
- InfoCarros[idx][cAngle] = floatstr(arrCoords[4]);
- InfoCarros[idx][cColorOne] = strval(arrCoords[5]);
- InfoCarros[idx][cColorTwo] = strval(arrCoords[6]);
- strmid(InfoCarros[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
- InfoCarros[idx][cValue] = strval(arrCoords[8]);
- InfoCarros[idx][cOwned] = strval(arrCoords[9]);
- InfoCarros[idx][cLock] = strval(arrCoords[10]);
- InfoCarros[idx][cmod1] = strval(arrCoords[11]);
- InfoCarros[idx][cmod2] = strval(arrCoords[12]);
- InfoCarros[idx][cmod3] = strval(arrCoords[13]);
- InfoCarros[idx][cmod4] = strval(arrCoords[14]);
- InfoCarros[idx][cmod5] = strval(arrCoords[15]);
- InfoCarros[idx][cmod6] = strval(arrCoords[16]);
- InfoCarros[idx][cmod7] = strval(arrCoords[17]);
- InfoCarros[idx][cmod8] = strval(arrCoords[18]);
- InfoCarros[idx][cmod9] = strval(arrCoords[19]);
- InfoCarros[idx][cmod10] = strval(arrCoords[20]);
- InfoCarros[idx][cmod11] = strval(arrCoords[21]);
- InfoCarros[idx][cmod12] = strval(arrCoords[22]);
- InfoCarros[idx][cmod13] = strval(arrCoords[23]);
- InfoCarros[idx][cmod14] = strval(arrCoords[24]);
- InfoCarros[idx][cmod15] = strval(arrCoords[25]);
- idx++;
- }
- }
- }
- stock CreateDealershipCar(playerid, name[MAX_PLAYER_NAME], price, Float:posX, Float:posY, Float:posZ, Float:angle)
- {
- new model = ReturnVehicleID(name);
- new sendername[20];
- if(GetPlayerMoney(playerid) < price) return SendClientMessage(playerid, 0xFFFFFFFF, "Você não tem dinheiro suficiente!");
- {
- new colorOne = 0 + random(255);
- new colorTwo = 0 + random(255);
- new idcar = CreateVehicle(model,posX,posY,posZ,angle,colorOne,colorTwo,60000);
- InfoCarros[idcar][cModel] = model;
- SendClientMessage(playerid, 0xFFFFFFFF, "Parabéns pelo seu carro!");
- InfoCarros[idcar][cLocationx] = posX;
- InfoCarros[idcar][cLocationy] = posY;
- InfoCarros[idcar][cLocationz] = posZ;
- InfoCarros[idcar][cAngle] = angle;
- InfoCarros[idcar][cColorOne] = colorOne;
- InfoCarros[idcar][cColorTwo] = colorTwo;
- InfoCarros[idcar][cValue] = price;
- InfoCarros[idcar][cOwned] = 1;
- GivePlayerMoney(playerid,-price);
- GetPlayerName(playerid, sendername, sizeof(sendername));
- strmid(InfoCarros[idcar][cOwner], sendername, 0, strlen(sendername), 999);
- SalvarCarros();
- }
- return 1;
- }
- stock GetPlayerCarID(playerid, vehicle)
- {
- new playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- if(!strcmp(InfoCarros[vehicle][cOwner], playername, true)) return 1;
- else return 0;
- }
- stock GetPlayerAllCars(playerid)
- {
- for(new i = 0; i < sizeof(InfoCarros); i++)
- {
- new playername[24];
- new string[128];
- GetPlayerName(playerid, playername, 24);
- if(!strcmp(InfoCarros[i][cOwner], playername, true))
- {
- format(string, 128, "Você possui o carro id: %i **", i);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement