Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Ivex's Multy Vehicle Ownership
- iVersion 1.1
- Copyright(c)
- */
- #include <a_samp>
- #include <Dini>
- #include <zcmd>
- #include <sscanf2>
- #pragma tabsize 0
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x9EC73DAA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_LIGHTRED 0xFF6347AA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_LIGHTGREEN 0x9ACD32AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_MEDIUMAQUA 0x83BFBFAA
- #define SCM SendClientMessage
- #define SaveFile "V_File.cfg"
- #define MAX_MYVEHS 50
- #define MAX_BUYED_VEHS 2
- //============================== VEHICLES ======================================
- enum einfo
- {
- MyVehSlot,
- MyVehModel,
- Float:MyVehPos[4],
- MyVehCol[2],
- MyVehLock,
- MyVehOwner[MAX_PLAYER_NAME],
- MyVehAlarm,
- MyVehFsale,
- MyVehID,
- MyVehCar,
- MyVehBike,
- MyVehBoat,
- MyVehPlane
- };
- new MyVehicle[MAX_MYVEHS][einfo];
- new Text:CarShopTextDraw[MAX_PLAYERS];
- new IsShoping[MAX_PLAYERS];
- new ShopVeh1[4];//0 ID,1 Model,2 col1,3 ol2 car
- new ShopVeh2[4];//0 ID,1 Model,2 col1,3 ol2 bike
- new VehButtonSet[MAX_PLAYERS][4];
- new clx[MAX_PLAYERS] = 0;
- new EnCV[MAX_PLAYERS];
- new vCars[29][2] =
- {
- {411,650000},
- {415,520000},
- {424,380000},
- {426,180000},
- {429,400000},
- {434,540000},
- {437,500000},
- {444,850000},
- {451,750000},
- {477,385000},
- {480,240000},
- {502,600000},
- {503,600000},
- {506,470000},
- {541,489000},
- {550,210000},
- {555,241000},
- {559,390000},
- {558,180000},
- {560,500000},
- {561,150000},
- {562,432156},
- {565,170000},
- {568,200000},
- {579,190500},
- {587,456456},
- {589,100000},
- {602,320000},
- {603,270000}
- };
- new vBikes[10][2]={
- {581,21000},//BF-400
- {462,1000},//Faggio
- {521,16000},//FCR-900
- {463,25000},//Freeway
- {522,45000},//NRG-500
- {461,20000},//PCJ-600
- {448,1000},//Pizzaboy
- {471,5000},//Quad
- {468,30000},//Sanchez
- {586,30000}//Wayfarer
- };
- new VehNames[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","ZR350","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","Hotring Racer","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","Monster","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","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer","Trailer","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","Luggage Trailer","Stair Trailer","Boxville","Farm Plow","Utility Trailer"
- };
- //==============================================================================
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnGameModeInit()
- {
- ShopVeh1[0] = CreateVehicle(vCars[ShopVeh1[1]][0], 1292.0682,-1870.6963,13.3741,358.0040, ShopVeh1[2], ShopVeh1[3], 30000);
- ShopVeh2[0] = CreateVehicle(vBikes[ShopVeh2[1]][0],1298.7928,-1870.8855,13.5469,349.0682, ShopVeh2[2], ShopVeh2[3], 30000);
- CVozilaTextDraw(); // textdraw
- LoadMyVehSystem(); // loadanje lvl 1
- print("\n----------------------------------");
- print(":::::::::Loading Jake_Ryan's::::::::");
- print("----------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- DVozilaTextDraw();// unistava textdraw
- for(new i; i< MAX_MYVEHS;i++)
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- DestroyVehicle(MyVehicle[i][MyVehID]);
- }
- }
- print("\n----------------------------------");
- print("::::::::Unloading Jake_Ryan's:::::::");
- print("----------------------------------\n");
- return 1;
- }
- main()
- {
- }
- public OnPlayerConnect(playerid)
- {
- EnCV[playerid] = -1;
- return 1;
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- EnCV[playerid] = -1;
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- new Float:PEnterPos[3][MAX_PLAYERS];
- new string[64];
- GetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);
- if(ConvertVehIDtoDYID(vehicleid) != -1)
- {
- new i;
- i = ConvertVehIDtoDYID(vehicleid);
- if(MyVehicle[i][MyVehSlot] == 1 && (MyVehicle[i][MyVehCar] != -1 || MyVehicle[i][MyVehBike] != -1 || MyVehicle[i][MyVehBoat] != -1 || MyVehicle[i][MyVehPlane] != -1) && MyVehicle[i][MyVehFsale] < 1)
- {
- format(string, sizeof(string), "~g~~h~GAZDA:~w~ %s",MyVehicle[i][MyVehOwner]);
- GameTextForPlayer(playerid,string,2000,3);
- if(MyVehicle[i][MyVehLock] == 1 && !IsPlayerAdmin(playerid))
- {SetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);}
- }
- if(MyVehicle[i][MyVehFsale] > 0)
- {
- format(string, sizeof(string), "~y~~h~~h~%s~n~~y~~h~SE PRODAVA:~y~ %d$",VehNames[GetVehicleModel(vehicleid) - 400],MyVehicle[i][MyVehFsale]);
- GameTextForPlayer(playerid,string,2000,3);
- EnCV[playerid] = i;
- if(!IsPlayerAdmin(playerid)){SetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);}
- return 1;
- }
- }
- if(vehicleid == ShopVeh1[0])
- {SetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);
- new cijena;
- for(new x; x<29;x++){if(vCars[x][0] == GetVehicleModel(ShopVeh1[0]))cijena = vCars[x][1];}
- format(string, sizeof(string), "~y~~h~~h~%s~n~~y~~h~SE PRODAVA:~y~ %d$",VehNames[GetVehicleModel(ShopVeh1[0]) - 400],cijena);
- GameTextForPlayer(playerid,string,2000,5);}
- if(vehicleid == ShopVeh2[0])
- {SetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);
- new cijena;
- for(new x; x<10;x++){if(vBikes[x][0] == GetVehicleModel(ShopVeh2[0]))cijena = vBikes[x][1];}
- format(string, sizeof(string), "~y~~h~~h~%s~n~~y~~h~SE PRODAVA:~y~ %d$",VehNames[GetVehicleModel(ShopVeh2[0]) - 400],cijena);
- GameTextForPlayer(playerid,string,2000,5);}
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- if(ConvertVehIDtoDYID(vehicleid) != -1)
- {
- ChangeVehicleColor(vehicleid, MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehCol][0], MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehCol][1]);
- SetVehiclePos(MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehID], MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehPos][0],MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehPos][1],MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehPos][2]);
- SetVehicleZAngle(MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehID], MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehPos][3]);
- }
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- if(ConvertVehIDtoDYID(vehicleid) != -1)
- {
- MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehCol][0] = color1;
- MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehCol][1] = color2;
- UpdateMyVehSystem(ConvertVehIDtoDYID(vehicleid));
- }
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- ResetVehButton(playerid);
- return 1;
- }
- stock Ime(playerid)
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid, ime, MAX_PLAYER_NAME);
- return ime;
- }
- //==========VOZILA := Vozila OWNERSHIP==========================================
- stock CVozilaTextDraw()
- {
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
- {CarShopTextDraw[playerid] = TextDrawCreate(295.500000,310.000000,"~y~Ime~n~~n~~h~~h~~b~Cena:------~n~~n~~h~~h~~y~< ~g~Ponatamu ~h~~h~~y~>");
- TextDrawAlignment(CarShopTextDraw[playerid],0);
- TextDrawBackgroundColor(CarShopTextDraw[playerid],0x000000ff);
- TextDrawFont(CarShopTextDraw[playerid],1);
- TextDrawLetterSize(CarShopTextDraw[playerid],0.499999,1.000000);
- TextDrawColor(CarShopTextDraw[playerid],0xF5DEB3AA);
- TextDrawSetOutline(CarShopTextDraw[playerid],1);
- TextDrawSetProportional(CarShopTextDraw[playerid],1);
- TextDrawSetShadow(CarShopTextDraw[playerid],1);}
- }
- stock HVozilaTextDraw(playerid)
- {TextDrawHideForPlayer(playerid,CarShopTextDraw[playerid]);}
- stock SVozilaTextDraw(playerid)
- {TextDrawShowForPlayer(playerid,CarShopTextDraw[playerid]);}
- stock DVozilaTextDraw()
- {for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
- {TextDrawDestroy(CarShopTextDraw[playerid]);}}
- stock ResetVehButton(playerid)
- {
- if(IsShoping[playerid] > 0)
- {
- new Keys, ud, lr;
- GetPlayerKeys(playerid, Keys, ud, lr);
- if(lr > 0) //desno
- {VehButtonSet[playerid][0] ++;
- VehShopChanger(playerid);}
- else if(lr < 0) //lijevo
- {VehButtonSet[playerid][1] ++;
- VehShopChanger(playerid);}
- else if(Keys & KEY_FIRE) //ctrl
- {VehButtonSet[playerid][2]++;
- VehShopChanger(playerid);}
- else if(Keys & KEY_SECONDARY_ATTACK) //enter
- {VehButtonSet[playerid][3]++;
- VehShopChanger(playerid);}
- else
- {VehButtonSet[playerid][0] = 0;
- VehButtonSet[playerid][1] = 0;
- VehButtonSet[playerid][2] = 0;
- VehButtonSet[playerid][3] = 0;
- VehShopChanger(playerid);}
- }
- return 0;
- }
- stock VehShopChanger(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- if(IsShoping[playerid] == 1)
- {
- new string[128],pa = 0;
- new ime[24];
- GetPlayerName(playerid, ime, sizeof(ime));
- if(VehButtonSet[playerid][0] == 1) // desno
- {ShopVeh1[1]++;
- if(ShopVeh1[1] > 28) {ShopVeh1[1] = 0;}pa = 1;}
- else if(VehButtonSet[playerid][1] == 1) //lijevo
- {ShopVeh1[1]--;
- if (ShopVeh1[1] < 0) {ShopVeh1[1] = 28;}pa = 1;}
- else if(VehButtonSet[playerid][3] == 1) //enter
- {
- if(AllMyCars(playerid) < MAX_BUYED_VEHS)
- {
- if(GetPlayerMoney(playerid) >= vCars[ShopVeh1[1]][1])
- {
- MakeXDCarFnc(playerid,0,vCars[ShopVeh1[1]][0],1314.9003,-1859.0258,13.3255,270.3405,ShopVeh1[2],ShopVeh1[3],ime);
- TogglePlayerControllable(playerid, 1);
- IsShoping[playerid] = 0;
- HVozilaTextDraw(playerid);
- SetCameraBehindPlayer(playerid);
- }else{format(string,sizeof(string),"Nemate dovolno pari!Ovoj avtomobil cini %d$",vCars[ShopVeh1[1]][1]);
- SCM(playerid,COLOR_LIGHTRED,string);}
- }else{SCM(playerid,COLOR_LIGHTRED,"Ceke gi imate site avtomobili!");}
- }
- else if (VehButtonSet[playerid][2] == 1)
- {TogglePlayerControllable(playerid, 1);
- SCM(playerid, COLOR_LIGHTBLUE, "Go prekinavte kupuvanjeto na avtomobili!");
- IsShoping[playerid] = 0;
- HVozilaTextDraw(playerid);
- SetCameraBehindPlayer(playerid);
- }
- if(pa > 0){
- DestroyVehicle(ShopVeh1[0]);
- ShopVeh1[0] = CreateVehicle(vCars[ShopVeh1[1]][0], 1292.0682,-1870.6963,13.3741,358.0040, ShopVeh1[2],ShopVeh1[3], 30000);
- format(string,sizeof(string),"~w~%s~n~~n~~h~~h~~b~Cena: %d~n~~n~~h~~h~~y~< ~g~ponatamu ~h~~h~~y~>",VehNames[GetVehicleModel(ShopVeh1[0]) - 400],vCars[ShopVeh1[1]][1]);
- TextDrawSetString(CarShopTextDraw[playerid],string);pa = 0;}
- }
- else if(IsShoping[playerid] == 2)
- {
- new string[128],pa = 0;
- new ime[24];
- GetPlayerName(playerid, ime, sizeof(ime));
- if(VehButtonSet[playerid][0] == 1) // desno
- {ShopVeh2[1]++;
- if(ShopVeh2[1] > 9) {ShopVeh2[1] = 0;}pa = 1;}
- else if(VehButtonSet[playerid][1] == 1) //lijevo
- {ShopVeh2[1]--;
- if (ShopVeh2[1] < 0) {ShopVeh2[1] = 28;}pa = 1;}
- else if(VehButtonSet[playerid][3] == 1) //enter
- {
- if(AllMyBikes(playerid) < MAX_BUYED_VEHS)
- {
- if(GetPlayerMoney(playerid) >= vBikes[ShopVeh2[1]][1])
- {
- MakeXDCarFnc(playerid,1,vBikes[ShopVeh2[1]][0],1314.9003,-1859.0258,13.3255,270.3405,ShopVeh2[2],ShopVeh2[3],ime);
- TogglePlayerControllable(playerid, 1);
- IsShoping[playerid] = 0;
- HVozilaTextDraw(playerid);
- SetCameraBehindPlayer(playerid);
- }else{format(string,sizeof(string),"Nemate dovolno pari!Ovoj motor cini %d$",vBikes[ShopVeh1[1]][1]);
- SCM(playerid,COLOR_LIGHTRED,string);}
- }else{SCM(playerid,COLOR_LIGHTRED,"Vec imas sve motore");}
- }
- else if (VehButtonSet[playerid][2] == 1)
- {TogglePlayerControllable(playerid, 1);
- SCM(playerid, COLOR_LIGHTBLUE, "Go prekinavte kupuvanjeto na Motorot!");
- IsShoping[playerid] = 0;
- HVozilaTextDraw(playerid);
- SetCameraBehindPlayer(playerid);
- }
- if(pa > 0){
- DestroyVehicle(ShopVeh2[0]);
- ShopVeh2[0] = CreateVehicle(vBikes[ShopVeh2[1]][0], 1298.7928,-1870.8855,13.5469,349.0682, ShopVeh2[2],ShopVeh2[3], 30000);
- format(string,sizeof(string),"~w~%s~n~~n~~h~~h~~b~Cena: %d~n~~n~~h~~h~~y~< ~g~ponatamu ~h~~h~~y~>",VehNames[GetVehicleModel(ShopVeh2[0]) - 400],vBikes[ShopVeh2[1]][1]);
- TextDrawSetString(CarShopTextDraw[playerid],string);pa = 0;}
- }
- /*
- In here put for Boats and AirPlanes!!!!
- */
- }
- return 1;
- }
- //==========MY VEH FUNCTIONS := Vozila OWNERSHIP================================
- //Player KeySet
- stock ConvertVehIDtoDYID(VehID)
- {
- for(new dy; dy < sizeof(MyVehicle);dy++)
- {
- if(MyVehicle[dy][MyVehSlot] == 1)
- {
- if(VehID == MyVehicle[dy][MyVehID]) return dy;
- }
- }
- return -1;
- }
- stock PlayerOwnedVehID(playerid,vehicleid)
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- for(new i = 0; i < sizeof(MyVehicle); i++)
- {
- if(MyVehicle[i][MyVehSlot] == 1 && MyVehicle[i][MyVehID] == vehicleid)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime))return i;
- }
- }
- return -1;
- }
- stock AllMyBikes(playerid)//bike
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- if(IsPlayerConnected(playerid))
- {
- new i, x;
- while (i < sizeof(MyVehicle))
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- if(MyVehicle[i][MyVehBike] != -1)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime)) x++;
- }
- }
- i++;
- }
- return x;
- }
- return -1;
- }
- stock GetMyBikeMID(playerid,ID = 0)//bike
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- new x = 0;
- for (new i; i < sizeof(MyVehicle);i++)
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- if(MyVehicle[i][MyVehBike] != -1)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime))
- { x++;
- if(x >= ID )
- {return i;}
- // return i;
- }
- }
- }
- }
- return -1;
- }
- stock AllMyCars(playerid)//car
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- if(IsPlayerConnected(playerid))
- {
- new i, x;
- while (i < sizeof(MyVehicle))
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- if(MyVehicle[i][MyVehCar] != -1)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime)) x++;
- }
- }
- i++;
- }
- return x;
- }
- return -1;
- }
- stock GetMyCarMID(playerid,ID = 0)//car
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- new x = 0;
- for (new i; i < sizeof(MyVehicle);i++)
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- if(MyVehicle[i][MyVehCar] != -1)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime))
- { x++;
- if(x >= ID )
- {return i;}
- // return i;
- }
- }
- }
- }
- return -1;
- }
- stock AllMyBoats(playerid)//boat
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- if(IsPlayerConnected(playerid))
- {
- new i, x;
- while (i < sizeof(MyVehicle))
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- if(MyVehicle[i][MyVehBoat] != -1)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime)) x++;
- }
- }
- i++;
- }
- return x;
- }
- return -1;
- }
- stock GetMyBoatMID(playerid,ID = 0)//boat
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- new x = 0;
- for (new i; i < sizeof(MyVehicle);i++)
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- if(MyVehicle[i][MyVehBoat] != -1)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime))
- { x++;
- if(x >= ID )
- {return i;}
- // return i;
- }
- }
- }
- }
- return -1;
- }
- stock AllMyAirs(playerid)//air
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- if(IsPlayerConnected(playerid))
- {
- new i, x;
- while (i < sizeof(MyVehicle))
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- if(MyVehicle[i][MyVehPlane] != -1)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime)) x++;
- }
- }
- i++;
- }
- return x;
- }
- return -1;
- }
- stock GetMyAirMID(playerid,ID = 0)//air
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- new x = 0;
- for (new i; i < sizeof(MyVehicle);i++)
- {
- if(MyVehicle[i][MyVehSlot] == 1)
- {
- if(MyVehicle[i][MyVehPlane] != -1)
- {
- if (strmatch(MyVehicle[i][MyVehOwner], ime))
- { x++;
- if(x >= ID )
- {return i;}
- // return i;
- }
- }
- }
- }
- return -1;
- }
- stock MyCarID(playerid)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- for(new i = 0; i < sizeof(MyVehicle); i++)
- {
- if(GetPlayerVehicleID(playerid) == MyVehicle[i][MyVehID])return i;
- }
- }
- return -1;
- }
- //fnc
- stock strmatch(const String1[], const String2[])
- {
- if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
- {return true;}
- else
- {return false;}
- }
- stock Float:GetDisBetweenPlayerAndCar(p1ayerid,carid)
- {
- new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
- if(!IsPlayerConnected(p1ayerid))
- {
- return -1.00;
- }
- GetPlayerPos(p1ayerid,x1,y1,z1);
- GetVehiclePos(carid,x2,y2,z2);
- return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- }
- stock GetClosestVehicleToPlayer(playerid)
- {
- new x,Float:dis,Float:dis2,car;
- car = 0;
- dis = 99999.99;
- for ( x = 0; x < MAX_VEHICLES; x++ )
- {
- dis2 = GetDisBetweenPlayerAndCar(playerid,x);
- if(dis2 < dis && dis2 < 10.0)
- {
- dis = dis2;
- car = x;
- }
- }
- return car;
- }
- stock VehPriceFromModel(Model)
- {
- for(new i = 0; i < 29; i++)
- {
- if(vCars[i][0] == Model) return i;
- }
- return 0;
- }
- //Veh Functions
- stock MakeXDCarFnc(playerid,X_THREAD,Model,Float:x,Float:y,Float:z,Float:a,col1,col2,name[])//THREAD-0=car=bike,2=boat,3=air
- {
- for(new i = 0; i < sizeof(MyVehicle); i++ )
- {
- if(MyVehicle[i][MyVehSlot] == 0)
- {
- MyVehicle[i][MyVehModel] = Model;
- MyVehicle[i][MyVehPos][0]= x;
- MyVehicle[i][MyVehPos][1] = y;
- MyVehicle[i][MyVehPos][2] = z;
- MyVehicle[i][MyVehPos][3] = a;
- MyVehicle[i][MyVehCol][0] = col1;
- MyVehicle[i][MyVehCol][1] = col2;
- MyVehicle[i][MyVehAlarm] = 0;
- MyVehicle[i][MyVehLock] = 0;
- MyVehicle[i][MyVehCar] = -1;
- MyVehicle[i][MyVehPlane] = -1;
- MyVehicle[i][MyVehBoat] = -1;
- MyVehicle[i][MyVehBike] = -1;
- strmid(MyVehicle[i][MyVehOwner], name, 0, strlen(name), 32);
- MyVehicle[i][MyVehID] = CreateVehicle(
- MyVehicle[i][MyVehModel],
- MyVehicle[i][MyVehPos][0],
- MyVehicle[i][MyVehPos][1],
- MyVehicle[i][MyVehPos][2],
- MyVehicle[i][MyVehPos][3],
- MyVehicle[i][MyVehCol][0],
- MyVehicle[i][MyVehCol][1],
- 30000);
- switch(X_THREAD)
- {
- case 0:// osobni auto
- {
- GivePlayerMoney(playerid, -vCars[ShopVeh1[1]][1]);
- MyVehicle[i][MyVehCar] = 1;
- MyVehicle[i][MyVehSlot] = 1;
- SCM(playerid, COLOR_GREEN, "Kupivte Avtomobil!!");
- }
- case 1://bike
- {
- GivePlayerMoney(playerid, -vBikes[ShopVeh2[1]][1]);
- MyVehicle[i][MyVehBike] = 1;
- MyVehicle[i][MyVehSlot] = 1;
- SCM(playerid, COLOR_GREEN, "Kupivte Motor!!");
- }
- case 2:// boat
- {
- //take money
- MyVehicle[i][MyVehBoat] = 1;
- MyVehicle[i][MyVehSlot] = 1;
- SCM(playerid, COLOR_GREEN, "Kupivte Brod!!");
- }
- case 3:// air
- {
- //take money
- MyVehicle[i][MyVehPlane] = 1;
- MyVehicle[i][MyVehSlot] = 1;
- SCM(playerid, COLOR_GREEN, "Kupivte Avion!!");
- }
- }
- UpdateMyVehSystem(i);
- printf("MYVC %d,THR %d",i,X_THREAD);
- return i;
- }
- }
- return 1;
- }
- stock ParkMyVehFnc(playerid)
- {
- // new str[64];
- new vozilo = GetPlayerVehicleID(playerid);
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- if(PlayerOwnedVehID(playerid,vozilo) != -1)
- {
- new Float:x,Float:y,Float:z;
- new Float:a;
- GetVehiclePos(vozilo, x, y, z);
- GetVehicleZAngle(vozilo, a);
- MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][0] = x;
- MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][1] = y;
- MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][2] = z;
- MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][3] = a;
- SetVehiclePos(vozilo, MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][0], MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][1],MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][2]);
- SetVehicleZAngle(vozilo, MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][3]);
- if(MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehCar] != -1)SCM(playerid, COLOR_GREEN, "Parkiravte Avtomobil!");
- if(MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehBike] != -1)SCM(playerid, COLOR_GREEN, "Parkiravte Motor!");
- if(MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehBoat] != -1)SCM(playerid, COLOR_GREEN, "Parkiravte Brod!");
- if(MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPlane] != -1)SCM(playerid, COLOR_GREEN, "Parkiravte Avion!");
- UpdateMyVehSystem(PlayerOwnedVehID(playerid,vozilo));
- return 1;
- }else{SCM(playerid, COLOR_LIGHTRED,"Neste vo vaseto vozilo!");}
- }else{SCM(playerid, COLOR_LIGHTRED,"Mora da bidete vo vaseto vozilo!");}
- return 0;
- }
- stock SellMyVehFnc(playerid)
- {
- //if(IsPlayerInRangeOfPoint(playerid,15.0,1314.5691,-1859.4077,13.7969)){
- new ime[MAX_PLAYER_NAME], TCID;
- new vozilo = GetPlayerVehicleID(playerid);
- GetPlayerName(playerid, ime, sizeof(ime));
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- if(PlayerOwnedVehID(playerid,vozilo) != -1)
- {
- TCID =PlayerOwnedVehID(playerid,vozilo);
- MyVehicle[TCID][MyVehSlot] = 0;
- MyVehicle[TCID][MyVehCar] = -1;
- MyVehicle[TCID][MyVehBoat] = -1;
- MyVehicle[TCID][MyVehBike] = -1;
- MyVehicle[TCID][MyVehPlane] = -1;
- strmid(MyVehicle[TCID][MyVehOwner], "Nitko", 0, strlen("Nitko"), 128);
- DestroyVehicle(vozilo);
- SCM(playerid, COLOR_GREEN, "Go Prodadovte vaseto vozilo");
- UpdateMyVehSystem(TCID);
- return 1;
- }else{SCM(playerid, COLOR_LIGHTRED,"Neste vo svoeto Vozilo!");}
- }else{SCM(playerid, COLOR_LIGHTRED,"Mora da bidete vo vaseto Vozilo!");}
- // }else{SCM(playerid, COLOR_LIGHTRED, "You are not at delivery place!");}
- return 1;
- }
- stock LocateMyVehFnc(playerid,THREAD_V)//0=my_car,1_my_bike,2_my_boat,3_my_air
- {
- switch(THREAD_V)
- {
- case 0:// mycar
- {
- new cm = AllMyCars(playerid);
- if(cm > 0)
- {
- clx[playerid] ++;
- if(clx[playerid] > cm) {clx[playerid] = 0;}
- new Float:VPos[3];
- GetVehiclePos(MyVehicle[GetMyCarMID(playerid,clx[playerid])][MyVehID], VPos[0],VPos[1],VPos[2]);
- SetPlayerCheckpoint(playerid,VPos[0],VPos[1],VPos[2],8.0);
- if(clx[playerid] == 0){DisablePlayerCheckpoint(playerid);}
- }else{SCM(playerid, COLOR_LIGHTRED, "Nemate Vozilo od ovaa vrsta!");}
- }
- case 1:// mybike
- {
- new cm = AllMyBikes(playerid);
- if(cm > 0)
- {
- clx[playerid] ++;
- if(clx[playerid] > cm) {clx[playerid] = 0;}
- new Float:VPos[3];
- GetVehiclePos(MyVehicle[GetMyBikeMID(playerid,clx[playerid])][MyVehID], VPos[0],VPos[1],VPos[2]);
- SetPlayerCheckpoint(playerid,VPos[0],VPos[1],VPos[2],8.0);
- if(clx[playerid] == 0){DisablePlayerCheckpoint(playerid);}
- }else{SCM(playerid, COLOR_LIGHTRED, "Nemate Vozilo od ovaa vrsta!");}
- }
- case 2:// myboat
- {
- new cm = AllMyBoats(playerid);
- if(cm > 0)
- {
- clx[playerid] ++;
- if(clx[playerid] > cm) {clx[playerid] = 0;}
- new Float:VPos[3];
- GetVehiclePos(MyVehicle[GetMyBoatMID(playerid,clx[playerid])][MyVehID], VPos[0],VPos[1],VPos[2]);
- SetPlayerCheckpoint(playerid,VPos[0],VPos[1],VPos[2],8.0);
- if(clx[playerid] == 0){DisablePlayerCheckpoint(playerid);}
- }else{SCM(playerid, COLOR_LIGHTRED, "Nemate Vozilo od ovaa vrsta!");}
- }
- case 3:// myair
- {
- new cm = AllMyAirs(playerid);
- if(cm > 0)
- {
- clx[playerid] ++;
- if(clx[playerid] > cm) {clx[playerid] = 0;}
- new Float:VPos[3];
- GetVehiclePos(MyVehicle[GetMyAirMID(playerid,clx[playerid])][MyVehID], VPos[0],VPos[1],VPos[2]);
- SetPlayerCheckpoint(playerid,VPos[0],VPos[1],VPos[2],8.0);
- if(clx[playerid] == 0){DisablePlayerCheckpoint(playerid);}
- }else{SCM(playerid, COLOR_LIGHTRED, "Nemate Vozilo od ovaa vrsta!");}
- }
- }
- return 0;
- }
- stock LockMyVehFnc(playerid)
- {
- new TCID,Float:CPs[3];
- TCID = GetClosestVehicleToPlayer(playerid);
- GetVehiclePos(TCID,CPs[0],CPs[1],CPs[2]);
- if(IsPlayerInRangeOfPoint(playerid,3.0,CPs[0],CPs[1],CPs[2]))
- {
- if(PlayerOwnedVehID(playerid,TCID) != -1)
- {
- if(MyVehicle[PlayerOwnedVehID(playerid,TCID)][MyVehLock] == 0)
- {
- MyVehicle[PlayerOwnedVehID(playerid,TCID)][MyVehLock] = 1;
- SCM(playerid, COLOR_LIGHTRED, "Voziloto e zakluceno!");
- }
- else if(MyVehicle[PlayerOwnedVehID(playerid,TCID)][MyVehLock] == 1)
- {
- MyVehicle[PlayerOwnedVehID(playerid,TCID)][MyVehLock] = 0;
- SCM(playerid, COLOR_LIGHTGREEN, "Voziloto e otkluceno!");
- }
- UpdateMyVehSystem(PlayerOwnedVehID(playerid,TCID));
- }else{SCM(playerid, COLOR_LIGHTRED, "Ovaa ne e tvoe vozilo!");}
- }else{SCM(playerid, COLOR_LIGHTRED, "Ne ste do vaseto vozilo!");}
- return 0;
- }
- //Admin cmds
- stock AparkMyVeh(playerid, MyCarID)
- {
- if(IsPlayerAdmin(playerid))
- {
- new vozilo = GetPlayerVehicleID(playerid);
- new Float:x,Float:y,Float:z;
- new Float:a;
- GetVehiclePos(vozilo, x, y, z);
- GetVehicleZAngle(vozilo, a);
- MyVehicle[MyCarID][MyVehPos][0] = x;
- MyVehicle[MyCarID][MyVehPos][1] = y;
- MyVehicle[MyCarID][MyVehPos][2] = z;
- MyVehicle[MyCarID][MyVehPos][3] = a;
- SetVehiclePos(vozilo, MyVehicle[MyCarID][MyVehPos][0], MyVehicle[MyCarID][MyVehPos][1],MyVehicle[MyCarID][MyVehPos][2]);
- SetVehicleZAngle(vozilo, MyVehicle[MyCarID][MyVehPos][3]);
- SCM(playerid, COLOR_GREEN, "[ADMIN]Vozilo parkirano!");
- UpdateMyVehSystem(MyCarID);
- }else{SCM(playerid, COLOR_LIGHTRED, "Neste ovlasteni da ja goristite ovaa komanda!");}
- return 1;
- }
- stock AsellMyVeh(playerid, MyCarID)
- {
- if(IsPlayerAdmin(playerid))
- {
- MyVehicle[MyCarID][MyVehSlot] = 0;
- MyVehicle[MyCarID][MyVehModel] = 0;
- MyVehicle[MyCarID][MyVehCar] = -1;
- MyVehicle[MyCarID][MyVehBike] = -1;
- MyVehicle[MyCarID][MyVehBoat] = -1;
- MyVehicle[MyCarID][MyVehPlane] = 1;
- strmid(MyVehicle[MyCarID][MyVehOwner], "Nitko", 0, strlen("Nitko"), 64);
- DestroyVehicle(MyVehicle[MyCarID][MyVehID]);
- SCM(playerid, COLOR_LIGHTGREEN, "[ADMIN] Vozilo prodadeno!");
- UpdateMyVehSystem(MyCarID);
- }else{SCM(playerid, COLOR_LIGHTRED, "Neste ovlasteni da ja goristite ovaa komanda!");}
- return 1;
- }
- //Saving/loading system
- stock LoadMyVehSystem()
- {
- new reload[256];
- new loader[64];
- if(!dini_Exists(SaveFile))
- {
- dini_Create(SaveFile);
- }
- for(new i = 0;i<sizeof(MyVehicle);i++)
- {
- format(loader,sizeof(loader),"MyCar_%d",i);
- strmid(reload,dini_Get(SaveFile,loader),0,256,256);
- new data2[32]; //STRING
- sscanf(reload,
- "p<,>dd\
- ffff\
- ddd\
- s[64]\
- d\
- dddd\
- d",
- MyVehicle[i][MyVehSlot],MyVehicle[i][MyVehModel],
- MyVehicle[i][MyVehPos][0],MyVehicle[i][MyVehPos][1],MyVehicle[i][MyVehPos][2],MyVehicle[i][MyVehPos][3],
- MyVehicle[i][MyVehCol][0],MyVehicle[i][MyVehCol][1],MyVehicle[i][MyVehLock],
- data2, // string
- MyVehicle[i][MyVehAlarm],
- MyVehicle[i][MyVehCar],MyVehicle[i][MyVehBike],MyVehicle[i][MyVehBoat],MyVehicle[i][MyVehPlane],
- MyVehicle[i][MyVehFsale]);
- strmid(MyVehicle[i][MyVehOwner], data2, 0, strlen(data2), 64);// kraj loadanja
- if(MyVehicle[i][MyVehSlot] == 1 && (MyVehicle[i][MyVehCar] != -1 || MyVehicle[i][MyVehBike] != -1 || MyVehicle[i][MyVehBoat] != -1 || MyVehicle[i][MyVehPlane] != -1))
- {
- MyVehicle[i][MyVehID] = CreateVehicle(MyVehicle[i][MyVehModel],MyVehicle[i][MyVehPos][0],MyVehicle[i][MyVehPos][1],MyVehicle[i][MyVehPos][2],MyVehicle[i][MyVehPos][3],MyVehicle[i][MyVehCol][0],MyVehicle[i][MyVehCol][1],30000);
- }
- }
- return 1;
- }
- stock UpdateMyVehSystem(id)
- {
- new GSi[256];
- new place[64];
- if(!dini_Exists(SaveFile))
- {
- dini_Create(SaveFile);
- }
- format(GSi,sizeof(GSi),
- "%d,%d,\
- %f,%f,%f,%f,\
- %d,%d,%d,\
- %s,\
- %d,\
- %d,%d,%d,%d,\
- %d",
- MyVehicle[id][MyVehSlot],MyVehicle[id][MyVehModel],
- MyVehicle[id][MyVehPos][0],MyVehicle[id][MyVehPos][1],MyVehicle[id][MyVehPos][2],MyVehicle[id][MyVehPos][3],
- MyVehicle[id][MyVehCol][0],MyVehicle[id][MyVehCol][1],MyVehicle[id][MyVehLock],
- MyVehicle[id][MyVehOwner], // string
- MyVehicle[id][MyVehAlarm],
- MyVehicle[id][MyVehCar],MyVehicle[id][MyVehBike],MyVehicle[id][MyVehBoat],MyVehicle[id][MyVehPlane],
- MyVehicle[id][MyVehFsale]);
- format(place,sizeof(place),"MyCar_%d",id);
- dini_Set(SaveFile,place,GSi);
- printf("ID %d SET",id);
- if(MyVehicle[id][MyVehSlot] == 0)
- {
- format(GSi,sizeof(GSi),
- "%d,%d,\
- %f,%f,%f,%f,\
- %d,%d,%d,\
- %s,\
- %d,\
- %d,%d,%d,%d,\
- %d",
- MyVehicle[id][MyVehSlot],MyVehicle[id][MyVehModel],
- MyVehicle[id][MyVehPos][0],MyVehicle[id][MyVehPos][1],MyVehicle[id][MyVehPos][2],MyVehicle[id][MyVehPos][3],
- MyVehicle[id][MyVehCol][0],MyVehicle[id][MyVehCol][1],MyVehicle[id][MyVehLock],
- MyVehicle[id][MyVehOwner], // string
- MyVehicle[id][MyVehAlarm],
- MyVehicle[id][MyVehCar],MyVehicle[id][MyVehBike],MyVehicle[id][MyVehBoat],MyVehicle[id][MyVehPlane],
- MyVehicle[id][MyVehFsale]);
- format(place,sizeof(place),"MyCar_%d",id);
- dini_Unset(SaveFile ,place);
- printf("ID %d UNSET",id);
- }
- return 1;
- }
- //======================= COMMANDS =============================================
- CMD:carshop(playerid,params[])
- {
- if(IsShoping[playerid] == 0)
- {
- if(GetPlayerState(playerid) != 2)
- {
- if(IsPlayerInRangeOfPoint(playerid,7.00,1292.0682,-1870.6963,13.3741))
- {
- new string[128];
- TogglePlayerControllable(playerid, 0);
- IsShoping[playerid] = 1;
- SCM(playerid, COLOR_LIGHTBLUE, " Koristite Strela Levo(<)Desno(>)za da odberete avtomobil!");
- SCM(playerid, COLOR_LIGHTBLUE, " Za da go kupite avtomobilot pritisnite (F)");
- SCM(playerid, COLOR_LIGHTBLUE, " Za prekinuvanje na kupuvanjeto pretisnete CTRL");
- SVozilaTextDraw(playerid);
- format(string,sizeof(string),"~w~%s~n~~n~~h~~h~~b~Cena: %d~n~~n~~h~~h~~y~< ~g~ponatamu ~h~~h~~y~>",VehNames[vCars[ShopVeh1[1]][0] -400],vCars[ShopVeh1[1]][1]);
- TextDrawSetString(CarShopTextDraw[playerid],string);
- }else{SCM(playerid, COLOR_LIGHTRED, " Neste vo salonot!");}
- }else{SCM(playerid, COLOR_LIGHTRED, " Nemozete da kupuvate od voziloto!");}
- }else{SCM(playerid, COLOR_LIGHTRED, " Veke go listate nalogot!");}
- return 1;
- }
- CMD:carshopcol(playerid,params[])
- {
- if(IsPlayerInRangeOfPoint(playerid,7.00,1292.0682,-1870.6963,13.3741))
- {
- new boja1,boja2;
- if (sscanf(params, "dd",boja1,boja2)) SCM(playerid, COLOR_WHITE, "Koristenje: /carshopcol [boja 1] [boja 2]");
- else if(boja1 < 0 || boja1 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!!");
- else if(boja2 < 0 || boja2 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!!");
- else
- {
- ShopVeh1[2] = boja1;
- ShopVeh1[3] = boja2;
- ChangeVehicleColor(ShopVeh1[0],boja1,boja2);
- SCM(playerid, COLOR_LIGHTBLUE, "*Ja promenivte bojata na katalogod!");
- }
- }else{SCM(playerid, COLOR_LIGHTRED, " Neste vo salonot!");}
- return 1;
- }
- CMD:bikeshop(playerid,params[])
- {
- if(IsShoping[playerid] == 0)
- {
- if(GetPlayerState(playerid) != 2)
- {
- if(IsPlayerInRangeOfPoint(playerid,7.00,1298.7928,-1870.8855,13.5469))
- {
- new string[128];
- TogglePlayerControllable(playerid, 0);
- IsShoping[playerid] = 2;
- SCM(playerid, COLOR_LIGHTBLUE, " Koristite Strela Levo(<)Desno(>)za da odberete avtomobil!");
- SCM(playerid, COLOR_LIGHTBLUE, " Za da go kupite avtomobilot pritisnite (F)");
- SCM(playerid, COLOR_LIGHTBLUE, " Za prekinuvanje na kupuvanjeto pretisnete CTRL");
- SVozilaTextDraw(playerid);
- format(string,sizeof(string),"~w~%s~n~~n~~h~~h~~b~Cena: %d~n~~n~~h~~h~~y~< ~g~ponatamu ~h~~h~~y~>",VehNames[vBikes[ShopVeh2[1]][0] -400],vBikes[ShopVeh2[1]][1]);
- TextDrawSetString(CarShopTextDraw[playerid],string);
- }else{SCM(playerid, COLOR_LIGHTRED, " Neste vo salonot!");}
- }else{SCM(playerid, COLOR_LIGHTRED, " Nemozete da kupuvate od voziloto!");}
- }else{SCM(playerid, COLOR_LIGHTRED, " Veke go listate nalogot!");}
- return 1;
- }
- CMD:bikeshopcol(playerid,params[])
- {
- if(IsPlayerInRangeOfPoint(playerid,7.00,1298.7928,-1870.8855,13.5469))
- {
- new boja1,boja2;
- if (sscanf(params, "dd",boja1,boja2)) SCM(playerid, COLOR_WHITE, "Koristenje: /bikeshopcol [boja 1] [boja 2]");
- else if(boja1 < 0 || boja1 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!!");
- else if(boja2 < 0 || boja2 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!!");
- else
- {
- ShopVeh2[2] = boja1;
- ShopVeh2[3] = boja2;
- ChangeVehicleColor(ShopVeh2[0],boja1,boja2);
- SCM(playerid, COLOR_LIGHTBLUE, "*Ja promenivte bojata na katalogot!");
- }
- }else{SCM(playerid, COLOR_LIGHTRED, " Neste vo salonot!");}
- return 1;
- }
- CMD:buyveh(playerid,params[])
- {
- if(EnCV[playerid] != -1)
- {
- if(MyVehicle[EnCV[playerid]][MyVehFsale] > 0)
- {
- if(MyVehicle[EnCV[playerid]][MyVehFsale] <= GetPlayerMoney(playerid))
- {
- new Float:CPs[3];
- GetVehiclePos(MyVehicle[EnCV[playerid]][MyVehID],CPs[0],CPs[1],CPs[2]);
- if(IsPlayerInRangeOfPoint(playerid,4.2,CPs[0],CPs[1],CPs[2]))
- {
- if(MyVehicle[EnCV[playerid]][MyVehCar] == 1 && AllMyCars(playerid) >= MAX_BUYED_VEHS) return SCM(playerid, COLOR_LIGHTRED, "Nemozes kupiti vise vozila ove vrste!");
- if(MyVehicle[EnCV[playerid]][MyVehBike] == 1 && AllMyBikes(playerid) >= MAX_BUYED_VEHS) return SCM(playerid, COLOR_LIGHTRED, "Nemozes kupiti vise vozila ove vrste!");
- if(MyVehicle[EnCV[playerid]][MyVehBoat] == 1 && AllMyBoats(playerid) >= MAX_BUYED_VEHS) return SCM(playerid, COLOR_LIGHTRED, "Nemozes kupiti vise vozila ove vrste!");
- if(MyVehicle[EnCV[playerid]][MyVehPlane] == 1 && AllMyAirs(playerid) >= MAX_BUYED_VEHS) return SCM(playerid, COLOR_LIGHTRED, "Nemozes kupiti vise vozila ove vrste!");
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(playerid,ime,sizeof(ime));
- GivePlayerMoney(playerid, -MyVehicle[EnCV[playerid]][MyVehFsale]);
- strmid(MyVehicle[EnCV[playerid]][MyVehOwner], ime, 0, strlen(ime), 64);
- MyVehicle[EnCV[playerid]][MyVehFsale] = 0;
- UpdateMyVehSystem(EnCV[playerid]);
- EnCV[playerid] = -1;
- SCM(playerid, COLOR_GREEN, "You bought vehicle!");
- }else{SCM(playerid, COLOR_LIGHTRED, "Neste do voziloto koe sakate da go kupite!");}
- }else{SCM(playerid, COLOR_LIGHTRED, "Nemate dovolno pari!");}
- }else{SCM(playerid, COLOR_LIGHTRED, "Ovaa vozilo ne e na prodazba!");}
- }else{SCM(playerid, COLOR_LIGHTRED, "Neste poglednale nitu eden avtomobil za kupuvanje!");}
- return 1;
- }
- CMD:sellveh(playerid, params[])
- {
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- new vozilo = GetPlayerVehicleID(playerid);
- if(PlayerOwnedVehID(playerid,vozilo) != -1)
- {
- new Novac;
- new Float:x,Float:y,Float:z;
- new Float:a;
- if (sscanf(params, "d",Novac)) SCM(playerid, COLOR_WHITE, "Koristenje: /sellveh [cijena]");
- else
- {
- GetVehiclePos(vozilo, x, y, z);
- GetVehicleZAngle(vozilo, a);
- strmid(MyVehicle[MyCarID(playerid)][MyVehOwner], "Nitko", 0, strlen("Nitko"), 24);
- MyVehicle[MyCarID(playerid)][MyVehFsale] = Novac;
- GivePlayerMoney(playerid, Novac);
- MyVehicle[MyCarID(playerid)][MyVehPos][0] = x;
- MyVehicle[MyCarID(playerid)][MyVehPos][1] = y;
- MyVehicle[MyCarID(playerid)][MyVehPos][2] = z;
- MyVehicle[MyCarID(playerid)][MyVehPos][3] = a;
- SetVehiclePos(vozilo, MyVehicle[MyCarID(playerid)][MyVehPos][0], MyVehicle[MyCarID(playerid)][MyVehPos][1],MyVehicle[MyCarID(playerid)][MyVehPos][2]);
- SetVehicleZAngle(vozilo, MyVehicle[MyCarID(playerid)][MyVehPos][3]);
- RemovePlayerFromVehicle(playerid);
- UpdateMyVehSystem(MyCarID(playerid));
- SCM(playerid, COLOR_GREEN, "Go Prodadovte svoeto vozilo!");
- }
- }else{SCM(playerid, COLOR_LIGHTRED, "Nemate dukumenti od ovaa vozilo!");}
- }else{SCM(playerid, COLOR_LIGHTRED, "Mora da bidete vo voziloto!");}
- return 1;
- }
- CMD:mycar(playerid,params[])
- {
- new opcija[24],ime[32];
- if (sscanf(params, "s[24]", opcija)) SCM(playerid, COLOR_WHITE, "Koristenje: /mycar [opcii]"),SCM(playerid, COLOR_WHITE, "opcii: park, lock, sell, locate");
- else
- {
- GetPlayerName(playerid, ime,sizeof(ime));
- if(strmatch("park",opcija))
- {
- ParkMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("lock",opcija))
- {
- LockMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("sell",opcija))
- {
- SellMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("locate",opcija))
- {
- LocateMyVehFnc(playerid,0);
- return 1;
- }
- }
- return 1;
- }
- CMD:mybike(playerid,params[])
- {
- new opcija[24],ime[32];
- if (sscanf(params, "s[24]", opcija)) SCM(playerid, COLOR_WHITE, "Koristenje: /mybike [opcii]"),SCM(playerid, COLOR_WHITE, "opcii: park, lock, sell, locate");
- else
- {
- GetPlayerName(playerid, ime,sizeof(ime));
- if(strmatch("park",opcija))
- {
- ParkMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("lock",opcija))
- {
- LockMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("sell",opcija))
- {
- SellMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("locate",opcija))
- {
- LocateMyVehFnc(playerid,1);
- return 1;
- }
- }
- return 1;
- }
- CMD:myboat(playerid,params[])
- {
- new opcija[24],ime[32];
- if (sscanf(params, "s[24]", opcija)) SCM(playerid, COLOR_WHITE, "Koristenje: /myboat [opcii]"),SCM(playerid, COLOR_WHITE, "opcii: park, lock, sell, locate");
- else
- {
- GetPlayerName(playerid, ime,sizeof(ime));
- if(strmatch("park",opcija))
- {
- ParkMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("lock",opcija))
- {
- LockMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("sell",opcija))
- {
- SellMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("locate",opcija))
- {
- LocateMyVehFnc(playerid,2);
- return 1;
- }
- }
- return 1;
- }
- CMD:myair(playerid,params[])
- {
- new opcija[24],ime[32];
- if (sscanf(params, "s[24]", opcija)) SCM(playerid, COLOR_WHITE, "Koristenje: /myair [opcii]"),SCM(playerid, COLOR_WHITE, "opcii: park, lock, sell, locate");
- else
- {
- GetPlayerName(playerid, ime,sizeof(ime));
- if(strmatch("park",opcija))
- {
- ParkMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("lock",opcija))
- {
- LockMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("sell",opcija))
- {
- SellMyVehFnc(playerid);
- return 1;
- }
- if(strmatch("locate",opcija))
- {
- LocateMyVehFnc(playerid,3);
- return 1;
- }
- }
- return 1;
- }
- CMD:apark(playerid,params[])
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- AparkMyVeh(playerid, MyCarID(playerid));
- }
- return 1;
- }
- CMD:asellveh(playerid,params[])
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- AsellMyVeh(playerid, MyCarID(playerid));
- }
- return 1;
- }
- CMD:makesaleveh(playerid, params[])
- {
- new vrsta,model,boja1,boja2,cijena;
- if (sscanf(params, "ddddd",vrsta,model,boja1,boja2,cijena)) SCM(playerid, COLOR_WHITE, "Koristenje: /makesaleveh [vrsta] [ModelID] [boja1] [boja2] [cijena]");
- else if(vrsta < 0 || vrsta > 3) SCM(playerid, COLOR_LIGHTGREEN, "Vrsta: 0-Avtomobil,1-Motor,2-Brod,3-Avion");
- else if(model < 400 || model > 611) SCM(playerid, COLOR_WHITE, "Model na vozilo nemoze da bide ispod 400 i nad 611!");
- else if(boja1 < 0 || boja1 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!");
- else if(boja2 < 0 || boja2 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!");
- else if(cijena < 1 || cijena > 100000000) SCM(playerid, COLOR_WHITE, "Cena nemoze da bide pod 0!");
- else
- {
- if(IsPlayerAdmin(playerid))
- {
- new Float:X,Float:Y,Float:Z,Float:A, s;
- GetPlayerPos(playerid, X,Y,Z);
- s = MakeXDCarFnc(playerid,vrsta,model,X+1.5,Y+2.5,Z+2.0,A,boja1,boja2,"Nitko");//THREAD-0=car=bike,2=boat,3=air
- MyVehicle[s][MyVehFsale] = cijena;
- SCM(playerid, COLOR_LIGHTRED, "Stavivte vozilo na prodazba!");
- printf("TYP:%d, ID:%d",vrsta,s);
- UpdateMyVehSystem(s);
- }else{SCM(playerid, COLOR_LIGHTRED, "Neste ovlasten za ovaa komanda!");}
- }
- return 1;
- }
- CMD:vehhelp(playerid,params[])
- {
- SCM(playerid, COLOR_LIGHTBLUE, "|_____________________VEHICLE HELP____________________|");
- SCM(playerid, COLOR_LIGHTBLUE, "CMD: /carshop, /carshopcol, /bikeshop, /bikeshopcol");
- SCM(playerid, COLOR_LIGHTBLUE, "CMD: /mycar");
- SCM(playerid, COLOR_LIGHTBLUE, "CMD: /mybike");
- SCM(playerid, COLOR_LIGHTBLUE, "CMD: /myboat (Treba samo napraviti salon)");
- SCM(playerid, COLOR_LIGHTBLUE, "CMD: /myair (Treba samo napraviti salon)");
- SCM(playerid, COLOR_LIGHTBLUE, "CMD: /sellveh, /buyveh (kada pokusate uci i cijena se pokaze))");
- SCM(playerid, COLOR_LIGHTBLUE, "ADMIN: /asellveh, /apark, /makesaleveh");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment