Guest User

Nachtclubs by varreZ

a guest
Nov 19th, 2013
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.62 KB | None | 0 0
  1. /* Nachtclub by varreZ.de - 19.11.2013 */
  2.  
  3. #include <a_samp>
  4. #include <ocmd>
  5.  
  6. #define DIALOG_DJ 9990
  7. #define DIALOG_SENDER 9991
  8. #define DIALOG_DIREKT 9992
  9.  
  10. #define COLOR_WHITE 0xFFFFFFFFF
  11.  
  12. new IsDJ[MAX_PLAYERS] = 0;
  13. new DJObjects[4][MAX_PLAYERS];
  14. new bool:DJcp[MAX_PLAYERS];
  15.  
  16. enum Nachtclubs {
  17.     Float:nX, //EingangX
  18.     Float:nY, //EingangY
  19.     Float:nZ, //EingangZ
  20.     Float:nAX, //AusgangX
  21.     Float:nAY, //AusgangY
  22.     Float:nAZ, //AusgangZ
  23.     Float:nDX, //DutyPunktX
  24.     Float:nDY, //DutyPunktY
  25.     Float:nDZ, //DutyPunktZ
  26.     nInt, //Interior
  27.     nVWorld, //VirtualWorld
  28.     nTitle[128], //Nachtclub Name
  29.     nPreis //Nachtclub Eintrittspreis
  30. }
  31. new nClub[0][Nachtclubs] = {
  32.     {1022.4595,-1122.6289,23.8709,493.390991,-22.722799,1000.679687,495.9022,-3.9414,1002.0781,17,0,"Nachtclub",500}
  33. };
  34.  
  35. public OnFilterScriptInit()
  36. {
  37.     print("\n--------------------------------------");
  38.     print(" Nachtclub by varreZ (varrez.de) geladen!");
  39.     print("--------------------------------------\n");
  40.     for(new nc = 0; nc <sizeof(nClub); nc++){
  41.         new icon[64];
  42.         CreatePickup(1239, 23, nClub[nc][nX], nClub[nc][nY], nClub[nc][nZ]);
  43.         Create3DTextLabel("Taste 'Enter' um als DJ aufzulegen!", COLOR_WHITE, nClub[nc][nDX], nClub[nc][nDY], nClub[nc][nDZ], 5.0, 0);
  44.         CreatePickup(1239, 23, nClub[nc][nDX], nClub[nc][nDY], nClub[nc][nDZ]);
  45.         format(icon, sizeof(icon), "%s\nEintritt: %d\nZum Betreten: [ Enter ]", nClub[nc][nTitle], nClub[nc][nPreis]);
  46.         Create3DTextLabel(icon, COLOR_WHITE, nClub[nc][nX], nClub[nc][nY], nClub[nc][nZ], 5.0, 0);
  47.     }
  48.     return 1;
  49. }
  50.  
  51. public OnFilterScriptExit(){
  52.     return 1;
  53. }
  54. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
  55.     if(newkeys & 16){
  56.         for(new i = 0; i < sizeof(nClub); i++){
  57.             if(IsPlayerInRangeOfPoint(playerid,3.0,nClub[i][nX],nClub[i][nY],nClub[i][nZ])){
  58.                 SetPlayerVirtualWorld(playerid, nClub[i][nVWorld]);
  59.                 SetPlayerInterior(playerid, nClub[i][nInt]);
  60.                 SetPlayerPos(playerid, nClub[i][nAX], nClub[i][nAY], nClub[i][nAZ]);
  61.                 GivePlayerMoney(playerid, -nClub[i][nPreis]);
  62.             }
  63.             if(IsPlayerInRangeOfPoint(playerid,3.0,nClub[i][nAX], nClub[i][nAY], nClub[i][nAZ]) && GetPlayerVirtualWorld(playerid) == nClub[i][nVWorld]){
  64.                 SetPlayerVirtualWorld(playerid, 0);
  65.                 SetPlayerInterior(playerid, 0);
  66.                 SetPlayerPos(playerid, nClub[i][nX],nClub[i][nY],nClub[i][nZ]);
  67.             }
  68.             if(IsPlayerInRangeOfPoint(playerid, 3.0, nClub[i][nDX], nClub[i][nDY], nClub[i][nDZ])){
  69.                 for(new p = 0; p<MAX_PLAYERS; p++){
  70.                     if(IsDJ[p] == 1 && GetPlayerVirtualWorld(p) == nClub[i][nVWorld]){
  71.                         SendClientMessage(p, COLOR_WHITE, "Hier ist aktuell schon ein DJ am auflegen!");
  72.                     }
  73.                 }
  74.                 if(IsDJ[playerid] == 0 && GetPlayerVirtualWorld(playerid) == nClub[i][nVWorld]){
  75.                     DJObjects[0][playerid] = CreateObject(3383, 487.5, -2.7999999523163, 1001.4000244141, 0, 0, 0);
  76.                     DJObjects[1][playerid] = CreateObject(1954, 486.29998779297, -2.9000000953674, 1002.5999755859, 0, 0, 0);
  77.                     DJObjects[2][playerid] = CreateObject(14820, 487.89999389648, -2.5, 1002.5999755859, 0, 0, 0);
  78.                     DJObjects[3][playerid] = CreateObject(14820, 487.89999389648, -3.2000000476837, 1002.5999755859, 0, 0, 0);
  79.                     SendClientMessage(playerid, COLOR_WHITE, "Du bist nun DJ in diesem Nachtclub! Laufe zum Roten Checkpoint.");
  80.                     SetPlayerCheckpoint(playerid, 487.3483,-1.6183,1002.3828,3.0);
  81.                     DJcp[playerid] = true;
  82.                     IsDJ[playerid] = 1;
  83.                 }
  84.                 else {
  85.                     DestroyObject(DJObjects[0][playerid]);
  86.                     DestroyObject(DJObjects[1][playerid]);
  87.                     DestroyObject(DJObjects[2][playerid]);
  88.                     DestroyObject(DJObjects[3][playerid]);
  89.                     SendClientMessage(playerid, COLOR_WHITE, "Du hast dein Eqiupment abgebaut.");
  90.                     IsDJ[playerid] = 0;
  91.                 }
  92.             }
  93.         }
  94.     }
  95.     return 1;
  96. }
  97. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  98.     switch(dialogid){
  99.         case DIALOG_DJ: {
  100.             if(response == 0) {}
  101.             if(response == 1) {
  102.                 switch(listitem){
  103.                     case 0: {
  104.                         ShowPlayerDialog(playerid, DIALOG_SENDER, DIALOG_STYLE_LIST, "Senden wählen", "Sender1\nSender2\nSender3", "Wählen", "Zurück");
  105.                     }
  106.                     case 1: { ShowPlayerDialog(playerid, DIALOG_DIREKT, DIALOG_STYLE_INPUT, "Direkt Link", "Hinweiß: Der Link muss direkt auf eine Audio Datei leiten:", "Starten", "Zurück"); }
  107.                     case 2: {
  108.                         new Float:x, Float:y, Float:z;
  109.                         GetPlayerPos(playerid, x, y, z);
  110.                         for(new i = 0; i<MAX_PLAYERS; i++) {
  111.                             if(IsPlayerInRangeOfPoint(i, 100.0, x, y, z)) return StopAudioStreamForPlayer(i);
  112.                         }
  113.                     }
  114.                     case 3: {
  115.                         new Float:x, Float:y, Float:z;
  116.                         GetPlayerPos(playerid, x, y, z);
  117.                         for(new i = 0; i<MAX_PLAYERS; i++) {
  118.                             if(IsPlayerInRangeOfPoint(i, 100.0, x, y, z)) return PlayAudioStreamForPlayer(i, "http://radiosendereintragen.de/listen.mp3", x, y, z, 5.0, 1);
  119.                         }
  120.                     }
  121.                 }
  122.             }
  123.         }
  124.         case DIALOG_SENDER: {
  125.             if(response == 0) { ShowPlayerDialog(playerid, DIALOG_DJ, DIALOG_STYLE_LIST, "DJ Aktionen","Sender wählen\nDirekt Link\nAusschalten\nAnschalten","Wählen","Schließen"); }
  126.             if(response == 1) {
  127.                 switch(listitem) {
  128.                     case 0: { //Radio Sender 1
  129.                         new Float:x, Float:y, Float:z;
  130.                         GetPlayerPos(playerid, x, y, z);
  131.                         for(new i = 0; i<MAX_PLAYERS; i++) {
  132.                             if(IsPlayerInRangeOfPoint(i, 100.0, x, y, z)) return PlayAudioStreamForPlayer(i, "http://radiosendereintragen.de/listen.mp3", x, y, z, 5.0, 1);
  133.                         }
  134.                     }
  135.                     case 1: { //Radio Sender 2
  136.                         new Float:x, Float:y, Float:z;
  137.                         GetPlayerPos(playerid, x, y, z);
  138.                         for(new i = 0; i<MAX_PLAYERS; i++) {
  139.                             if(IsPlayerInRangeOfPoint(i, 100.0, x, y, z)) return PlayAudioStreamForPlayer(i, "http://radiosendereintragen.de/listen.mp3", x, y, z, 5.0, 1);
  140.                         }
  141.                     }
  142.                     case 2: { //Radio Sender 3
  143.                         new Float:x, Float:y, Float:z;
  144.                         GetPlayerPos(playerid, x, y, z);
  145.                         for(new i = 0; i<MAX_PLAYERS; i++) {
  146.                         if(IsPlayerInRangeOfPoint(i, 100.0, x, y, z)) return PlayAudioStreamForPlayer(i, "http://radiosendereintragen.de/listen.mp3", x, y, z, 5.0, 1);
  147.                         }
  148.                     }
  149.                 }
  150.             }
  151.         }
  152.         case DIALOG_DIREKT: {
  153.             if(response == 0) { ShowPlayerDialog(playerid, DIALOG_DJ, DIALOG_STYLE_LIST, "DJ Aktionen","Sender wählen\nDirekt Link\nAusschalten\nAnschalten","Wählen","Schließen"); }
  154.             if(response == 1) {
  155.                 if(strfind(inputtext, "http://", true) != -1 || strfind(inputtext, "www.", true) != -1){
  156.                     new Float:x, Float:y, Float:z;
  157.                     GetPlayerPos(playerid, x, y, z);
  158.                     for(new i = 0; i<MAX_PLAYERS; i++) {
  159.                         if(IsPlayerInRangeOfPoint(i, 100.0, x, y, z)) return PlayAudioStreamForPlayer(i, inputtext, x, y, z, 5.0, 1);
  160.                     }
  161.                 }
  162.                 else {
  163.                     SendClientMessage(playerid, COLOR_WHITE, "Der Direkt-Link muss 'http://' sowie 'www.' beinhalten!");
  164.                     ShowPlayerDialog(playerid, DIALOG_DIREKT, DIALOG_STYLE_INPUT, "Direkt Link", "Hinweiß: Der Link muss direkt auf eine Audio Datei leiten:", "Starten", "Zurück");
  165.                 }
  166.             }
  167.         }
  168.     }
  169.     return 1;
  170. }
  171. public OnPlayerEnterCheckpoint(playerid){
  172.     if(DJcp[playerid] == true) {
  173.         DJcp[playerid] = false;
  174.         SendClientMessage(playerid, COLOR_WHITE, "Nutze '/dj' für weitere Funktionen.");
  175.     }
  176.     DisablePlayerCheckpoint(playerid);
  177.     return 1;
  178. }
  179.  
  180. ocmd:dj(playerid){
  181.     if(IsDJ[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "Du bist nicht als DJ Aktiv!");
  182.     ShowPlayerDialog(playerid, DIALOG_DJ, DIALOG_STYLE_LIST, "DJ Aktionen","Sender wählen\nDirekt Link\nAusschalten\nAnschalten","Wählen","Schließen");
  183.     return 1;
  184. }
Advertisement
Add Comment
Please, Sign In to add comment