Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
- {
- switch(dialogid)
- {
- case INTERIOR_TYPWAHL:
- {
- if(!response) return false;
- switch(listitem)
- {
- case 0:
- {
- SetPVarInt(playerid,"HUHNFISCH_Slot",0);
- ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
- }
- case 1:
- {
- 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");
- return true;
- }
- case 2:
- {
- 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");
- return true;
- }
- case 3:
- {
- 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");
- return true;
- }
- case 4:
- {
- 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");
- return true;
- }
- case 5:
- {
- 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");
- return true;
- }
- }
- return true;
- }
- case INTERIOR_WAHL_BEDSIT:
- {
- if(!response) return ocmd_hauserstellen(playerid);
- switch(listitem)
- {
- case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",1);
- case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",2);
- case 2: SetPVarInt(playerid,"HUHNFISCH_Slot",3);
- case 3: SetPVarInt(playerid,"HUHNFISCH_Slot",4);
- case 4: SetPVarInt(playerid,"HUHNFISCH_Slot",15);
- default: return ocmd_hauserstellen(playerid);
- }
- ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
- }
- case INTERIOR_WAHL_APPARTMENT:
- {
- if(!response) return ocmd_hauserstellen(playerid);
- switch(listitem)
- {
- case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",6);
- case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",9);
- case 2: SetPVarInt(playerid,"HUHNFISCH_Slot",10);
- case 3: SetPVarInt(playerid,"HUHNFISCH_Slot",11);
- case 4: SetPVarInt(playerid,"HUHNFISCH_Slot",13);
- case 5: SetPVarInt(playerid,"HUHNFISCH_Slot",14);
- case 6: SetPVarInt(playerid,"HUHNFISCH_Slot",17);
- case 7: SetPVarInt(playerid,"HUHNFISCH_Slot",20);
- case 8: SetPVarInt(playerid,"HUHNFISCH_Slot",23);
- default: return ocmd_hauserstellen(playerid);
- }
- ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
- }
- case INTERIOR_WAHL_BUNGALOW:
- {
- if(!response) return ocmd_hauserstellen(playerid);
- switch(listitem)
- {
- case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",7);
- case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",8);
- default: return ocmd_hauserstellen(playerid);
- }
- ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
- }
- case INTERIOR_WAHL_LUXUS:
- {
- if(!response) return ocmd_hauserstellen(playerid);
- switch(listitem)
- {
- case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",22);
- case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",25);
- case 2: SetPVarInt(playerid,"HUHNFISCH_Slot",27);
- case 3: SetPVarInt(playerid,"HUHNFISCH_Slot",28);
- case 4: SetPVarInt(playerid,"HUHNFISCH_Slot",29);
- case 5: SetPVarInt(playerid,"HUHNFISCH_Slot",30);
- case 6: SetPVarInt(playerid,"HUHNFISCH_Slot",31);
- case 7: SetPVarInt(playerid,"HUHNFISCH_Slot",32);
- case 8: SetPVarInt(playerid,"HUHNFISCH_Slot",33);
- case 9: SetPVarInt(playerid,"HUHNFISCH_Slot",34);
- default: return ocmd_hauserstellen(playerid);
- }
- ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
- }
- case INTERIOR_WAHL_HAUS:
- {
- if(!response) return ocmd_hauserstellen(playerid);
- switch(listitem)
- {
- case 0: SetPVarInt(playerid,"HUHNFISCH_Slot",12);
- case 1: SetPVarInt(playerid,"HUHNFISCH_Slot",15);
- case 2: SetPVarInt(playerid,"HUHNFISCH_Slot",18);
- case 3: SetPVarInt(playerid,"HUHNFISCH_Slot",19);
- case 4: SetPVarInt(playerid,"HUHNFISCH_Slot",21);
- case 5: SetPVarInt(playerid,"HUHNFISCH_Slot",24);
- case 6: SetPVarInt(playerid,"HUHNFISCH_Slot",26);
- default: return ocmd_hauserstellen(playerid);
- }
- ShowPlayerDialog(playerid,HAUS_PREIS,DIALOG_STYLE_INPUT,"Kauf Preis","Wie hoch soll der Kaufpreis für dieses Haus sein?","OK","Zurück");
- }
- case HAUS_PREIS:
- {
- if(!inputtext[0]) return ocmd_hauserstellen(playerid);
- new preis=strval(inputtext);
- for(new i,l=strlen(inputtext);i!=l;i++)
- if(inputtext[i] >= '0' && inputtext[i] <= '9') continue;
- 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");
- 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");
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- new Slot=GetPVarInt(playerid,"HUHNFISCH_Slot");
- DeletePVar(playerid,"HUHNFISCH_Slot");
- 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);
- return SendClientMessage(playerid,-1,"Haus erfolgreich erstellt");
- }
- }
- return true;
- }
- public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
- {
- if(newkeys & KEY_SECONDARY_ATTACK)
- {
- if(!GetPVarInt(playerid,"HUHNFISCH_InHaus"))
- {
- new ID=GetNearestHaus(playerid,4);
- if(ID==-1) return true;
- if(Haus[ID][Abgeschlossen]) return true;
- SetPlayerInterior(playerid,Haus[ID][Int]);
- SetPlayerPos(playerid,Haus[ID][Pos][3],Haus[ID][Pos][4],Haus[ID][Pos][5]);
- SetPlayerVirtualWorld(playerid,Haus[ID][VirtualWorld]);
- SetPVarInt(playerid,"HUHNFISCH_InHaus",true);
- return true;
- }
- new ID=GetNearestHausExit(playerid,3);
- if(ID==-1) return true;
- SetPlayerInterior(playerid,0);
- SetPlayerPos(playerid,Haus[ID][Pos][0],Haus[ID][Pos][1],Haus[ID][Pos][2]);
- SetPlayerVirtualWorld(playerid,0);
- DeletePVar(playerid,"HUHNFISCH_InHaus");
- return true;
- }
- return true;
- }
- GetFreeHausID()
- {
- for(new i;i!=MAX_HAUSER;i++) if(!Haus[i][Int]) return i;
- return -1;
- }
- GetFreeInteriorVW(interior)
- {
- new VW;
- for(new i;i!=10000;i++)
- {
- for(new j;j!=MAX_HAUSER;j++) if(Haus[j][Int]==interior&&Haus[j][VirtualWorld]!=i) { VW=i; break; }
- if(VW) return i;
- }
- return -1;
- }
- GetNearestHaus(playerid, Float:dist = 12.0)
- {
- new Float:tmpdist = dist,Float:x,Float:y,Float:z;
- new Float:tempdist,ID=-1;
- for(new i;i!=MAX_HAUSER;i++)
- {
- if(!Haus[i][Int]) continue;
- GetPlayerPos(playerid,x,y,z);
- tempdist = GetPlayerDistanceFromPoint(playerid,Haus[i][Pos][0],Haus[i][Pos][1],Haus[i][Pos][2]);
- if(tempdist < tmpdist) tmpdist=tempdist,ID=i;
- }
- return ID;
- }
- GetNearestHausExit(playerid, Float:dist = 12.0)
- {
- new Float:tmpdist = dist,Float:x,Float:y,Float:z;
- new Float:tempdist,ID=-1;
- for(new i;i!=MAX_HAUSER;i++)
- {
- if(!Haus[i][Int]||Haus[i][VirtualWorld]!=GetPlayerVirtualWorld(playerid)) continue;
- GetPlayerPos(playerid,x,y,z);
- tempdist = GetPlayerDistanceFromPoint(playerid,Haus[i][Pos][3],Haus[i][Pos][4],Haus[i][Pos][5]);
- if(tempdist < tmpdist) tmpdist=tempdist,ID=i;
- }
- return ID;
- }
- StripNL(str[]) /* Credits to Y_Less */
- {
- new l=strlen(str);
- while(l--&&str[l]<=' ')str[l]='\0';
- }
Advertisement
Add Comment
Please, Sign In to add comment