07.08.2010, 01:00
eu baixei um FS de concessionaria aqui no forum,coloquei uns carrinhos para comprar,dae entro no carro e compro ele,mais posso comprar quantos carros quiser,eu queria colocar o cmd /veiculo vender , e tbm que so pudesse ter 1 carro,e pra ter carro ser vip
Код:
// Filterscript de comprar veнculos by Flбvio Toribio #include <a_samp> #define MAX_RENT_VEHICLES 50 //coloque aqui o mбximo de veнclos que pode colocar pra alugar forward VerificarVeiculos(); new RentVehicle[MAX_RENT_VEHICLES]; new VehiclePrice[MAX_VEHICLES]; new VehicleOwner[MAX_VEHICLES][MAX_PLAYER_NAME]; new VehicleName[MAX_VEHICLES][MAX_PLAYER_NAME]; new rentid; stock AddRentableVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, price, name[]) { RentVehicle[rentid] = CreateVehicle(modelid, x, y, z, angle, color1, color2, 6000); if(!RentVehicle[rentid] || !price || !name[0]) return -1; VehiclePrice[RentVehicle[rentid]] = price; strmid(VehicleName[RentVehicle[rentid]], name, 0, strlen(name)); return rentid++; } stock bool:IsVehicleRentable(vehicleid) { for(new i; i < MAX_RENT_VEHICLES; i++) if(RentVehicle[i] == vehicleid) return true; return false; } stock SetVehicleOwner(vehicleid, owner[]) { if(!IsVehicleRentable(vehicleid)) return 0; strmid(VehicleOwner[vehicleid], owner, 0, strlen(owner)); return 1; } stock GetVehicleOwner(vehicleid, destine[]) { if(!IsVehicleRentable(vehicleid) || !VehicleOwner[vehicleid][0]) { format(destine, 8, "ninguem"); return 0; } format(destine, strlen(VehicleOwner[vehicleid]), "%s", VehicleOwner[vehicleid]); return 1; } stock bool:IsVehicleOwned(vehicleid) { return !VehicleOwner[vehicleid][0] || !IsVehicleRentable(vehicleid) ? false : true; } stock bool:IsPlayerVehicleOwner(playerid, vehicleid) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof pname); return !strcmp(VehicleOwner[vehicleid], pname, false); } public OnFilterScriptInit() { printf("Filterscript de comprar veiculos by Flбvio Toribio"); AddRentableVehicle(402,2148.95312500,-1133.84375000,25.50844955,268.68713379,-1,-1, 50000, "Este Buffalo"); //Buffalo AddRentableVehicle(411,2148.67773438,-1138.59631348,25.29216003,268.68713379,-1,-1, 50000, "Este Infernus"); //Infernus AddRentableVehicle(415,2148.55419922,-1143.23767090,24.81860352,270.67492676,-1,-1, 50000, "Este Cheetah"); //Cheetah AddRentableVehicle(451,2148.90820312,-1148.01342773,24.19911385,270.67492676,-1,-1, 50000, "Este Turismo"); //Turismo AddRentableVehicle(506,2148.73071289,-1152.96936035,23.69398499,268.68994141,1,1, 50000, "Este Super GT"); //Super GT AddRentableVehicle(541,2148.40893555,-1157.27673340,23.54281807,270.67492676,-1,-1, 50000, "Este Bullet"); //Bullet AddRentableVehicle(434,2148.22070312,-1161.82226562,23.96955872,268.68994141,-1,-1, 50000, "Este Hotknife"); //Hotknife AddRentableVehicle(531,2148.11938477,-1166.36987305,23.82676506,268.68994141,-1,-1, 50000, "Este Trator"); //Tractor AddRentableVehicle(571,2147.92138672,-1170.76074219,23.15259361,270.67492676,-1,-1, 50000, "Esta NRG-500"); //NRG-500 AddRentableVehicle(522,2147.97070312,-1175.80541992,23.48069000,266.70495605,-1,-1, 50000, "Esta NRG-500"); //NRG-500 AddRentableVehicle(522,2147.87622070,-1180.58093262,23.48069000,266.70410156,-1,-1, 50000, "Esta NRG-500"); //NRG-500 SetTimer("VerificarVeiculos", 5000, 1); return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(playerid); if(IsVehicleRentable(vehicleid)) { new string[128], owner[MAX_PLAYER_NAME]; TogglePlayerControllable(playerid, false); GetVehicleOwner(vehicleid, owner); if(!IsVehicleOwned(vehicleid)) { format(string, sizeof string, "Compre %s por apenas %d reais! Digite: /veiculo comprar", VehicleName[vehicleid], VehiclePrice[vehicleid]); } else if(IsPlayerVehicleOwner(playerid, vehicleid)) { TogglePlayerControllable(playerid, true); format(string, sizeof string, "Bem vindo a seu veнculo,%s.", owner); } else { format(string, sizeof string, "Ops,Este %s pertence а %s .",VehicleName[vehicleid], owner); } SendClientMessage(playerid, 0xFFFFFFAA, string); } } return 1; } public VerificarVeiculos() { for(new i; i < MAX_VEHICLES; i++) { if(GetVehicleModel(i) < 400 && GetVehicleModel(i) > 612 && IsVehicleRentable(i)) { for(new j = i; j < MAX_RENT_VEHICLES; j++) { VehiclePrice[j] = VehiclePrice[j+1]; VehicleName[j] = VehicleName[j+1]; VehicleOwner[j] = VehicleOwner[j+1]; } rentid--; } } } public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/veiculo comprar", true)) { new vehicleid = GetPlayerVehicleID(playerid); if(!vehicleid) { SendClientMessage(playerid, 0xFF0000AA, "Vб a uma concessionбra e entre em um veнculo!"); return 1; } new string[128]; if(!IsVehicleOwned(vehicleid)) { if(GetPlayerMoney(playerid) >= VehiclePrice[vehicleid]) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof pname); SetVehicleOwner(vehicleid, pname); GivePlayerMoney(playerid, -VehiclePrice[vehicleid]); TogglePlayerControllable(playerid, true); format(string, sizeof string, "Agora Este %s й de sua autoria!", VehicleName[vehicleid]); SendClientMessage(playerid, 0xFFFFFFAA, string); } else { format(string, sizeof string, "Vocк nгo tem %d reais!", VehiclePrice[vehicleid]); SendClientMessage(playerid, 0xFF0000AA, string); return 1; } } else if(IsPlayerVehicleOwner(playerid, vehicleid)) { format(string, sizeof string, "Vocк jб й dono d%s!", VehicleName[vehicleid]); SendClientMessage(playerid, 0xFF0000AA, string); } else { new owner[MAX_PLAYER_NAME]; GetVehicleOwner(vehicleid, owner); format(string, sizeof string, "Ops, %s pertence а %s.", VehicleName[vehicleid], owner); SendClientMessage(playerid, 0xFF0000AA, string); } return 1; } return 0; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys == 16 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if(IsVehicleRentable(GetPlayerVehicleID(playerid))) { TogglePlayerControllable(playerid, true); RemovePlayerFromVehicle(playerid); } } return 1; }