T4125Gamer

Dreamlife Roleplay createhouse

Jan 8th, 2019
134
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Oben ins Script
  2. new bool:playerCreateHaus[MAX_PLAYERS] = false, playerCreateStatus[MAX_PLAYERS] = -1;
  3.  
  4. //Unten ins Script
  5. stock cHausWrite(playerid){
  6.     if(!playerCreateHaus[playerid] && playerCreateStatus[playerid] == -1)return 1;
  7.         new coordsstring[256], idx;
  8.         format(coordsstring, sizeof(coordsstring), "%f,%f,%f,%f,%f,%f,0,0,0,0,0,0,Zu Verkaufen,DESCRIPTION,%d,0,0,1,1,0,0,50,1,2045,542,-1,-1,114,%d\n",
  9.         GetPVarFloat(playerid, "C_HAUS_E_X"),
  10.         GetPVarFloat(playerid, "C_HAUS_E_Y"),
  11.         GetPVarFloat(playerid, "C_HAUS_E_Z"),
  12.         GetPVarFloat(playerid, "C_HAUS_A_X"),
  13.         GetPVarFloat(playerid, "C_HAUS_A_Y"),
  14.         GetPVarFloat(playerid, "C_HAUS_A_Z"),
  15.         GetPVarInt(playerid, "C_HAUS_PREIS"),
  16.         GetPVarInt(playerid, "C_HAUS_INTERIOR"),
  17.         GetPVarInt(playerid, "C_HAUS_LEVEL"));
  18.         new File: file = fopen("property.cfg", io_append);
  19.         fwrite(file, coordsstring);
  20.         playerCreateHaus[playerid] = false;
  21.         playerCreateStatus[playerid] = -1;
  22.         SetPlayerPos(playerid, GetPVarFloat(playerid, "C_HAUS_E_X"),GetPVarFloat(playerid, "C_HAUS_E_Y"),GetPVarFloat(playerid, "C_HAUS_E_Z"));
  23.         SetPlayerInterior(playerid, 0);
  24.         SendClientMessage(playerid, -1, "Haus erfolgreich erstellt!");
  25.         for(new i = 1; i<sizeof(HouseInfo); i++){
  26.             if(HouseInfo[i][hEntrancex] != 0.0){
  27.                 continue;
  28.             }else{
  29.                 idx = i;
  30.                 HouseInfo[idx][hEntrancex] = GetPVarFloat(playerid, "C_HAUS_E_X");
  31.                 HouseInfo[idx][hEntrancey] = GetPVarFloat(playerid, "C_HAUS_E_Y");
  32.                 HouseInfo[idx][hEntrancez] = GetPVarFloat(playerid, "C_HAUS_E_Z");
  33.                 HouseInfo[idx][hExitx] = GetPVarFloat(playerid, "C_HAUS_A_X");
  34.                 HouseInfo[idx][hExity] = GetPVarFloat(playerid, "C_HAUS_A_Y");
  35.                 HouseInfo[idx][hExitz] = GetPVarFloat(playerid, "C_HAUS_A_Z");
  36.                 HouseInfo[idx][hHealthx] = 0;
  37.                 HouseInfo[idx][hHealthy] = 0;
  38.                 HouseInfo[idx][hHealthz] = 0;
  39.                 HouseInfo[idx][hArmourx] = 0;
  40.                 HouseInfo[idx][hArmoury] = 0;
  41.                 HouseInfo[idx][hArmourz] = 0;
  42.                 format(HouseInfo[idx][hOwner], MAX_PLAYER_NAME, "Niemand");
  43.                 format(HouseInfo[idx][hDiscription], MAX_PLAYER_NAME, "Niemand");
  44.                 HouseInfo[idx][hValue] = GetPVarInt(playerid, "C_HAUS_PREIS");
  45.                 HouseInfo[idx][hHel] = 0;
  46.                 HouseInfo[idx][hArm] = 0;
  47.                 HouseInfo[idx][hInt] = GetPVarInt(playerid, "C_HAUS_INTERIOR");
  48.                 HouseInfo[idx][hLock] = 1;
  49.                 HouseInfo[idx][hOwned] = 0;
  50.                 HouseInfo[idx][hRooms] = 0;
  51.                 HouseInfo[idx][hRent] = 0;
  52.                 HouseInfo[idx][hRentabil] = 50;
  53.                 HouseInfo[idx][hTakings] = 0;
  54.                 HouseInfo[idx][hVec] = 0;
  55.                 HouseInfo[idx][hVcol1] = 0;
  56.                 HouseInfo[idx][hVcol2] = 0;
  57.                 HouseInfo[idx][hDate] = 142;
  58.                 HouseInfo[idx][hLevel] = GetPVarInt(playerid, "C_HAUS_LEVEL");
  59.                 new string2[250];
  60.                 format(string2, sizeof(string2), "[Haus zu verkaufen - %s]\nPreis: $%d\nLevel: %d\n/buyhouse zum kaufen",HouseInfo[idx][hDiscription],HouseInfo[idx][hValue],HouseInfo[idx][hLevel]);
  61.                 HouseInfo[idx][Text] = Create3DTextLabel(string2,COLOR_FORSELL,HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez]+1,15.0,0);
  62.                 AddStaticPickup(1273, 1, HouseInfo[idx][hEntrancex], HouseInfo[idx][hEntrancey], HouseInfo[idx][hEntrancez], 0);
  63.                 break;
  64.             }
  65.         }
  66.     return 1;
  67. }
  68.  
  69. //Bei den OCMD Commands
  70. ocmd:chaus(playerid, params[]){
  71.     new status;
  72.     if(sscanf(params, "d", status))return SendClientMessage(playerid, -1, "Benutze: /chaus [1 = ON | 2 = OFF]");
  73.     if(status == 1){
  74.         SendClientMessage(playerid, -1, "Das Haus erstellen System wurde aktiviert.");
  75.         playerCreateStatus[playerid] = 1;
  76.         playerCreateHaus[playerid] = true;
  77.         SendClientMessage(playerid, -1, "Gehe nun an einen Punkt und tippe erneute /createhouse um den Eingang festzulegen!");
  78.     }else{
  79.         SendClientMessage(playerid, -1, "Das Haus erstellen System wurde deaktiviert.");
  80.         playerCreateStatus[playerid] = -1;
  81.         playerCreateHaus[playerid] = false;
  82.     }
  83.     return 1;
  84. }
  85. ocmd:createhouse(playerid, params[]){
  86.     if(playerCreateStatus[playerid] == -1 && !playerCreateHaus[playerid]){
  87.         return 1;
  88.     }else{
  89.         switch(playerCreateStatus[playerid]){
  90.             case 1:{//Eingangs Coordinaten speichern
  91.                 new Float:X, Float:Y, Float:Z;
  92.                 GetPlayerPos(playerid, X, Y, Z);
  93.                 SetPVarFloat(playerid, "C_HAUS_E_X", X);
  94.                 SetPVarFloat(playerid, "C_HAUS_E_Y", Y);
  95.                 SetPVarFloat(playerid, "C_HAUS_E_Z", Z);
  96.                 SendClientMessage(playerid, -1, "");
  97.                 SendClientMessage(playerid, -1, "");
  98.                 SendClientMessage(playerid, -1, "Gehe nun auf 'http://weedarr.wikidot.com/interior' und suche dir ein Interior heraus!");
  99.                 SendClientMessage(playerid, -1, "Setze dein Interior mit /setint auf die richtige ID!");
  100.                 SendClientMessage(playerid, -1, "Benutze dann /gotocoords x y z um dich in das Interior zu teleportieren!");
  101.                 playerCreateStatus[playerid] = 2;
  102.                 SendClientMessage(playerid, -1, "Tippe dann wieder /createhouse in den Chat!");
  103.             }
  104.             case 2:{//Ausgangs Coordinaten speichern
  105.                 new Float:X, Float:Y, Float:Z;
  106.                 GetPlayerPos(playerid, X, Y, Z);
  107.                 new interiorid = GetPlayerInterior(playerid);
  108.                 SetPVarFloat(playerid, "C_HAUS_A_X", X);
  109.                 SetPVarFloat(playerid, "C_HAUS_A_Y", Y);
  110.                 SetPVarFloat(playerid, "C_HAUS_A_Z", Z);
  111.                 SetPVarInt(playerid, "C_HAUS_INTERIOR", interiorid);
  112.                 playerCreateStatus[playerid] = 3;
  113.                 SendClientMessage(playerid, -1, "");
  114.                 SendClientMessage(playerid, -1, "");
  115.                 SendClientMessage(playerid, -1, "Gebe nun den Preis für das Haus ein! /createhouse [preis]");
  116.             }
  117.             case 3:{
  118.                 new preis;
  119.                 if(sscanf(params, "d", preis))return SendClientMessage(playerid, -1, "Benutze: /createhouse [preis]");
  120.                 if(preis <= -1)return SendClientMessage(playerid, -1, "Der Preis kann nicht im Minusbereich liegen!");
  121.                 SetPVarInt(playerid, "C_HAUS_PREIS", preis);
  122.                 playerCreateStatus[playerid] = 4;
  123.                 SendClientMessage(playerid, -1, "");
  124.                 SendClientMessage(playerid, -1, "");
  125.                 SendClientMessage(playerid, -1, "Gebe nun ein Level ein ab dem dieses Haus zu kaufen ist! /createhouse [level]");
  126.             }
  127.             case 4:{
  128.                 new level;
  129.                 if(sscanf(params, "d", level))return SendClientMessage(playerid, -1, "Benutze: /createhouse [level]");
  130.                 if(level <= -1)return SendClientMessage(playerid, -1, "Das Level kann nicht im Minusbereich liegen!");
  131.                 SendClientMessage(playerid, -1, "");
  132.                 SendClientMessage(playerid, -1, "");
  133.                 SetPVarInt(playerid, "C_HAUS_LEVEL", level);
  134.                 cHausWrite(playerid);
  135.             }
  136.         }
  137.     }
  138.     return 1;
  139. }
  140. ocmd:gotocoords(playerid, params[]){
  141.     new Float:X, Float:Y, Float:Z;
  142.     if(sscanf(params, "fff", X, Y, Z))return SendClientMessage(playerid, -1, "Benutze: /gotocoords x y z");
  143.     SetPlayerPos(playerid, X, Y, Z);
  144.     return 1;
  145. }
RAW Paste Data