Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_AHC 75
- new AutoHausCar[MAX_AHC][KaufCar],
- AHC[MAX_AHC];
- enum KaufCar
- {
- cID,
- Modelid,
- Kosten,
- Float:posx,
- Float:posy,
- Float:posz,
- Float:posr
- }
- ////////////////////////////////////////////////////////////////////////////////////////
- public OnPlayerStateChange(playerid,newstate,oldstate)
- {
- for(new i; i<MAX_AHC; i++)
- {
- if(!IstAHC(vehicleid))continue;
- format(string,sizeof(string),"ID: {FFAA00}%d{FEFEFE} Kosten: {FFAA00}%d${FEFEFE}",AutoHausCar[i][cID],AutoHausCar[i][Kosten]);
- return ShowPlayerDialog(playerid,DIALOG_EAHC,DIALOG_STYLE_LIST,string,"Fahrzeug Umparken","Auswahl","Abbrechen");
- }
- }
- ////////////////////////////////////////////////////////////////////////////////////////
- stock LoadAHC()
- {
- new query[128];
- mysql_query("SELECT * FROM `AutoHausCars`");
- mysql_store_result();
- for(new i; i<mysql_num_rows(); i++)
- {
- if(i>=MAX_AHC)break;
- mysql_retrieve_row();
- mysql_fetch_field_row(query,"cID"); AutoHausCar[i][cID] = strval(query);
- mysql_fetch_field_row(query,"Modelid"); AutoHausCar[i][Modelid] = strval(query);
- mysql_fetch_field_row(query,"Kosten"); AutoHausCar[i][Kosten] = strval(query);
- mysql_fetch_field_row(query,"posx"); AutoHausCar[i][posx] = floatstr(query);
- mysql_fetch_field_row(query,"posy"); AutoHausCar[i][posy] = floatstr(query);
- mysql_fetch_field_row(query,"posz"); AutoHausCar[i][posz] = floatstr(query);
- mysql_fetch_field_row(query,"posr"); AutoHausCar[i][posr] = floatstr(query);
- AHC[i] = CreateVehicle(AutoHausCar[i][Modelid],AutoHausCar[i][posx],AutoHausCar[i][posy],AutoHausCar[i][posz],AutoHausCar[i][posr],0,0,5000);
- }
- mysql_free_result();
- }
- // ======================== Commands ================================ //
- ocmd:createautohauscar(playerid,params[])
- {
- if(SpielerInfo[playerid][Eingeloggt] == 0)return SendClientMessage(playerid,Grau,"Du bist nicht eingeloggt !");
- if(SpielerInfo[playerid][Adminlevel] < 6) return SendClientMessage(playerid,Orange,"Du bist kein "#Servertag" Teammitglied oder besitzt nicht den jeweiligen Adminrang.");
- ShowPlayerDialog(playerid,DIALOG_CAHC,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen","Gib die ID des Fahrzeuges an.\nNicht die Model ID !!","Absenden","Abbrechen");
- return 1;
- }
- ////////////////////////////////////////////////////////////////////////////////////////
- OnDialogResponse()..
- {
- if(dialogid==DIALOG_CAHCK)
- {
- if(!response)return SetPVarInt(playerid,"AHCID",0);
- if(response)
- {
- new ahckosten = strval(inputtext);
- 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");
- SetPVarInt(playerid,"AHCK",ahckosten);
- 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");
- return 1;
- }
- }
- if(dialogid==DIALOG_CAHCC)
- {
- if(!response) { SetPVarInt(playerid,"AHCID",0); SetPVarInt(playerid,"AHCK",0); SetPVarInt(playerid,"AHCM",0); }
- if(response)
- {
- new carid = GetPVarInt(playerid,"AHCID"),Float:px1,Float:py1,Float:pz1;
- GetPlayerPos(playerid,px1,py1,pz1);
- AutoHausCar[carid][cID] = carid;
- AutoHausCar[carid][Modelid] = GetPVarInt(playerid,"AHCM");
- AutoHausCar[carid][Kosten] = GetPVarInt(playerid,"AHCK");
- AutoHausCar[carid][posx] = px1;
- AutoHausCar[carid][posy] = py1;
- AutoHausCar[carid][posz] = pz1;
- AutoHausCar[carid][posr] = 0.0;
- 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]);
- mysql_query(string);
- SetPlayerPos(playerid,px1,py1,pz1+2);
- AHC[carid] = CreateVehicle(AutoHausCar[carid][Modelid],AutoHausCar[carid][posx],AutoHausCar[carid][posy],AutoHausCar[carid][posz],AutoHausCar[carid][posr],0,0,-1);
- return 1;
- }
- }
- if(dialogid==DIALOG_CAHCM)
- {
- if(!response) { SetPVarInt(playerid,"AHCID",0); SetPVarInt(playerid,"AHCK",0); }
- if(response)
- {
- new ahcmodelid = strval(inputtext),Float:px1,Float:py1,Float:pz1;
- GetPlayerPos(playerid,px1,py1,pz1);
- 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");
- 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");
- SetPVarInt(playerid,"AHCM",ahcmodelid);
- format(string,sizeof(string),"Autohaus Fahrzeug %s erstellen",VehicleDefinations[ahcmodelid-400]);
- 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);
- ShowPlayerDialog(playerid,DIALOG_CAHCC,DIALOG_STYLE_MSGBOX,string,string1,"erstellen","abbrechen");
- return 1;
- }
- }
- if(dialogid==DIALOG_CAHC)
- {
- if(response)
- {
- new carid = strval(inputtext);
- 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"); }
- else
- {
- SetPVarInt(playerid,"AHCID",carid);
- ShowPlayerDialog(playerid,DIALOG_CAHCK,DIALOG_STYLE_INPUT,"Autohaus Fahrzeug erstellen - Kosten","Bitte gib die Kosten an, was das Fahrzeug kosten soll.","Absenden","Abbrechen");
- return 1;
- }
- }
- }
- }
- ////////////////////////////////////////////////////////////////////////////////////////
- stock IstAHC(vehicleid)
- {
- for(new a; a<(sizeof(AHC)); a++)
- {
- if(AHC[a] != vehicleid)continue;
- {
- return 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement