Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- --------------------------------FRAKTIONSAUTOHAUS-SYSTEM---------------------
- -----------------------------------MADY BY TRAMOS.NET------------------------
- -------------------------------PROFIL auf forum.Sa-mp.de------------------------
- -----------------------------LINK: http://forum.sa-mp.de/index.php?page=User&userID=14490 -----
- Fraktions-Autos-System:
- * Was ist das?
- * Einleitung
- * Befehle
- Was ist das?:
- Dieses 'Fraction - Car - System' soll einem helfen ein Fraktionsfahrzeug 'Ingame' zu erstellen.
- Wenn ein Fraktionsfahrzeug erstellt wurde, wird es gespeichert!
- Man kann die Fraktionsfahrzeuge:
- * Auf-/Abschließen
- * Umparken - Als Leader/Admin
- * Erstellen/Löschen - Als Admin
- * Respawnen - Leader/Admin
- Einleitung:
- Damit dieses Filterscript richtig Funktioniert, müsst ihr Folgendes tun:
- 1. Callbacks in euren Gamemode erstellen:
- PAWN Quelltext
- 1
- 2
- 3
- 4
- 5
- forward GetPlayerMember(playerid);
- public GetPlayerMember(playerid)
- {
- return PlayerInfo[playerid][pMember];
- }
- PAWN Quelltext
- 1
- 2
- 3
- 4
- 5
- forward GetPlayerLeader(playerid);
- public GetPlayerLeader(playerid)
- {
- return PlayerInfo[playerid][pLeader];
- }
- PAWN Quelltext
- 1
- 2
- 3
- 4
- 5
- forward GetPlayerAdminLevel(playerid);
- public GetPlayerAdminLevel(playerid)
- {
- return PlayerInfo[playerid][pAdmin];
- }
- 2. Das benötigte Adminlevel in der "FractionCars.pwn" oben bei "Fraction_Need_Adminlevel" evtl. anpassen - Der Admin kann alles! Erstellen, löschen, parken, ab-/Aufschließen,fahren.
- 3. Bei deiner server.cfg unter filterscripts, "FractionCars" an erster stelle schreiben.
- Befehle:
- * '/efa' - Erstellt ein Fraktionsfahrzeug - @Dialoge.
- * '/lfa' - Entfernt ein Fraktionsfahrzeug in deiner nähe.
- * '/fpark' - Parkt das Fraktionsfahrzeug in dem man sitzt.
- * '/flock' - Schließt das Fraktionsfahrzeug auf & ab.
- * '/rfc' - Der Leader der Fraktion repsawnt alle seine Fahrzeuge.
- * '/rafc' - Ein Admin Respawnt alle Fraktionsfahrzeuge.
- */
- #include <a_samp>
- #define Fraction_Need_Adminlevel 1337
- #define Fraction_Car_File "Fractioncars.cfg"
- #define MAX_FRACTION_CARS 500
- #define MAX_FRACTIONS 20
- #define fDialog_Vehid 3333
- #define fDialog_Col1 3334
- #define fDialog_Col2 3335
- #define fDialog_Fraction1 3336
- #define fDialog_Fraction2 3337
- #define fDialog_Fraction3 3338
- #define fDialog_Fraction4 3339
- #define fDialog_Fraction5 3340
- #define fDialog_Create 3341
- #define fColGrey 0xAFAFAFAA
- #define fColYellow 0xFFFF00FF
- new fCarName[][] =
- {
- "Landstalker","Bravura","Buffalo", "Linerunner", "Perrenial", "Sentinel",
- "Dumper","Firetruck","Trashmaster", "Stretch", "Manana", "Infernus",
- "Voodoo","Pony","Mule","Cheetah", "Ambulance", "Leviathan", "Moonbeam",
- "Esperanto","Taxi","Washington", "Bobcat", "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", "Boxvillde", "Benson", "Mesa", "RC Goblin",
- "Hotring Racer A","Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT",
- "Elegant","Journey","Bike", "Mountain Bike", "Beagle", "Cropduster", "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 Flat","Streak Carriage", "Kart", "Mower", "Dune", "Sweeper",
- "Broadway","Tornado","AT-400", "DFT-30", "Huntley", "Stafford", "BF-400",
- "News Van","Tug","Trailer","Emperor", "Wayfarer", "Euros", "Hotdog", "Club",
- "Freight Box","Trailer", "Andromada","Dodo", "RC Cam", "Launch", "Police Car",
- "Police Car","Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha",
- "Phoenix","2. Gebrauchtwagen","1. Gebrauchtwagen", "Luggage", "Luggage", "Stairs", "Boxville",
- "Tiller","Utility Trailer"
- };
- enum fInfo
- {
- bool:fLock,
- fCarid,
- fVehid,
- Float:fPos[4],
- fCol[2],
- fFraction[5]
- };
- new FractionCars[MAX_FRACTION_CARS][fInfo];
- new FractionTimer;
- forward LoadFractionCars();
- forward SaveFractionCars();
- forward fUnlockCar(Carid);
- forward fLockCar(Carid);
- forward RemoveFromCar(playerid);
- forward DestroyAndCreateFractionCar(fc);
- forward FractionLockDoors();
- public OnFilterScriptInit(){
- LoadFractionCars();
- FractionTimer=SetTimer("FractionLockDoors",1000,true);
- return 1;
- }
- public OnFilterScriptExit(){
- SaveFractionCars();
- KillTimer(FractionTimer);
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid){
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- if(FractionCars[fc][fCarid] == vehicleid){
- SetTimerEx("DestroyAndCreateFractionCar",3000,0,"d",fc);
- break;
- }
- }fc++;
- }return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[]){
- if(strcmp(cmdtext,"/efa",true)==0){
- if(PlayerAdministrator(playerid) >= Fraction_Need_Adminlevel){
- return ShowPlayerDialog(playerid,fDialog_Vehid,DIALOG_STYLE_INPUT,"Fraktionsfahrzeug erstellen:","Bitte gebe die Vehicle-ID des Fahrzeuges an, das du erstellen möchtest:","Weiter","Abbrechen");
- }return SendClientMessage(playerid,fColGrey,"Du bist nicht berechtigt diesen Befehl auszuführen.");
- }
- if(strcmp(cmdtext,"/lfa",true)==0){
- if(PlayerAdministrator(playerid) >= Fraction_Need_Adminlevel){
- new fc; while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- new Float:fX,Float:fY,Float:fZ;
- GetVehiclePos(FractionCars[fc][fCarid],fX,fY,fZ);
- if(IsPlayerInRangeOfPoint(playerid,5.0,fX,fY,fZ)){
- FractionCars[fc][fVehid]=-255;
- if(fUnlockCar(FractionCars[fc][fCarid]))
- FractionCars[fc][fLock] = false;
- if(DestroyVehicle(FractionCars[fc][fCarid]))
- FractionCars[fc][fCarid] = -255;
- new Text[256];
- format(Text,sizeof(Text),">> Du hast das Fraktionsfahrzeug der Fraktion '%d' entfernt.",FractionCars[fc][fFraction][0]);
- return SendClientMessage(playerid,fColYellow,Text);
- }
- }fc++;
- }return SendClientMessage(playerid,fColGrey,"Du bist nicht in der Nähe eines Fraktionsfahrzeuges.");
- }return SendClientMessage(playerid,fColGrey,"Du bist nicht berechtigt diesen Befehl auszuführen.");
- }
- if(strcmp(cmdtext,"/flock",true)==0){
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
- new Carid=GetPlayerVehicleID(playerid);
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- if(FractionCars[fc][fCarid] == Carid){
- for(new f;f<5;f++){
- if(PlayerFraction(playerid) == FractionCars[fc][fFraction][f]){
- if(FractionCars[fc][fLock]){
- FractionCars[fc][fLock]=false;
- fUnlockCar(FractionCars[fc][fCarid]);
- GameTextForPlayer(playerid,"~w~Fahrzeug~n~~g~Aufgeschlossen",5000,3);
- return true;
- }
- if(!FractionCars[fc][fLock]){
- fLockCar(FractionCars[fc][fCarid]);
- FractionCars[fc][fLock]=true;
- GameTextForPlayer(playerid,"~w~Fahrzeug~n~~r~Abgeschlossen",5000,3);
- return true;
- }
- }
- }
- }
- }fc++;
- }
- }else{
- if(GetPlayerState(playerid)==PLAYER_STATE_PASSENGER)
- return SendClientMessage(playerid,fColGrey,"Du musst der Fahrer dieses Fahrzeuges sein.");
- return SendClientMessage(playerid,fColGrey,"Du muss in einem Fahrzeug sitzen.");
- }return SendClientMessage(playerid,fColGrey,"Du sitzt in keinem Fraktionsfahrzeug!");
- }
- if(strcmp(cmdtext,"/fpark",true)==0){
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER){
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- if(GetPlayerVehicleID(playerid) == FractionCars[fc][fCarid]){
- if(PlayerAdministrator(playerid) >= Fraction_Need_Adminlevel || PlayerLeader(playerid) == FractionCars[fc][fFraction][0]){
- new Float:fX,Float:fY,Float:fZ,Float:fA;
- GetVehiclePos(FractionCars[fc][fCarid],fX,fY,fZ),GetVehicleZAngle(FractionCars[fc][fCarid],fA);
- FractionCars[fc][fPos][0]=fX;
- FractionCars[fc][fPos][1]=fY;
- FractionCars[fc][fPos][2]=fZ;
- FractionCars[fc][fPos][3]=fA;
- return SendClientMessage(playerid,fColYellow,">> Du hast das Fraktionsfahrzeug erfolgreich umgeparkt.");
- }else { return SendClientMessage(playerid,fColGrey,"Du bist dazu nicht berechtigt."); }
- }
- }fc++;
- }return SendClientMessage(playerid,fColGrey,"Du sitzt in keinem Fraktionsfahrzeug.");
- }return SendClientMessage(playerid,fColGrey,"Du sitzt in keinem Fahrzeug oder bist nicht der Fahrer.");
- }
- if(strcmp(cmdtext,"/rfc",true)==0){
- if(PlayerLeader(playerid)){
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- if(FractionCars[fc][fFraction][0] == PlayerLeader(playerid)){
- DestroyAndCreateFractionCar(fc);
- }
- }fc++;
- }return SendClientMessage(playerid,fColYellow,">> Du hast deine Fraktionsfahrzeuge respawnt.");
- }return SendClientMessage(playerid,fColGrey,"Du bist nicht berechtigt diesen Befehl auszuführen.");
- }
- if(strcmp(cmdtext,"/rafc",true)==0){
- if(PlayerAdministrator(playerid) >= Fraction_Need_Adminlevel){
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- DestroyAndCreateFractionCar(fc);
- }fc++;
- }return SendClientMessage(playerid,fColYellow,">> Du hast alle Fraktionsfahzeuge respawnt!");
- }return SendClientMessage(playerid,fColGrey,"Du bist nicht berechtigt diesen Befehl auszuführen.");
- }
- return 0;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate){
- if(newstate==PLAYER_STATE_DRIVER){
- new Carid=GetPlayerVehicleID(playerid);
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- if(FractionCars[fc][fCarid] == Carid){
- for(new f;f<5;f++){
- if(PlayerAdministrator(playerid) >= Fraction_Need_Adminlevel || PlayerFraction(playerid) == FractionCars[fc][fFraction][f])
- return true;
- }
- SendClientMessage(playerid,fColGrey,"Du bestitzt für dieses Fahrzeug keine Schlüssel, du verlässt das Fahrzeug.");
- RemovePlayerFromVehicle(playerid);
- SetTimerEx("RemoveFromCar",2500,false,"i",playerid);
- return true;
- }
- }fc++;
- }
- }return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
- if(dialogid==fDialog_Vehid){
- if(!response) return SendClientMessage(playerid,fColGrey,"Du hast den Vorgang abgebrochen.");
- if(strval(inputtext) >= 400 && strval(inputtext) <= 611){
- SetPVarInt(playerid,"fVehid",strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Col1,DIALOG_STYLE_INPUT,"Farbe 1 angeben:","Bitte gebe die 1. Farbe an, die das Fahrzeug besitzen soll:","Weiter","Abbrechen");
- }return ShowPlayerDialog(playerid,fDialog_Vehid,DIALOG_STYLE_INPUT,"Fraktionsfahrzeug erstellen:","Fehler!\nUnbekannte Vehicle-ID (Nur 400 - 611)\n\nBitte gebe die Vehicle-ID des Fahrzeuges an, das du erstellen möchtest:","Weiter","Abbrechen");
- }
- if(dialogid==fDialog_Col1){
- if(!response) return SendClientMessage(playerid,fColGrey,"Du hast den Vorgang abgebrochen.");
- if((strval(inputtext) >= 0 && strval(inputtext) <= 126) || (strval(inputtext) >= 130 && strval(inputtext) <= 132) || (strval(inputtext) == 142 || strval(inputtext) == 144) || (strval(inputtext) >= 146 && strval(inputtext) <= 161) || (strval(inputtext) >= 173 && strval(inputtext) <= 175) || (strval(inputtext) == 236 ||strval(inputtext) == 237 ||strval(inputtext) == 239 ||strval(inputtext) == 243 ||strval(inputtext) == 252)){
- SetPVarInt(playerid,"fCol1",strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Col2,DIALOG_STYLE_INPUT,"Farbe 2 angeben:","Bitte gebe die 2. Farbe an, die das Fahrzeug besitzen soll:","Weiter","Abbrechen");
- }return ShowPlayerDialog(playerid,fDialog_Col1,DIALOG_STYLE_INPUT,"Farbe 1 angeben:","Fehler!\nUnbekannte Farb-ID\n\nBitte gebe die 1. Farbe an, die das Fahrzeug besitzen soll:","Weiter","Abbrechen");
- }
- if(dialogid==fDialog_Col2){
- if(!response) return SendClientMessage(playerid,fColGrey,"Du hast den Vorgang abgebrochen.");
- if((strval(inputtext) >= 0 && strval(inputtext) <= 126) || (strval(inputtext) >= 130 && strval(inputtext) <= 132) || (strval(inputtext) == 142 || strval(inputtext) == 144) || (strval(inputtext) >= 146 && strval(inputtext) <= 161) || (strval(inputtext) >= 173 && strval(inputtext) <= 175) || (strval(inputtext) == 236 ||strval(inputtext) == 237 ||strval(inputtext) == 239 ||strval(inputtext) == 243 ||strval(inputtext) == 252)){
- SetPVarInt(playerid,"fCol2",strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Fraction1,DIALOG_STYLE_INPUT,"Hauptfraktion angeben:","Bitte gebe nun die Fraktion an die das Fahrzeug Besitzen soll:","Erstellen","Weiter");
- }return ShowPlayerDialog(playerid,fDialog_Col2,DIALOG_STYLE_INPUT,"Farbe 2 angeben:","Fehler!\nUnbekannte Farb-ID\n\nBitte gebe die 2. Farbe an, die das Fahrzeug besitzen soll:","Weiter","Abbrechen");
- }
- if(dialogid==fDialog_Fraction1){
- new Fractiontext[1024];
- if(response){
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction1",strval(inputtext));
- SetPVarInt(playerid,"fFraction2",-255);
- SetPVarInt(playerid,"fFraction3",-255);
- SetPVarInt(playerid,"fFraction4",-255);
- SetPVarInt(playerid,"fFraction5",-255);
- format(Fractiontext,sizeof(Fractiontext),"Fraktionsfahrzeug erstellen:\n\nFahrzeug: %s (ID:%d)\n1. Farbe: %d\n2. Farbe: %d\nHauptfraktion: %d\n2. Fraktion: N/A\n3. Fraktion: N/A\n4. Fraktion: N/A\n5. Fraktion: N/A\n\nUm das Fraktionsfahrzeug zu erstellen drücke den Button: 'Erstellen'.",
- fCarName[GetPVarInt(playerid,"fVehid")-400],
- GetPVarInt(playerid,"fVehid"),
- GetPVarInt(playerid,"fCol1"),
- GetPVarInt(playerid,"fCol2"),
- strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Create,DIALOG_STYLE_MSGBOX,"Bestätige:",Fractiontext,"Erstellen","Abbrechen");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug Besitzen soll:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction1,DIALOG_STYLE_INPUT,"Hauptfraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- if(!response){
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction1",strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Fraction2,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:","Bitte gebe nun eine Fraktion an die das Fahrzeug benutzen darf:","Erstellen","Weiter");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug Besitzen soll:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction1,DIALOG_STYLE_INPUT,"Hauptfraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- }
- if(dialogid==fDialog_Fraction2){
- new Fractiontext[1024];
- if(response){
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction2",strval(inputtext));
- SetPVarInt(playerid,"fFraction3",-255);
- SetPVarInt(playerid,"fFraction4",-255);
- SetPVarInt(playerid,"fFraction5",-255);
- format(Fractiontext,sizeof(Fractiontext),"Fraktionsfahrzeug erstellen:\n\nFahrzeug: %s (ID:%d)\n1. Farbe: %d\n2. Farbe: %d\nHauptfraktion: %d\n2. Fraktion: %d\n3. Fraktion: N/A\n4. Fraktion: N/A\n5. Fraktion: N/A\n\nUm das Fraktionsfahrzeug zu erstellen drücke den Button: 'Erstellen'.",
- fCarName[GetPVarInt(playerid,"fVehid")-400],
- GetPVarInt(playerid,"fVehid"),
- GetPVarInt(playerid,"fCol1"),
- GetPVarInt(playerid,"fCol2"),
- GetPVarInt(playerid,"fFraction1"),
- strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Create,DIALOG_STYLE_MSGBOX,"Bestätige:",Fractiontext,"Erstellen","Abbrechen");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug benutzen darf:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction2,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- if(!response){
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction2",strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Fraction3,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:","Bitte gebe nun eine Fraktion an die das Fahrzeug benutzen darf:","Erstellen","Weiter");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug benutzen darf:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction2,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- }
- if(dialogid==fDialog_Fraction3){
- new Fractiontext[1024];
- if(response){
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction3",strval(inputtext));
- SetPVarInt(playerid,"fFraction4",-255);
- SetPVarInt(playerid,"fFraction5",-255);
- format(Fractiontext,sizeof(Fractiontext),"Fraktionsfahrzeug erstellen:\n\nFahrzeug: %s (ID:%d)\n1. Farbe: %d\n2. Farbe: %d\nHauptfraktion: %d\n2. Fraktion: %d\n3. Fraktion: %d\n4. Fraktion: N/A\n5. Fraktion: N/A\n\nUm das Fraktionsfahrzeug zu erstellen drücke den Button: 'Erstellen'.",
- fCarName[GetPVarInt(playerid,"fVehid")-400],
- GetPVarInt(playerid,"fVehid"),
- GetPVarInt(playerid,"fCol1"),
- GetPVarInt(playerid,"fCol2"),
- GetPVarInt(playerid,"fFraction1"),
- GetPVarInt(playerid,"fFraction2"),
- strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Create,DIALOG_STYLE_MSGBOX,"Bestätige:",Fractiontext,"Erstellen","Abbrechen");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug benutzen darf:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction3,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- if(!response){
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction3",strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Fraction4,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:","Bitte gebe nun eine Fraktion an die das Fahrzeug benutzen darf:","Erstellen","Weiter");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug benutzen darf:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction3,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- }
- if(dialogid==fDialog_Fraction4){
- new Fractiontext[1024];
- if(response){
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction4",strval(inputtext));
- SetPVarInt(playerid,"fFraction5",-255);
- format(Fractiontext,sizeof(Fractiontext),"Fraktionsfahrzeug erstellen:\n\nFahrzeug: %s (ID:%d)\n1. Farbe: %d\n2. Farbe: %d\nHauptfraktion: %d\n2. Fraktion: %d\n3. Fraktion: %d\n4. Fraktion: %d\n5. Fraktion: N/A\n\nUm das Fraktionsfahrzeug zu erstellen drücke den Button: 'Erstellen'.",
- fCarName[GetPVarInt(playerid,"fVehid")-400],
- GetPVarInt(playerid,"fVehid"),
- GetPVarInt(playerid,"fCol1"),
- GetPVarInt(playerid,"fCol2"),
- GetPVarInt(playerid,"fFraction1"),
- GetPVarInt(playerid,"fFraction2"),
- GetPVarInt(playerid,"fFraction3"),
- strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Create,DIALOG_STYLE_MSGBOX,"Bestätige:",Fractiontext,"Erstellen","Abbrechen");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug benutzen darf:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction4,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- if(!response){
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction4",strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Fraction5,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:","Bitte gebe nun eine Fraktion an die das Fahrzeug benutzen darf:","Erstellen","Abbrechen");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug benutzen darf:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction4,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- }
- if(dialogid==fDialog_Fraction5){
- if(!response){
- return SendClientMessage(playerid,fColGrey,"Du hast den Vorgang abgebrochen.");
- }
- if(response){
- new Fractiontext[1024];
- if(strval(inputtext) >= 1 && strval(inputtext) <= MAX_FRACTIONS){
- SetPVarInt(playerid,"fFraction5",strval(inputtext));
- format(Fractiontext,sizeof(Fractiontext),"Fraktionsfahrzeug erstellen:\n\nFahrzeug: %s (ID:%d)\n1. Farbe: %d\n2. Farbe: %d\nHauptfraktion: %d\n2. Fraktion: %d\n3. Fraktion: %d\n4. Fraktion: %d\n5. Fraktion: %d\n\nUm das Fraktionsfahrzeug zu erstellen drücke den Button: 'Erstellen'.",
- fCarName[GetPVarInt(playerid,"fVehid")-400],
- GetPVarInt(playerid,"fVehid"),
- GetPVarInt(playerid,"fCol1"),
- GetPVarInt(playerid,"fCol2"),
- GetPVarInt(playerid,"fFraction1"),
- GetPVarInt(playerid,"fFraction2"),
- GetPVarInt(playerid,"fFraction3"),
- GetPVarInt(playerid,"fFraction4"),
- strval(inputtext));
- return ShowPlayerDialog(playerid,fDialog_Create,DIALOG_STYLE_MSGBOX,"Bestätige:",Fractiontext,"Erstellen","Abbrechen");
- }
- format(Fractiontext,sizeof(Fractiontext),"Fehler!\nFraktionen nur von 1 - %d\n\nBitte gebe nun die Fraktion an die das Fahrzeug benutzen darf:",MAX_FRACTIONS);
- return ShowPlayerDialog(playerid,fDialog_Fraction5,DIALOG_STYLE_INPUT,"Weitere Fraktion angeben:",Fractiontext,"Erstellen","Weiter");
- }
- }
- if(dialogid==fDialog_Create){
- if(!response){
- return SendClientMessage(playerid,fColGrey,"Du hast den Vorgang abgebrochen.");
- }
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] <= 400 || FractionCars[fc][fVehid] >= 611){
- FractionCars[fc][fVehid] = GetPVarInt(playerid,"fVehid");
- new Float:fX,Float:fY,Float:fZ,Float:fA;
- GetPlayerPos(playerid,fX,fY,fZ),GetPlayerFacingAngle(playerid,fA);
- FractionCars[fc][fPos][0] = fX;
- FractionCars[fc][fPos][1] = fY;
- FractionCars[fc][fPos][2] = fZ;
- FractionCars[fc][fPos][3] = fA;
- FractionCars[fc][fCol][0] = GetPVarInt(playerid,"fCol1");
- FractionCars[fc][fCol][1] = GetPVarInt(playerid,"fCol2");
- FractionCars[fc][fFraction][0] = GetPVarInt(playerid,"fFraction1");
- FractionCars[fc][fFraction][1] = GetPVarInt(playerid,"fFraction2");
- FractionCars[fc][fFraction][2] = GetPVarInt(playerid,"fFraction3");
- FractionCars[fc][fFraction][3] = GetPVarInt(playerid,"fFraction4");
- FractionCars[fc][fFraction][4] = GetPVarInt(playerid,"fFraction5");
- FractionCars[fc][fCarid] = CreateVehicle(FractionCars[fc][fVehid],FractionCars[fc][fPos][0],FractionCars[fc][fPos][1],FractionCars[fc][fPos][2],FractionCars[fc][fPos][3],FractionCars[fc][fCol][0],FractionCars[fc][fCol][1],-255);
- FractionCars[fc][fLock] = true;
- SendClientMessage(playerid,fColYellow,">>> Du hast das Fraktionsfahrzeug erfolgreich erstellt.");
- SendClientMessage(playerid,fColYellow,">>> Vergesse es nicht mit '/fpark' zu umzuparken.");
- PutPlayerInVehicle(playerid,FractionCars[fc][fCarid],0);
- return true;
- }fc++;
- }
- }return false;
- }
- public FractionLockDoors(){
- for(new i;i<GetMaxPlayers();i++){
- if(IsPlayerConnected(i) && !IsPlayerNPC(i)){
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- if(FractionCars[fc][fLock]){
- if(PlayerFraction(i)==FractionCars[fc][fFraction][0]||PlayerFraction(i)==FractionCars[fc][fFraction][1]||PlayerFraction(i)==FractionCars[fc][fFraction][2]||PlayerFraction(i)==FractionCars[fc][fFraction][3]||PlayerFraction(i)==FractionCars[fc][fFraction][4]||PlayerAdministrator(i)>=Fraction_Need_Adminlevel)
- SetVehicleParamsForPlayer(FractionCars[fc][fCarid],i,0,0);
- else
- SetVehicleParamsForPlayer(FractionCars[fc][fCarid],i,0,1);
- }
- }fc++;
- }
- }
- }return 1;
- }
- public LoadFractionCars(){
- if(!fexist(Fraction_Car_File)){
- new File:tfFile=fopen(Fraction_Car_File,io_write);
- fclose(tfFile);
- }
- new File:fFile=fopen(Fraction_Car_File,io_read),Content[512],fc;
- while(fread(fFile,Content)){
- StripNewLine(Content);
- sscanf(Content,"dffffddddddd",FractionCars[fc][fVehid],FractionCars[fc][fPos][0],FractionCars[fc][fPos][1],FractionCars[fc][fPos][2],FractionCars[fc][fPos][3],FractionCars[fc][fCol][0],FractionCars[fc][fCol][1],FractionCars[fc][fFraction][0],FractionCars[fc][fFraction][1],FractionCars[fc][fFraction][2],FractionCars[fc][fFraction][3],FractionCars[fc][fFraction][4]);
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611)
- {
- FractionCars[fc][fCarid] = CreateVehicle(FractionCars[fc][fVehid],FractionCars[fc][fPos][0],FractionCars[fc][fPos][1],FractionCars[fc][fPos][2],FractionCars[fc][fPos][3],FractionCars[fc][fCol][0],FractionCars[fc][fCol][1],-255);
- FractionCars[fc][fLock] = true;
- fc++;
- }
- }
- fclose(fFile);
- return printf(" '%d' Fraktionsfahrzeug(e) wurden geladen & erstellt.",fc);
- }
- public SaveFractionCars(){
- if(fexist(Fraction_Car_File)) fremove(Fraction_Car_File);
- new File:fFile=fopen(Fraction_Car_File,io_append),Content[512];
- new fc;while(fc<MAX_FRACTION_CARS){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- format(Content,sizeof(Content),"%d %.3f %.3f %.3f %.3f %03d %03d %02d %02d %02d %02d %02d\r\n",FractionCars[fc][fVehid],FractionCars[fc][fPos][0],FractionCars[fc][fPos][1],FractionCars[fc][fPos][2],FractionCars[fc][fPos][3],FractionCars[fc][fCol][0],FractionCars[fc][fCol][1],FractionCars[fc][fFraction][0],FractionCars[fc][fFraction][1],FractionCars[fc][fFraction][2],FractionCars[fc][fFraction][3],FractionCars[fc][fFraction][4]);
- fwrite(fFile,Content);
- }fc++;
- }return fclose(fFile);
- }
- public DestroyAndCreateFractionCar(fc){
- if(FractionCars[fc][fVehid] >= 400 && FractionCars[fc][fVehid] <= 611){
- DestroyVehicle(FractionCars[fc][fCarid]);
- FractionCars[fc][fCarid] = CreateVehicle(FractionCars[fc][fVehid],FractionCars[fc][fPos][0],FractionCars[fc][fPos][1],FractionCars[fc][fPos][2],FractionCars[fc][fPos][3],FractionCars[fc][fCol][0],FractionCars[fc][fCol][1],-255);
- return true;
- }return false;
- }
- public RemoveFromCar(playerid){
- return RemovePlayerFromVehicle(playerid);
- }
- public fLockCar(Carid){
- for(new i;i<GetMaxPlayers();i++){
- SetVehicleParamsForPlayer(Carid,i,0,1);
- }return 1;
- }
- public fUnlockCar(Carid){
- for(new i;i<GetMaxPlayers();i++){
- SetVehicleParamsForPlayer(Carid,i,0,0);
- }return 1;
- }
- stock PlayerAdministrator(playerid){
- if(IsPlayerAdmin(playerid))
- return Fraction_Need_Adminlevel;
- return CallRemoteFunction("GetPlayerAdminLevel","i",playerid);
- }
- stock PlayerFraction(playerid){
- new Leader=PlayerLeader(playerid);
- if(Leader)
- return Leader;
- new Member=PlayerMember(playerid);
- if(Member)
- return Member;
- return false;
- }
- stock PlayerLeader(playerid){
- return CallRemoteFunction("GetPlayerLeader","i",playerid);
- }
- stock PlayerMember(playerid){
- return CallRemoteFunction("GetPlayerMember","i",playerid);
- }
- stock sscanf(string[],format[],{Float,_}:...){
- new formatPos=0,stringPos=0,paramPos=2,paramCount=numargs();
- while(paramPos < paramCount && string[stringPos]){
- switch (format[formatPos++]){
- case '\0':{return 0;}case 'i','d':{
- new neg=1,num=0,ch=string[stringPos];
- if(ch=='-'){neg=-1;ch=string[++stringPos];}
- do{ stringPos++;
- if(ch>='0'&&ch<='9'){num=(num*10)+(ch-'0');}else{return 1;}
- }while((ch=string[stringPos])&&ch!=' ');setarg(paramPos,0,num*neg);}
- case 'h','x':{
- new ch,num=0;while((ch=string[stringPos++])){
- switch (ch){
- case 'x','X':{num=0;continue;}case '0'..'9':{num=(num<<4)|(ch-'0');}
- case 'a'..'f':{num=(num<<4)|(ch-('a'-10));}case 'A'..'F':{num=(num<<4)|(ch-('A'-10));}
- case ' ':{break;}default:{return 1;}}
- }setarg(paramPos,0,num);}
- case 'c':{setarg(paramPos,0,string[stringPos++]);}
- case 'f':{
- new tmp[25];
- strmid(tmp,string,stringPos,stringPos+sizeof(tmp)-2);
- setarg(paramPos,0,_:floatstr(tmp));}
- case 's','z':{
- new i=0,ch;
- if(format[formatPos]){
- while ((ch=string[stringPos++])&&ch!=' '){
- setarg(paramPos,i++,ch);
- }if(!i)return 1;
- }else{while((ch=string[stringPos++])){setarg(paramPos,i++,ch);}
- }stringPos--;setarg(paramPos,i,'\0');
- }default:{continue;}}
- while(string[stringPos]&&string[stringPos]!=' '){stringPos++;}
- while(string[stringPos]==' '){stringPos++;}
- paramPos++;}
- while(format[formatPos]=='z')formatPos++;
- return format[formatPos];
- }
- stock StripNewLine(string[]){
- new len=strlen(string);
- if(string[0]==0)return;if((string[len-1]=='\n')||(string[len-1]=='\r')){
- string[len-1]=0; if(string[0]==0) return; if((string[len-2]=='\n')||(string[len-2]=='\r'))string[len-2]=0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement