Advertisement
Guest User

ahc

a guest
Sep 26th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.38 KB | None | 0 0
  1. #define MAX_AHC                         75
  2.  
  3. new AutoHausCar[MAX_AHC][KaufCar],
  4.     AHC[MAX_AHC];
  5.    
  6. enum KaufCar
  7. {
  8.     cID,
  9.     Modelid,
  10.     Kosten,
  11.     Float:posx,
  12.     Float:posy,
  13.     Float:posz,
  14.     Float:posr
  15. }
  16.  
  17. ////////////////////////////////////////////////////////////////////////////////////////
  18. public OnPlayerStateChange(playerid,newstate,oldstate)
  19. {
  20.         for(new i; i<MAX_AHC; i++)
  21.         {
  22.             if(!IstAHC(vehicleid))continue;
  23.             format(string,sizeof(string),"ID: {FFAA00}%d{FEFEFE} Kosten: {FFAA00}%d${FEFEFE}",AutoHausCar[i][cID],AutoHausCar[i][Kosten]);
  24.             return ShowPlayerDialog(playerid,DIALOG_EAHC,DIALOG_STYLE_LIST,string,"Fahrzeug Umparken","Auswahl","Abbrechen");
  25.         }
  26. }
  27. ////////////////////////////////////////////////////////////////////////////////////////
  28.  
  29.        
  30. stock LoadAHC()
  31. {
  32.     new query[128];
  33.     mysql_query("SELECT * FROM `AutoHausCars`");
  34.     mysql_store_result();
  35.     for(new i; i<mysql_num_rows(); i++)
  36.     {
  37.         if(i>=MAX_AHC)break;
  38.         mysql_retrieve_row();
  39.         mysql_fetch_field_row(query,"cID"); AutoHausCar[i][cID] = strval(query);
  40.         mysql_fetch_field_row(query,"Modelid"); AutoHausCar[i][Modelid] = strval(query);
  41.         mysql_fetch_field_row(query,"Kosten"); AutoHausCar[i][Kosten] = strval(query);
  42.         mysql_fetch_field_row(query,"posx"); AutoHausCar[i][posx] = floatstr(query);
  43.         mysql_fetch_field_row(query,"posy"); AutoHausCar[i][posy] = floatstr(query);
  44.         mysql_fetch_field_row(query,"posz"); AutoHausCar[i][posz] = floatstr(query);
  45.         mysql_fetch_field_row(query,"posr"); AutoHausCar[i][posr] = floatstr(query);
  46.         AHC[i] = CreateVehicle(AutoHausCar[i][Modelid],AutoHausCar[i][posx],AutoHausCar[i][posy],AutoHausCar[i][posz],AutoHausCar[i][posr],0,0,5000);
  47.     }
  48.     mysql_free_result();
  49. }
  50.  
  51. // ======================== Commands ================================ //
  52. ocmd:createautohauscar(playerid,params[])
  53. {
  54.     if(SpielerInfo[playerid][Eingeloggt] == 0)return SendClientMessage(playerid,Grau,"Du bist nicht eingeloggt !");
  55.     if(SpielerInfo[playerid][Adminlevel] < 6) return SendClientMessage(playerid,Orange,"Du bist kein "#Servertag" Teammitglied oder besitzt nicht den jeweiligen Adminrang.");
  56.     ShowPlayerDialog(playerid,DIALOG_CAHC,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen","Gib die ID des Fahrzeuges an.\nNicht die Model ID !!","Absenden","Abbrechen");
  57.     return 1;
  58. }
  59.  
  60. ////////////////////////////////////////////////////////////////////////////////////////
  61. OnDialogResponse()..
  62. {
  63.     if(dialogid==DIALOG_CAHCK)
  64.     {
  65.         if(!response)return SetPVarInt(playerid,"AHCID",0);
  66.         if(response)
  67.         {
  68.             new ahckosten = strval(inputtext);
  69.             if(ahckosten <= 0)return ShowPlayerDialog(playerid,DIALOG_CAHCK,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen - Kosten","Bitte gib die Kosten an, was das Fahrzeug kosten soll.","Absenden","Abbrechen");
  70.             SetPVarInt(playerid,"AHCK",ahckosten);
  71.             ShowPlayerDialog(playerid,DIALOG_CAHCM,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen - Model ID","Bitte gib die Model ID des Fahrzeuges an.\n\n\t\t400 - 611","Absenden","Abbrechen");
  72.             return 1;
  73.         }
  74.     }
  75.     if(dialogid==DIALOG_CAHCC)
  76.     {
  77.         if(!response) { SetPVarInt(playerid,"AHCID",0); SetPVarInt(playerid,"AHCK",0); SetPVarInt(playerid,"AHCM",0); }
  78.         if(response)
  79.         {
  80.             new carid = GetPVarInt(playerid,"AHCID"),Float:px1,Float:py1,Float:pz1;
  81.             GetPlayerPos(playerid,px1,py1,pz1);
  82.             AutoHausCar[carid][cID] = carid;
  83.             AutoHausCar[carid][Modelid] = GetPVarInt(playerid,"AHCM");
  84.             AutoHausCar[carid][Kosten] = GetPVarInt(playerid,"AHCK");
  85.             AutoHausCar[carid][posx] = px1;
  86.             AutoHausCar[carid][posy] = py1;
  87.             AutoHausCar[carid][posz] = pz1;
  88.             AutoHausCar[carid][posr] = 0.0;
  89.             format(string,sizeof(string),"INSERT INTO `AutoHausCars` (`id`,`Modelid`,`Kosten`,`posx`,`posy`,`posz`,`posr`) VALUES(%d,%d,%d,%f,%f,%f,%f)",AutoHausCar[carid][cID],AutoHausCar[carid][Modelid],AutoHausCar[carid][Kosten],AutoHausCar[carid][posx],AutoHausCar[carid][posy],AutoHausCar[carid][posz],AutoHausCar[carid][posr]);
  90.             mysql_query(string);
  91.             SetPlayerPos(playerid,px1,py1,pz1+2);
  92.             AHC[carid] = CreateVehicle(AutoHausCar[carid][Modelid],AutoHausCar[carid][posx],AutoHausCar[carid][posy],AutoHausCar[carid][posz],AutoHausCar[carid][posr],0,0,-1);
  93.             return 1;
  94.         }
  95.     }
  96.     if(dialogid==DIALOG_CAHCM)
  97.     {
  98.         if(!response) { SetPVarInt(playerid,"AHCID",0); SetPVarInt(playerid,"AHCK",0); }
  99.         if(response)
  100.         {
  101.             new ahcmodelid = strval(inputtext),Float:px1,Float:py1,Float:pz1;
  102.             GetPlayerPos(playerid,px1,py1,pz1);
  103.             if(ahcmodelid < 400)return ShowPlayerDialog(playerid,DIALOG_CAHCM,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen - Model ID","Bitte gib die Model ID des Fahrzeuges an.\n\n\t\t400 - 611","Absenden","Abbrechen");
  104.             if(ahcmodelid > 611)return ShowPlayerDialog(playerid,DIALOG_CAHCM,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen - Model ID","Bitte gib die Model ID des Fahrzeuges an.\n\n\t\t400 - 611","Absenden","Abbrechen");
  105.             SetPVarInt(playerid,"AHCM",ahcmodelid);
  106.             format(string,sizeof(string),"Autohaus Fahrzeug %s erstellen",VehicleDefinations[ahcmodelid-400]);
  107.             format(string1,sizeof(string1),"Name: {FFAA00}%s{FEFEFE}\nKosten: {FFAA00}%d{FEFEFE}\nFahrzeug ID: {FFAA00}%d{FEFEFE}\nPosition X: {FFAA00}%f{FEFEFE}\nPosition Y: {FFAA00}%f{FEFEFE}\nPosition Z: {FFAA00}%f{FEFEFE}\n\nMöchtest du dieses Fahrzeug erstellen ?",VehicleDefinations[ahcmodelid-400],GetPVarInt(playerid,"AHCK"),GetPVarInt(playerid,"AHCID"),px1,py1,pz1);
  108.             ShowPlayerDialog(playerid,DIALOG_CAHCC,DIALOG_STYLE_MSGBOX,string,string1,"erstellen","abbrechen");
  109.             return 1;
  110.         }
  111.     }
  112.     if(dialogid==DIALOG_CAHC)
  113.     {
  114.         if(response)
  115.         {
  116.             new carid = strval(inputtext);
  117.             if(mysql_CheckCAHC(carid) == 1) { ShowPlayerDialog(playerid,DIALOG_CAHC,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen","Diese ID Existiert bereits !\n\nGib die ID des Fahrzeuges an.\nNicht die Model ID !!","Absenden","Abbrechen"); }
  118.             else
  119.             {
  120.                 SetPVarInt(playerid,"AHCID",carid);
  121.                 ShowPlayerDialog(playerid,DIALOG_CAHCK,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen - Kosten","Bitte gib die Kosten an, was das Fahrzeug kosten soll.","Absenden","Abbrechen");
  122.                 return 1;
  123.             }
  124.         }
  125.     }
  126. }
  127.    
  128. ////////////////////////////////////////////////////////////////////////////////////////
  129.  
  130.  
  131. stock IstAHC(vehicleid)
  132. {
  133.     for(new a; a<(sizeof(AHC)); a++)
  134.     {
  135.         if(AHC[a] != vehicleid)continue;
  136.         {
  137.             return 1;
  138.         }
  139.     }
  140.     return 0;
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement