Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //RL Script made by Apoolecu aka. Sp!ax
- //V.0.2
- #include <a_samp>
- #include <Dini>
- #include <filemanager>
- #include <zcmd>
- #pragma tabsize 0
- #define COLOR_WARNING 0xFF6347AA
- #define COLOR_INFO 0xF6F60000
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_GREEN 0x339933FF
- #define COLOR_YELLOW 0xFFDE00FF
- #define COLOR_BLUE 0x0000F600
- #define COLOR_RED 0xCE000000
- #define COLOR_ORANGE 0xFF830000
- /*
- #define NEED_TAXI 0xF6EB35F6
- #define NEED_MEDIC 0x00F600F6
- #define NEED_FEUER 0xF60052F6
- #define NEED_POLICE 0x006CF6F6
- #define NEED_MAKLER 0x00D9F6F6
- #define NEED_ADAC 0xF64B00F6*/
- #define COLOR_GREY 0xBEBEBEAA
- #define color_DGREEN 0x33AA33AA
- #define COLOR_BLACK 0x000000
- #define COLOR_GRAD5 0xE3E3E3FF
- #define COLOR_GRAD4 0xD8D8D8FF
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_LILA 0xF600E6F6
- #define COLOR_GRAD3 0xCBCCCEFF
- #define color_lred 0xAA3333AA
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- #define COLOR_PURPLE 0xC2A2DAAA
- #define COLOR_CADETBLUE 0x5F9EA0
- #define COLOR_GRAD6 0xF0F0F0FF
- #define COLOR_INVISIBLE 0xFFFFFF00
- #define COLOR_ORANGE 0xFF830000
- #define COLOR_lorange 0xFF830000
- #define COLOR_t 0xFFC4C4FF
- #define DIALOG_LOGIN 1
- #define DIALOG_REG 2
- #define DIALOG_REG2 3
- #define DIALOG_REG3 4
- #define MAX_HOUSE 500
- enum house_daten
- {
- besitzer[MAX_PLAYER_NAME],
- ID,
- interior,
- level,
- preis,
- punkte,
- Float:hX,Float:hZ,Float:hY,
- Float:hX2,Float:hZ2,Float:hY2,
- Text3D:hlabel,
- Pickup,
- Pickup2,
- bereit
- }
- new Haus[MAX_HOUSE][house_daten];
- enum spieler_daten
- {
- wanted,
- admin,
- skin,
- rang,
- job,
- duty,
- money,
- geschlecht,
- alter,
- cuff,
- tod,
- haendler,
- level1,
- Float:lastx,Float:lasty,Float:lastz,
- eingeloggt
- }
- new pName[MAX_PLAYER_NAME];
- new Spieler[MAX_PLAYERS][spieler_daten];
- enum Auto_System
- {
- aID,
- aModel,
- Float:aX,
- Float:aY,
- Float:aZ,
- Float:aAngle,
- }
- new Auto[MAX_VEHICLES][Auto_System];
- new Text:txtTimeDisp;
- new hour, minute;
- new timestr[32];
- forward SpeicherUser(playerid);
- forward UpdateTime();
- forward SpeicherFahrzeug(carid);
- forward LadeFahrzeug(carid);
- forward SpeicherHaus(id);
- forward LadeHaus(id);
- forward InstalliereServer();
- main()
- {
- print("\n----------------------------------");
- print(" Reallife Script by Apoolecu");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("Realife Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- txtTimeDisp = TextDrawCreate(605.0,25.0,"00:00");
- TextDrawUseBox(txtTimeDisp, 0);
- TextDrawFont(txtTimeDisp, 3);
- TextDrawSetShadow(txtTimeDisp,0); // no shadow
- TextDrawSetOutline(txtTimeDisp,2); // thickness 1
- TextDrawBackgroundColor(txtTimeDisp,0x000000FF);
- TextDrawColor(txtTimeDisp,0xFFFFFFFF);
- TextDrawAlignment(txtTimeDisp,3);
- TextDrawLetterSize(txtTimeDisp,0.5,1.5);
- if(!dir_exists("scriptfiles/Server"))
- { InstalliereServer();}
- for(new i = 1; i < MAX_VEHICLES; i++)
- {
- new string[90];
- format(string, sizeof(string), "Server/Fahrzeug/%d.car", i);
- if(fexist(string))
- {
- LadeFahrzeug(i);
- CreateVehicle(Auto[i][aModel], Auto[i][aX], Auto[i][aY], Auto[i][aZ], Auto[i][aAngle],0, 0, -1);
- }
- }
- for(new h = 1,string[125]; h < MAX_HOUSE; h++)
- {
- format(string, sizeof(string), "Server/Haus/%d.haus", h);
- if(fexist(string))
- {
- LadeHaus(h);
- if(Haus[h][bereit] == 0)
- {
- format(string,sizeof string,"Besitzer: KEINER\nLevel: %d\nPreis: %d $\nPremiumpunkte: %d\n/kaufen",Haus[h][level],Haus[h][preis],Haus[h][punkte]);
- Haus[h][hlabel] = Create3DTextLabel(string,COLOR_WHITE,Haus[h][hX],Haus[h][hY],Haus[h][hZ]+0.75,40.0,0,1);
- Haus[h][Pickup] = CreatePickup(1273, 1, Haus[h][hX], Haus[h][hY], Haus[h][hZ], -1);
- Haus[h][Pickup2] = CreatePickup(1559, 1, Haus[h][hX2], Haus[h][hY2], Haus[h][hZ2], -1);
- }
- if(Haus[h][bereit] == 1)
- {
- format(string,sizeof string,"Besitzer: %s\nLevel: %d\nPreis: %d $\nPremiumpunkte: %d",Haus[h][besitzer],Haus[h][level],Haus[h][preis],Haus[h][punkte]);
- Haus[h][hlabel] = Create3DTextLabel(string,COLOR_WHITE,Haus[h][hX],Haus[h][hY],Haus[h][hZ]+0.75,40.0,0,1);
- Haus[h][Pickup] = CreatePickup(1272, 1, Haus[h][hX], Haus[h][hY], Haus[h][hZ], -1);
- Haus[h][Pickup2] = CreatePickup(1559, 1, Haus[h][hX2], Haus[h][hY2], Haus[h][hZ2], -1);
- }
- }
- }
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[64],accFormat[40];
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- format(string,sizeof string,"[SERVERINFO] %s hat den Server betreten",pName);
- SendClientMessageToAll(COLOR_INFO,string);
- format(accFormat,sizeof accFormat,"Server/User/%s.User",pName);
- SetPlayerColor(playerid,COLOR_WHITE);
- gettime(hour, minute);
- SetPlayerTime(playerid,hour,minute);
- if(fexist(accFormat))
- {
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD ,"Login","Willkommen zurück!\nGebe dein Passwort ein um zu spielen.","Abbrechen","Weiter");
- }
- else
- {
- ShowPlayerDialog(playerid,DIALOG_REG,DIALOG_STYLE_PASSWORD ,"Registrieren","Willkommen!\nGebe ein Passwort ein um auf dem Server zu spielen.","Weiter","Abbrechen");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new string[90];
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- switch(reason)
- {
- case 0: format(string,sizeof string,"[SERVERINFO] %s hat den Server aufgrund eines Timouts verlassen.",pName);
- case 1: format(string,sizeof string,"[SERVERINFO] %s hat den Server verlassen.",pName);
- case 2: format(string,sizeof string,"[SERVERINFO] %s hat den Server aufgrund eines Kicks/Banns verlassen.",pName);
- }
- SendClientMessageToAll(COLOR_INFO,string);
- SpeicherUser(playerid);
- Spieler[playerid][eingeloggt] = 0;
- Spieler[playerid][geschlecht] = 0;
- Spieler[playerid][alter] = 0;
- Spieler[playerid][tod] = 0;
- Spieler[playerid][cuff] = 0;
- Spieler[playerid][money] = 0;
- Spieler[playerid][wanted] = 0;
- Spieler[playerid][haendler] = 0;
- Spieler[playerid][skin] = 0;
- Spieler[playerid][job] = 0;
- Spieler[playerid][rang] = 0;
- Spieler[playerid][duty] = 0;
- Spieler[playerid][level1] = 0;
- Spieler[playerid][admin] = 0;
- Spieler[playerid][lastx] = (0.0);
- Spieler[playerid][lasty] = (0.0);
- Spieler[playerid][lastz] = (0.0);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerSkin(playerid,Spieler[playerid][skin]);
- GivePlayerMoney(playerid,Spieler[playerid][money]);
- SetPlayerWantedLevel(playerid,Spieler[playerid][wanted]);
- TextDrawShowForPlayer(playerid,txtTimeDisp);
- gettime(hour, minute);
- SetPlayerTime(playerid,hour,minute);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new accFormat[128];
- GetPlayerName(playerid,pName,sizeof pName);
- format(accFormat,sizeof accFormat,"Server/User/%s.User",pName);
- if(response)
- {
- switch(dialogid) // dialogid auswählen
- {
- case DIALOG_LOGIN: // ID Login
- {
- if(!strlen(inputtext))
- {
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Willkommen zurück!\nGebe dein Passwort ein um zu spielen.","Abbrechen","Weiter");
- return SendClientMessage(playerid,COLOR_INFO,"[SERVERINFO] Kein Passwort angegeben!");
- }
- if(strcmp(inputtext,dini_Get(accFormat,"Passwort")) == 0)
- {
- Spieler[playerid][money] = dini_Int(accFormat,"money");
- Spieler[playerid][wanted] = dini_Int(accFormat,"wanted");
- Spieler[playerid][geschlecht] = dini_Int(accFormat,"geschlecht");
- Spieler[playerid][alter] = dini_Int(accFormat,"alter");
- Spieler[playerid][tod] = dini_Int(accFormat,"tod");
- Spieler[playerid][haendler] = dini_Int(accFormat,"haendler");
- Spieler[playerid][cuff] = dini_Int(accFormat,"cuff");
- Spieler[playerid][skin] = dini_Int(accFormat,"skin");
- Spieler[playerid][job] = dini_Int(accFormat,"job");
- Spieler[playerid][rang] = dini_Int(accFormat,"rang");
- Spieler[playerid][duty] = dini_Int(accFormat,"duty");
- Spieler[playerid][level1] = dini_Int(accFormat,"level");
- Spieler[playerid][admin] = dini_Int(accFormat,"admin");
- Spieler[playerid][lastx] = dini_Float(accFormat,"lastx");
- Spieler[playerid][lasty] = dini_Float(accFormat,"lasty");
- Spieler[playerid][lastz] = dini_Float(accFormat,"lastz");
- Spieler[playerid][eingeloggt] = 1;
- SendClientMessage(playerid,COLOR_YELLOW,"[SERVERINFO] Du wurdest erfolgreich eingeloggt.");
- }
- else
- {
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Bitte logge dich ein","Abbrechen","Weiter");
- SendClientMessage(playerid,COLOR_INFO,"[SERVERINFO] Das Passwort war Falsch!");
- }
- }
- case DIALOG_REG: // ID Registrieren
- {
- if(!strlen(inputtext))
- {
- ShowPlayerDialog(playerid,DIALOG_REG,DIALOG_STYLE_PASSWORD,"Registrieren","Willkommen!\nGebe ein Passwort ein um auf dem Server zu Spielen.","Abbrechen","Weiter");
- return SendClientMessage(playerid,COLOR_RED,"[SERVERINFO] Das Passwort ist zu kurz!");
- }
- dini_Create(accFormat);
- dini_Set(accFormat,"Passwort",inputtext);
- ShowPlayerDialog(playerid,DIALOG_REG2,1,"Registieren","Gebe nun dein Alter ein.\n(z.B. 17)","Weiter","");
- }
- case DIALOG_REG2: // Alter
- {
- if(!strlen(inputtext))
- {
- ShowPlayerDialog(playerid,DIALOG_REG2,1,"Registrieren","Gebe nun dein Alter ein.\n(z.B. 17)","Weiter","");
- return SendClientMessage(playerid,COLOR_RED,"[SERVERINFO] Das angegeben Alter ist nicht korrekt!");
- }
- dini_Set(accFormat,"alter",inputtext);
- dini_Set(accFormat,"money","5000");
- dini_Set(accFormat,"wanted","0");
- dini_Set(accFormat,"cuff","0");
- dini_Set(accFormat,"skin","0");
- dini_Set(accFormat,"job","0");
- dini_Set(accFormat,"rang","0");
- dini_Set(accFormat,"duty","0");
- dini_Set(accFormat,"tod","0");
- dini_Set(accFormat,"admin","0");
- dini_Set(accFormat,"level1","1");
- dini_Set(accFormat,"haendler","0");
- ShowPlayerDialog(playerid,DIALOG_REG3,2,"Registieren","Männlich\nWeiblich","Weiter","");
- }
- case DIALOG_REG3: // Geschlecht
- {
- if(listitem == 0)
- {
- dini_Set(accFormat,"geschlecht","1");
- Spieler[playerid][eingeloggt] = 1;
- SendClientMessage(playerid,COLOR_YELLOW,"[SERVERINFO] Account wurde angelegt und du wurdest eingeloggt.");
- }
- if(listitem == 1)
- {
- dini_Set(accFormat,"geschlecht","2");
- Spieler[playerid][eingeloggt] = 1;
- SendClientMessage(playerid,COLOR_YELLOW,"[SERVERINFO] Account wurde angelegt und du wurdest eingeloggt.");
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public OnPlayerCommandPerformed(playerid,cmdtext[],success) {
- if(success == 0)
- {
- SendClientMessage(playerid,COLOR_RED,"Dieser Befehl ist nicht verfügbar.");
- return 1;
- }
- return 1;
- }
- public UpdateTime()
- {
- gettime(hour, minute);
- format(timestr,60,"%02d:%02d",hour,minute);
- TextDrawSetString(txtTimeDisp,timestr);
- SetWorldTime(hour);
- new x=0;
- while(x!=MAX_PLAYERS) {
- if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) {
- SetPlayerTime(x,hour,minute);
- }
- x++;
- }
- }
- public SpeicherUser(playerid)
- {
- new accFormat[40];
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- format(accFormat,sizeof accFormat,"Server/User/%s.User",pName);
- if(fexist(accFormat) && Spieler[playerid][eingeloggt])
- {
- dini_IntSet(accFormat,"wanted",Spieler[playerid][wanted]);
- dini_IntSet(accFormat,"geschlecht",Spieler[playerid][geschlecht]);
- dini_IntSet(accFormat,"alter",Spieler[playerid][alter]);
- dini_IntSet(accFormat,"tod",Spieler[playerid][tod]);
- dini_IntSet(accFormat,"haendler",Spieler[playerid][haendler]);
- dini_IntSet(accFormat,"cuff",Spieler[playerid][cuff]);
- dini_IntSet(accFormat,"money",Spieler[playerid][money]);
- dini_IntSet(accFormat,"skin",Spieler[playerid][skin]);
- dini_IntSet(accFormat,"job",Spieler[playerid][job]);
- dini_IntSet(accFormat,"rang",Spieler[playerid][rang]);
- dini_IntSet(accFormat,"duty",Spieler[playerid][duty]);
- dini_IntSet(accFormat,"level", Spieler[playerid][level1]);
- dini_IntSet(accFormat,"admin", Spieler[playerid][admin]);
- dini_FloatSet(accFormat,"lastx",Spieler[playerid][lastx]);
- dini_FloatSet(accFormat,"lasty",Spieler[playerid][lasty]);
- dini_FloatSet(accFormat,"lastz",Spieler[playerid][lastz]);
- }
- return 1;
- }
- public SpeicherFahrzeug(carid)
- {
- if(carid <= 0)
- {
- return 1;
- }
- new str[90];
- format(str, sizeof(str), "Server/Fahrzeug/%d.car", carid);
- dini_Create(str);
- {
- Auto[carid][aModel] = GetVehicleModel(carid);
- dini_IntSet(str,"ID",Auto[carid][aID]);
- dini_FloatSet(str,"aX", Auto[carid][aX]);
- dini_FloatSet(str,"aY", Auto[carid][aY]);
- dini_FloatSet(str,"aZ", Auto[carid][aZ]);
- dini_FloatSet(str,"aAngle", Auto[carid][aAngle]);
- dini_IntSet(str,"model",Auto[carid][aModel]);
- }
- return 1;
- }
- public LadeFahrzeug(carid)
- {
- new str[90];
- format(str, sizeof(str), "Server/Fahrzeug/%d.car", carid);
- if(carid <= 0)
- {
- return 1;
- }
- if(fexist(str))
- {
- Auto[carid][aID] = dini_Int(str, "ID");
- Auto[carid][aX] = dini_Float(str, "aX");
- Auto[carid][aY] = dini_Float(str, "aY");
- Auto[carid][aZ] = dini_Float(str, "aZ");
- Auto[carid][aAngle] = dini_Float(str, "aAngle");
- Auto[carid][aModel] = dini_Int(str, "Model");
- }
- return 1;
- }
- public SpeicherHaus(id)
- {
- new str[125];
- if(id <= 0)
- {
- return 1;
- }
- format(str, sizeof(str), "Server/Haus/%d.haus", id);
- dini_Create(str);
- if(fexist(str))
- {
- dini_Set(str,"besitzer",Haus[id][besitzer]);
- dini_IntSet(str,"ID",Haus[id][ID]);
- dini_IntSet(str,"interior",Haus[id][interior]);
- dini_IntSet(str,"Preis",Haus[id][preis]);
- dini_IntSet(str,"Level",Haus[id][level]);
- dini_IntSet(str,"Punkte",Haus[id][punkte]);
- dini_FloatSet(str,"hX", Haus[id][hX]);
- dini_FloatSet(str,"hY", Haus[id][hY]);
- dini_FloatSet(str,"hZ", Haus[id][hZ]);
- dini_FloatSet(str,"hX2", Haus[id][hX2]);
- dini_FloatSet(str,"hY2", Haus[id][hY2]);
- dini_FloatSet(str,"hZ2", Haus[id][hZ2]);
- dini_IntSet(str,"Bereit",Haus[id][bereit]);
- printf("X %.1f ; Y %.1f; Z %.1f",Haus[id][hX],Haus[id][hY],Haus[id][hZ]);
- }
- return 1;
- }
- public LadeHaus(id)
- {
- new str[125];
- format(str, sizeof(str), "Server/Haus/%d.haus", id);
- if(id == 0)
- {
- return 1;
- }
- if(fexist(str))
- {
- format(Haus[id][besitzer],24,"%s",dini_Get(str, "besitzer"));
- Haus[id][ID] = dini_Int(str, "ID");
- Haus[id][interior] = dini_Int(str, "interior");
- Haus[id][preis] = dini_Int(str, "Preis");
- Haus[id][level] = dini_Int(str, "Level");
- Haus[id][punkte] = dini_Int(str, "punkte");
- Haus[id][hX] = dini_Float(str, "hX");
- Haus[id][hY] = dini_Float(str, "hY");
- Haus[id][hZ] = dini_Float(str, "hZ");
- Haus[id][hX2] = dini_Float(str, "hX2");
- Haus[id][hY2] = dini_Float(str, "hY2");
- Haus[id][hZ2] = dini_Float(str, "hZ2");
- Haus[id][bereit] = dini_Int(str, "Bereit");
- printf("X %.1f ; Y %.1f; Z %.1f",Haus[id][hX],Haus[id][hY],Haus[id][hZ]);
- }
- return 1;
- }
- public InstalliereServer()
- {
- print("____RL Script By Apoolecu aka Sp!ax____");
- print("Alle für den Server benoetigten sachen");
- print("werden Installiert, bitte warte");
- if(!dir_exists("scriptfiles/Server"))
- {
- print("Installiere: Hauptverzeichnis");
- print("Verzeichnis: scriptfiles/Server");
- dir_create("scriptfiles/Server");
- }
- if(!dir_exists("scriptfiles/Server/User"))
- {
- print("Installiere: Userverzeichnis");
- print("Verzeichnis: scriptfiles/Server/User");
- dir_create("scriptfiles/Server/User");
- }
- if(!dir_exists("scriptfiles/Server/Fahrzeug"))
- {
- print("Installiere: Fahrzeugverzeichnis");
- print("Verzeichnis: scriptfiles/Server/Fahrzeug");
- dir_create("scriptfiles/Server/Fahrzeug");
- }
- if(!dir_exists("scriptfiles/Server/Haus"))
- {
- print("Installiere: Haueserverzeichnis");
- print("Verzeichnis: scriptfiles/Server/Haus");
- dir_create("scriptfiles/Server/Haus");
- }
- print("Installation wurde erfolgreich beendet");
- print("_____RL Script by Apoolecu aka Sp!ax_____");
- print("_________________________________________");
- }
- CMD:hkaufen(playerid, params[])
- {
- for(new h = 1,string[125],sUnterbefehl[16]; h < MAX_HOUSE; h ++)
- {
- if(IsPlayerInRangeOfPoint(playerid,5.0,Haus[h][hX],Haus[h][hY],Haus[h][hZ]) && Haus[h][bereit] == 0)
- {
- if(sscanf(params,"s",sUnterbefehl)){
- SendClientMessage(playerid,COLOR_RED,"Benutze: /hkaufen [Premium/Normal]");
- }
- if(strfind(sUnterbefehl, "Premium", true) != -1)
- {
- GetPlayerName(playerid,pName,sizeof pName);
- SendClientMessage(playerid,COLOR_YELLOW,"Du hast das Haus für Premiumpunkte gekauft.");
- Spieler[playerid][lastx] = Haus[h][hX];
- Spieler[playerid][lasty] = Haus[h][hY];
- Spieler[playerid][lastz] = Haus[h][hZ];
- strmid(Haus[h][besitzer], pName,0, sizeof(pName)-1, MAX_PLAYER_NAME);
- DestroyPickup(Haus[h][Pickup]);
- Haus[h][bereit] = 1;
- Delete3DTextLabel(Haus[h][hlabel]);
- format(string,sizeof string,"Besitzer: %s\nLevel: %d\nPreis: %d $\nPremiumpunkte: %d",Haus[h][besitzer],Haus[h][level],Haus[h][preis],Haus[h][punkte]);
- Haus[h][hlabel] = Create3DTextLabel(string,COLOR_WHITE,Haus[h][hX],Haus[h][hY],Haus[h][hZ]+0.75,40.0,0,1);
- Haus[h][Pickup] = CreatePickup(1272, 1, Haus[h][hX], Haus[h][hY], Haus[h][hZ], -1);
- }
- else if(strfind(sUnterbefehl, "Normal", true) != -1)
- {
- GetPlayerName(playerid,pName,sizeof pName);
- SendClientMessage(playerid,COLOR_YELLOW,"Du hast das Haus für Geld gekauft.");
- Spieler[playerid][lastx] = Haus[h][hX];
- Spieler[playerid][lasty] = Haus[h][hY];
- Spieler[playerid][lastz] = Haus[h][hZ];
- GivePlayerMoney(playerid, -Haus[h][preis]);
- Haus[h][bereit] = 1;
- DestroyPickup(Haus[h][Pickup]);
- Delete3DTextLabel(Haus[h][hlabel]);
- strmid(Haus[h][besitzer], pName,0, sizeof(pName)-1, MAX_PLAYER_NAME);
- format(string,sizeof string,"Besitzer: %s\nLevel: %d\nPreis: %d $\nPremiumpunkte: %d",Haus[h][besitzer],Haus[h][level],Haus[h][preis],Haus[h][punkte]);
- Haus[h][hlabel] = Create3DTextLabel(string,COLOR_WHITE,Haus[h][hX],Haus[h][hY],Haus[h][hZ]+0.75,40.0,0,1);
- Haus[h][Pickup] = CreatePickup(1272, 1, Haus[h][hX], Haus[h][hY], Haus[h][hZ], -1);
- }
- }
- }
- return 1;
- }
- CMD:hauschange(playerid, params[])
- {
- if(Spieler[playerid][admin] >=1)
- {
- for(new h = 1,sUnterbefehl[16]; h < MAX_HOUSE; h ++)
- {
- if(IsPlayerInRangeOfPoint(playerid,5.0,Haus[h][hX],Haus[h][hY],Haus[h][hZ]) && Haus[h][bereit] == 0)
- {
- if(sscanf(params,"s",sUnterbefehl)){
- SendClientMessage(playerid,COLOR_RED,"Benutze: /hkaufen [Nutzbar/Interior]");
- }
- if(strfind(sUnterbefehl, "Nutzbar", true) != -1)
- {
- SendClientMessage(playerid,COLOR_GREY,"Es sind derzeit folgende Interior nutzbar:");
- SendClientMessage(playerid,COLOR_GREY,"ID: 1a|1b|2a|2b|3|5a|5b|5c|8a|8b|9|10a|10b|12|15|");
- }
- else if(strfind(sUnterbefehl, "1a", true) != -1)
- {
- Haus[h][interior] = 1;
- Haus[h][hX2] = 2535.83;
- Haus[h][hY2] = -1674.32;
- Haus[h][hZ2] = 1015.50;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 1a.");
- }
- else if(strfind(sUnterbefehl, "1b", true) != -1)
- {
- Haus[h][interior] = 1;
- Haus[h][hX2] = -2158.72;
- Haus[h][hY2] = 641.29;
- Haus[h][hZ2] = 1052.38;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 1b.");
- }
- else if(strfind(sUnterbefehl, "2a", true) != -1)
- {
- Haus[h][interior] = 2;
- Haus[h][hX2] = 2567.52;
- Haus[h][hY2] = -1294.59;
- Haus[h][hZ2] = 1063.25;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 2a.");
- }
- else if(strfind(sUnterbefehl, "3", true) != -1)
- {
- Haus[h][interior] = 3;
- Haus[h][hX2] = 2496.65;
- Haus[h][hY2] = -1696.55;
- Haus[h][hZ2] = 1014.74;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 3.");
- }
- else if(strfind(sUnterbefehl, "5a", true) != -1)
- {
- Haus[h][interior] = 5;
- Haus[h][hX2] = 2338.32;
- Haus[h][hY2] = -1180.61;
- Haus[h][hZ2] = 1027.98;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 5a.");
- }
- else if(strfind(sUnterbefehl, "5b", true) != -1)
- {
- Haus[h][interior] = 5;
- Haus[h][hX2] = 318.565;
- Haus[h][hY2] = 1115.210;
- Haus[h][hZ2] = 1082.98;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 5b.");
- }
- else if(strfind(sUnterbefehl, "5c", true) != -1)
- {
- Haus[h][interior] = 5;
- Haus[h][hX2] = 1299.14;
- Haus[h][hY2] = -794.77;
- Haus[h][hZ2] = 1084.00;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 5c.");
- }
- else if(strfind(sUnterbefehl, "8a", true) != -1)
- {
- Haus[h][interior] = 8;
- Haus[h][hX2] = 2807.63;
- Haus[h][hY2] = -1170.15;
- Haus[h][hZ2] = 1025.57;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 8a.");
- }
- else if(strfind(sUnterbefehl, "8b", true) != -1)
- {
- Haus[h][interior] = 8;
- Haus[h][hX2] = 2365.42;
- Haus[h][hY2] = -1131.85;
- Haus[h][hZ2] = 1050.88;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 8b.");
- }
- else if(strfind(sUnterbefehl, "9", true) != -1)
- {
- Haus[h][interior] = 9;
- Haus[h][hX2] = 2251.85;
- Haus[h][hY2] = -1138.16;
- Haus[h][hZ2] = 1050.63;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 9.");
- }
- else if(strfind(sUnterbefehl, "10a", true) != -1)
- {
- Haus[h][interior] = 10;
- Haus[h][hX2] = 2260.76;
- Haus[h][hY2] = -1210.45;
- Haus[h][hZ2] = 1049.02;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 10a.");
- }
- else if(strfind(sUnterbefehl, "10b", true) != -1)
- {
- Haus[h][interior] = 10;
- Haus[h][hX2] = 2262.83;
- Haus[h][hY2] = -1137.71;
- Haus[h][hZ2] = 1050.63;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 10b.");
- }
- else if(strfind(sUnterbefehl, "12", true) != -1)
- {
- Haus[h][interior] = 10;
- Haus[h][hX2] = 2324.33;
- Haus[h][hY2] = -1144.79;
- Haus[h][hZ2] = 1050.71;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 12.");
- }
- else if(strfind(sUnterbefehl, "15", true) != -1)
- {
- Haus[h][interior] = 15;
- Haus[h][hX2] = 2220.26;
- Haus[h][hY2] = -1148.01;
- Haus[h][hZ2] = 1025.80;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 15.");
- }
- else if(strfind(sUnterbefehl, "2b", true) != -1)
- {
- Haus[h][interior] = 2;
- Haus[h][hX2] = 2451.77;
- Haus[h][hY2] = -1699.80;
- Haus[h][hZ2] = 1013.51;
- SendClientMessage(playerid,COLOR_GREEN,"Das Interior ist jetzt ID 2b.");
- }
- Haus[h][Pickup2] = CreatePickup(1559,1,Haus[h][hX2],Haus[h][hY2],Haus[h][hZ2],-1);
- }
- }
- }
- return 1;
- }
- CMD:chaus(playerid, params[])
- {
- if(Spieler[playerid][admin] >2)
- {
- new hlevel,hpunkte,hpreis;
- if(sscanf(params,"iii",hlevel,hpunkte,hpreis))
- SendClientMessage(playerid,COLOR_RED,"Benutze: /chaus [Level] [Premiumpunkte] [Preis]");
- else if(hlevel < 1 || hlevel > 50) SendClientMessage(playerid,COLOR_RED,"Es sind nur Level zwischen 1-50 erlaubt.");
- else
- {
- new Haus1,string[125];
- for(new i; i < MAX_HOUSE; i++)
- {
- if(Haus[i][hX] == 0.0 && i >=1)
- {
- Haus1 = i;
- break;
- }
- }
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid,X,Y,Z);
- Haus[Haus1][Pickup] = CreatePickup(1273, 1, X, Y, Z, -1);
- Haus[Haus1][ID] = Haus1;
- Haus[Haus1][hX] = X;
- Haus[Haus1][hY] = Y;
- Haus[Haus1][hZ] = Z;
- printf("X %.1f ; Y %.1f; Z %.1f",X,Y,Z);
- printf("X %.1f ; Y %.1f; Z %.1f",Haus[Haus1][hX],Haus[Haus1][hY],Haus[Haus1][hZ]);
- Haus[Haus1][level] = hlevel;
- Haus[Haus1][punkte] = hpunkte;
- Haus[Haus1][preis] = hpreis;
- Haus[Haus1][bereit] = 0;
- format(string,sizeof string,"Besitzer: KEINER\nLevel: %d\nPreis: %d $\nPremiumpunkte: %d\n/kaufen",Haus[Haus1][level],Haus[Haus1][preis],Haus[Haus1][punkte]);
- Create3DTextLabel(string,COLOR_WHITE,Haus[Haus1][hX],Haus[Haus1][hY],Haus[Haus1][hZ]+0.75,40.0,0,1);
- SpeicherHaus(Haus1);
- }
- }
- return 1;
- }
- CMD:giveadmin(playerid,params[])
- {
- if(Spieler[playerid][admin] >= 2|| IsPlayerAdmin(playerid))
- {
- new pID, rangA, Nachricht[125];
- if(sscanf(params,"ui",pID,rangA)){
- return SendClientMessage(playerid,COLOR_RED,"Benutze: /giveadmin [playerid/name] [rang]");}
- else if (rangA < 0 || rangA > 5){ SendClientMessage(playerid, COLOR_RED, "Es sind nur Ränge zwischen 0-5 erlaubt.");}
- else if(!IsPlayerConnected(pID)){ SendClientMessage(playerid, COLOR_RED, "Dieser User ist nicht online.");}
- Spieler[pID][admin] = rangA;
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- format(Nachricht, sizeof(Nachricht), "%s hat die deinen Admin Rang auf %d gesetzt",pName,rangA);
- SendClientMessage(pID,COLOR_GREY,Nachricht);
- GetPlayerName(pID,pName,MAX_PLAYER_NAME);
- format(Nachricht, sizeof(Nachricht), "Du hast %s den Admin Rang auf %d gesetzt",pName,rangA);
- SendClientMessage(playerid,COLOR_GREY,Nachricht);
- SpeicherUser(pID);
- }
- return 1;
- }
- CMD:vehicle(playerid,params[])
- {
- if(Spieler[playerid][admin] >= 2)
- {
- new modell, Fahrzeug;
- if(sscanf(params,"i",modell)){
- return SendClientMessage(playerid,COLOR_RED,"Benutze: /vehicle [Modell]");}
- else if (modell < 399 || modell > 612){ SendClientMessage(playerid, COLOR_RED, "Es sind nur Modelle zwischen 400-611 erlaubt.");}
- else
- {
- for(new i; i < MAX_VEHICLES; i++)
- {
- if(Auto[i][aX] == 0.0 && i >=1)
- {
- Fahrzeug = i;
- break;
- }
- }
- new Float:X,Float:Y,Float:Z,Float:Angle;
- GetPlayerPos(playerid,X,Y,Z);
- GetPlayerFacingAngle(playerid,Angle);
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- CreateVehicle(modell,X+3,Y,Z,Angle,0,0,-1);
- SendClientMessage(playerid,COLOR_YELLOW,"Das Fahrzeug wurde erstellt.");
- Auto[Fahrzeug][aID] = Fahrzeug;
- Auto[Fahrzeug][aX] = X;
- Auto[Fahrzeug][aY] = Y;
- Auto[Fahrzeug][aZ] = Z;
- Auto[Fahrzeug][aAngle] = Angle;
- SpeicherFahrzeug(Fahrzeug);
- }
- }
- return 1;
- }
- stock sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- stringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (string[stringPos] && string[stringPos] <= ' ')
- {
- stringPos++;
- }
- 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 ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = string[stringPos];
- do
- {
- 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));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, string[stringPos++]);
- }
- case 'f':
- {
- new changestr[16], changepos = 0, strpos = stringPos;
- while(changepos < 16 && string[strpos] && string[strpos] != delim)
- {
- changestr[changepos++] = string[strpos++];
- }
- changestr[changepos] = '\0';
- setarg(paramPos,0,_:floatstr(changestr));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- stringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = stringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = string[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - stringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, string[stringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- stringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = string[stringPos++]) && ch != delim)
- {
- 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] != delim && string[stringPos] > ' ')
- {
- stringPos++;
- }
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
- {
- stringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment