Guest User

Untitled

a guest
Aug 6th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.14 KB | None | 0 0
  1. public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
  2. {
  3. switch(dialogid)
  4. {
  5. case INTERIOR_TYPWAHL:
  6. {
  7. if(!response) return false;
  8. switch(listitem)
  9. {
  10. case 0:
  11. {
  12. SetPVarInt(playerid,"HUHNFISCH_Slot",0);
  13. ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
  14. }
  15. case 1:
  16. {
  17. ShowPlayerDialog(playerid,INTERIOR_WAHL_BEDSIT,DIALOG_STYLE_LIST,"Interior auswählen","Bedsit 1\nBedsit 2\nBedsit 3\nBedsit 4\n4 Zimmer Bedsit\nZurück","Auswählen","Abbruch");
  18. return true;
  19. }
  20. case 2:
  21. {
  22. ShowPlayerDialog(playerid,INTERIOR_WAHL_APPARTMENT,DIALOG_STYLE_LIST,"Interior auswählen","2 Zimmer Apartment\n3 Zimmer Apartment {33AA33}1\n3 Zimmer Apartment {33AA33}2\n4 Zimmer Apartment {33AA33}1\n4 Zimmer Apartment {33AA33}2\n4 Zimmer Apartment {33AA33}3\n4 Zimmer Apartment {33AA33}4\n5 Zimmer Apartment {33AA33}1\n5 Zimmer Apartment {33AA33}2\nZurück","Auswählen","Abbruch");
  23. return true;
  24. }
  25. case 3:
  26. {
  27. ShowPlayerDialog(playerid,INTERIOR_WAHL_BUNGALOW,DIALOG_STYLE_LIST,"Interior auswählen","3 Zimmer Bungalow {33AA33}1\n3 Zimmer Bungalow {33AA33}2\nZurück","Auswählen","Abbruch");
  28. return true;
  29. }
  30. case 4:
  31. {
  32. ShowPlayerDialog(playerid,INTERIOR_WAHL_LUXUS,DIALOG_STYLE_LIST,"Interior auswählen","5 Zimmer Luxus\n6 Zimmer Luxus\n7 Zimmer Luxus\n8 Zimmer Luxus\n4 Zimmer Luxus\n3 Zimmer Luxus {33AA33}1\n2 Zimmer Luxus {33AA33}1\n2 Zimmer Luxus {33AA33}2\n3 Zimmer Luxus {33AA33}2\n8 Zimmer Luxus\nZurück","Auswählen","Abbruch");
  33. return true;
  34. }
  35. case 5:
  36. {
  37. ShowPlayerDialog(playerid,INTERIOR_WAHL_HAUS,DIALOG_STYLE_LIST,"Interior auswählen","4 Zimmer Haus {33AA33}1\n4 Zimmer Haus {33AA33}2\n4 Zimmer Haus {33AA33}3\n4 Zimmer Haus {33AA33}4\n5 Zimmer Haus\n6 Zimmer Haus 1\6 Zimmer Haus 2\nZurück","Auswählen","Abbruch");
  38. return true;
  39. }
  40. }
  41. return true;
  42. }
  43. case INTERIOR_WAHL_BEDSIT:
  44. {
  45. if(!response) return ocmd_hauserstellen(playerid);
  46. switch(listitem)
  47. {
  48. case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",1);
  49. case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",2);
  50. case 2: SetPVarInt(playerid,"HUHNFISCH_Slot",3);
  51. case 3: SetPVarInt(playerid,"HUHNFISCH_Slot",4);
  52. case 4: SetPVarInt(playerid,"HUHNFISCH_Slot",15);
  53. default: return ocmd_hauserstellen(playerid);
  54. }
  55. ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
  56. }
  57. case INTERIOR_WAHL_APPARTMENT:
  58. {
  59. if(!response) return ocmd_hauserstellen(playerid);
  60. switch(listitem)
  61. {
  62. case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",6);
  63. case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",9);
  64. case 2: SetPVarInt(playerid,"HUHNFISCH_Slot",10);
  65. case 3: SetPVarInt(playerid,"HUHNFISCH_Slot",11);
  66. case 4: SetPVarInt(playerid,"HUHNFISCH_Slot",13);
  67. case 5: SetPVarInt(playerid,"HUHNFISCH_Slot",14);
  68. case 6: SetPVarInt(playerid,"HUHNFISCH_Slot",17);
  69. case 7: SetPVarInt(playerid,"HUHNFISCH_Slot",20);
  70. case 8: SetPVarInt(playerid,"HUHNFISCH_Slot",23);
  71. default: return ocmd_hauserstellen(playerid);
  72. }
  73. ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
  74. }
  75. case INTERIOR_WAHL_BUNGALOW:
  76. {
  77. if(!response) return ocmd_hauserstellen(playerid);
  78. switch(listitem)
  79. {
  80. case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",7);
  81. case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",8);
  82. default: return ocmd_hauserstellen(playerid);
  83. }
  84. ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
  85. }
  86. case INTERIOR_WAHL_LUXUS:
  87. {
  88. if(!response) return ocmd_hauserstellen(playerid);
  89. switch(listitem)
  90. {
  91. case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",22);
  92. case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",25);
  93. case 2: SetPVarInt(playerid,"HUHNFISCH_Slot",27);
  94. case 3: SetPVarInt(playerid,"HUHNFISCH_Slot",28);
  95. case 4: SetPVarInt(playerid,"HUHNFISCH_Slot",29);
  96. case 5: SetPVarInt(playerid,"HUHNFISCH_Slot",30);
  97. case 6: SetPVarInt(playerid,"HUHNFISCH_Slot",31);
  98. case 7: SetPVarInt(playerid,"HUHNFISCH_Slot",32);
  99. case 8: SetPVarInt(playerid,"HUHNFISCH_Slot",33);
  100. case 9: SetPVarInt(playerid,"HUHNFISCH_Slot",34);
  101. default: return ocmd_hauserstellen(playerid);
  102. }
  103. ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
  104. }
  105. case INTERIOR_WAHL_HAUS:
  106. {
  107. if(!response) return ocmd_hauserstellen(playerid);
  108. switch(listitem)
  109. {
  110. case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",12);
  111. case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",15);
  112. case 2: SetPVarInt(playerid,"HUHNFISCH_Slot",18);
  113. case 3: SetPVarInt(playerid,"HUHNFISCH_Slot",19);
  114. case 4: SetPVarInt(playerid,"HUHNFISCH_Slot",21);
  115. case 5: SetPVarInt(playerid,"HUHNFISCH_Slot",24);
  116. case 6: SetPVarInt(playerid,"HUHNFISCH_Slot",26);
  117. default: return ocmd_hauserstellen(playerid);
  118. }
  119. ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
  120. }
  121. case HAUS_PREIS:
  122. {
  123. if(!inputtext[0]) return ocmd_hauserstellen(playerid);
  124. new preis=strval(inputtext);
  125. for(new i,l=strlen(inputtext);i!=l;i++)
  126. if(inputtext[i] >= '0' && inputtext[i] <= '9') continue;
  127. else return ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","{FF0000}Error: {A9C4E4}Ein Preis ist doch kein Text\nWie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
  128.  
  129. if(!preis) return ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","{FF0000}Error: {A9C4E4}Du musst schon einen Preis über 0 eingeben.\nWie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
  130. new Float:x,Float:y,Float:z;
  131. GetPlayerPos(playerid,x,y,z);
  132. new Slot=GetPVarInt(playerid,"HUHNFISCH_Slot");
  133. DeletePVar(playerid,"HUHNFISCH_Slot");
  134. SetPlayerMapIcon(playerid,STARTMAPICON+CreateHaus("Niemand",x,y,z,IntInfo[Slot][posx],IntInfo[Slot][posy],IntInfo[Slot][posz],IntInfo[Slot][_interior],preis),x,y,z,31,0xFFFFFFFF);
  135. return SendClientMessage(playerid,-1,"Haus erfolgreich erstellt");
  136. }
  137. }
  138. return true;
  139. }
  140. public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
  141. {
  142. if(newkeys & KEY_SECONDARY_ATTACK)
  143. {
  144. if(!GetPVarInt(playerid,"HUHNFISCH_InHaus"))
  145. {
  146. new ID=GetNearestHaus(playerid,4);
  147. if(ID==-1) return true;
  148. if(Haus[ID][Abgeschlossen]) return true;
  149. SetPlayerInterior(playerid,Haus[ID][Int]);
  150. SetPlayerPos(playerid,Haus[ID][Pos][3],Haus[ID][Pos][4],Haus[ID][Pos][5]);
  151. SetPlayerVirtualWorld(playerid,Haus[ID][VirtualWorld]);
  152. SetPVarInt(playerid,"HUHNFISCH_InHaus",true);
  153. return true;
  154. }
  155. new ID=GetNearestHausExit(playerid,3);
  156. if(ID==-1) return true;
  157. SetPlayerInterior(playerid,0);
  158. SetPlayerPos(playerid,Haus[ID][Pos][0],Haus[ID][Pos][1],Haus[ID][Pos][2]);
  159. SetPlayerVirtualWorld(playerid,0);
  160. DeletePVar(playerid,"HUHNFISCH_InHaus");
  161. return true;
  162. }
  163. return true;
  164. }
  165. GetFreeHausID()
  166. {
  167. for(new i;i!=MAX_HAUSER;i++) if(!Haus[i][Int]) return i;
  168. return -1;
  169. }
  170. GetFreeInteriorVW(interior)
  171. {
  172. new VW;
  173. for(new i;i!=10000;i++)
  174. {
  175. for(new j;j!=MAX_HAUSER;j++) if(Haus[j][Int]==interior&&Haus[j][VirtualWorld]!=i) { VW=i; break; }
  176. if(VW) return i;
  177. }
  178. return -1;
  179. }
  180. GetNearestHaus(playerid, Float:dist = 12.0)
  181. {
  182. new Float:tmpdist = dist,Float:x,Float:y,Float:z;
  183. new Float:tempdist,ID=-1;
  184. for(new i;i!=MAX_HAUSER;i++)
  185. {
  186. if(!Haus[i][Int]) continue;
  187. GetPlayerPos(playerid,x,y,z);
  188. tempdist = GetPlayerDistanceFromPoint(playerid,Haus[i][Pos][0],Haus[i][Pos][1],Haus[i][Pos][2]);
  189. if(tempdist < tmpdist) tmpdist=tempdist,ID=i;
  190. }
  191. return ID;
  192. }
  193. GetNearestHausExit(playerid, Float:dist = 12.0)
  194. {
  195. new Float:tmpdist = dist,Float:x,Float:y,Float:z;
  196. new Float:tempdist,ID=-1;
  197. for(new i;i!=MAX_HAUSER;i++)
  198. {
  199. if(!Haus[i][Int]||Haus[i][VirtualWorld]!=GetPlayerVirtualWorld(playerid)) continue;
  200. GetPlayerPos(playerid,x,y,z);
  201. tempdist = GetPlayerDistanceFromPoint(playerid,Haus[i][Pos][3],Haus[i][Pos][4],Haus[i][Pos][5]);
  202. if(tempdist < tmpdist) tmpdist=tempdist,ID=i;
  203. }
  204. return ID;
  205. }
  206. StripNL(str[]) /* Credits to Y_Less */
  207. {
  208. new l=strlen(str);
  209. while(l--&&str[l]<=' ')str[l]='\0';
  210. }
Advertisement
Add Comment
Please, Sign In to add comment