Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <float>
- #define COR_CINZA 0xBFC0C2FF
- #define tabsize 0
- new AlugarCarro[MAX_PLAYERS];
- forward CarroDestrancado(carid);
- forward Respawndocarro(playerid);
- forward Carrosparaalugar(carid);
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Sistema de aluguel de carros by DJLoko ");
- print("------------<[Carregado]>-------------\n");
- AddStaticVehicleEx(562,2160.0573730469,1799.5623779297,10.8203125,0,-1,-1,30000);// Veiculoalguel 1
- AddStaticVehicleEx(562,2168.0100097656,1799.7695312500,10.8203125,0,-1,-1,30000);// Veiculoalguel 2
- AddStaticVehicleEx(562,2175.5317382813,1799.8051757813,10.8203125,0,-1,-1,30000);// Veiculoalguel 3
- AddStaticVehicleEx(562,2183.4045410156,1799.8276367188,10.8203125,0,-1,-1,30000);// Veiculoalguel 4
- AddStaticVehicleEx(562,2191.1486816406,1799.7927246094,10.8203125,0,-1,-1,30000);// Veiculoalguel 5
- AddStaticVehicleEx(562,2198.4870605469,1799.7885742188,10.8203125,0,-1,-1,30000);// Veiculoalguel 6
- AddStaticVehicleEx(562,2198.6010742188,1810.0036621094,10.8203125,0,-1,-1,30000);// Veiculoalguel 7
- AddStaticVehicleEx(562,2191.0888671875,1810.1614990234,10.8203125,0,-1,-1,30000);// Veiculoalguel 8
- AddStaticVehicleEx(562,2183.3344726563,1810.1407470703,10.8203125,0,-1,-1,30000);// Veiculoalguel 9
- AddStaticVehicleEx(562,2175.3098144531,1810.1428222656,10.8203125,0,-1,-1,30000);// Veiculoalguel 10
- AddStaticVehicleEx(562,2167.7849121094,1810.1483154297,10.8203125,0,-1,-1,30000);// Veiculoalguel 11
- AddStaticVehicleEx(562,2160.4975585938,1810.2126464844,10.8203125,0,-1,-1,30000);// Veiculoalguel 12
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new CarroTrancado[265];
- if(strcmp("/alugarveiculo", cmdtext, true, 10) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- new carid = GetPlayerVehicleID(playerid);
- if(Carrosparaalugar(carid))
- {
- if (GetPlayerMoney(playerid) < 1000)
- {
- SendClientMessage(playerid, COR_CINZA, "Você não tem dinheiro soficiente!");
- return 1;
- }
- AlugarCarro[playerid] = GetPlayerVehicleID(playerid);
- GivePlayerMoney(playerid,-1000);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- TogglePlayerControllable(playerid, 1);
- GameTextForPlayer(playerid, "~w~Nao se esqueca ~b~/deslugarveiculo~n~ ~w~para desalugar seu veiculo", 5000, 3);
- }
- }
- return 1;
- }
- if(strcmp("/sair", cmdtext, true, 10) == 0)
- {
- TogglePlayerControllable(playerid, 1);
- RemovePlayerFromVehicle(playerid);
- return 1;
- }
- if(strcmp("/desalugarveiculo", cmdtext, true, 10) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(AlugarCarro[playerid] != 299)
- {
- SetTimer("Respawndocarro", 2000, 0);
- RemovePlayerFromVehicle(playerid);
- TogglePlayerControllable(playerid, 1);
- CarroTrancado[AlugarCarro[playerid]] = 0;
- CarroDestrancado(AlugarCarro[playerid]);
- AlugarCarro[playerid] = 299;
- GameTextForPlayer(playerid, "~w~Voce agora nao tem nenhum veiculo alugado", 5000, 3);
- }
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- new ultimocarro[301];
- new novocarro = GetPlayerVehicleID(playerid);
- new carid = GetPlayerVehicleID(playerid);
- if(Carrosparaalugar(carid))
- {
- if (AlugarCarro[playerid] != novocarro)
- {
- TogglePlayerControllable(playerid, 0);
- GameTextForPlayer(playerid,"~w~Voce pode alugar essa veiculo~n~Cost:~g~$1000~n~~w~Para alugar digite ~g~/alugarveiculo~w~~n~para sair use ~r~/sair", 5000, 3);
- }
- ultimocarro[playerid] = novocarro;
- }
- return 1;
- }
- public CarroDestrancado(carid)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- SetVehicleParamsForPlayer(carid,i,0,0);
- }
- }
- }
- public Respawndocarro(playerid)
- {
- new i = playerid;
- SetVehicleToRespawn(AlugarCarro[i]);
- TogglePlayerControllable(i, 1);
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- new i = playerid;
- TogglePlayerControllable(i, 1);
- return 1;
- }
- public Carrosparaalugar(carid)
- {
- if(carid == 1 || carid == 12)
- {
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment