SHARE
TWEET

Untitled

a guest Mar 16th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public LoadFactionCars(){
  2. new rows,fc;
  3. cache_get_row_count(rows);
  4. if(rows)
  5. {
  6.     for(new i; i<rows; i++)
  7.     {
  8.      
  9.         cache_get_value_name_int(i, "factioncardbid", fc);
  10.         cache_get_value_name_int(i, "factioncardbid", FactionCars[fc][factioncardbid]);
  11.         cache_get_value_name_int(i, "fVehid", FactionCars[fc][fVehid]);
  12.         cache_get_value_name_int(i, "fCol", FactionCars[fc][fCol][0]);
  13.         cache_get_value_name_int(i, "fCol", FactionCars[fc][fCol][1]);
  14.         cache_get_value_name_int(i, "fFaction", FactionCars[fc][fFaction]);
  15.         cache_get_value_name_int(i, "fPrice", FactionCars[fc][fPrice]);
  16.         cache_get_value_name_float(i, "fPosx", FactionCars[fc][fPos][0]);
  17.         cache_get_value_name_float(i, "fPosy", FactionCars[fc][fPos][1]);
  18.         cache_get_value_name_float(i, "fPosz", FactionCars[fc][fPos][2]);
  19.         cache_get_value_name_float(i, "fPosr", FactionCars[fc][fPos][3]);
  20.         cache_get_value_name_int(i, "fTuning0", FactionCars[fc][fTuning][0]);
  21.         cache_get_value_name_int(i, "fTuning1", FactionCars[fc][fTuning][1]);
  22.         cache_get_value_name_int(i, "fTuning2", FactionCars[fc][fTuning][2]);
  23.         cache_get_value_name_int(i, "fTuning3", FactionCars[fc][fTuning][3]);
  24.         cache_get_value_name_int(i, "fTuning4", FactionCars[fc][fTuning][4]);
  25.         cache_get_value_name_int(i, "fTuning5", FactionCars[fc][fTuning][5]);
  26.         cache_get_value_name_int(i, "fTuning6", FactionCars[fc][fTuning][6]);
  27.         cache_get_value_name_int(i, "fTuning7", FactionCars[fc][fTuning][7]);
  28.         cache_get_value_name_int(i, "fTuning8", FactionCars[fc][fTuning][8]);
  29.         cache_get_value_name_int(i, "fTuning9", FactionCars[fc][fTuning][9]);
  30.         cache_get_value_name_int(i, "fTuning10", FactionCars[fc][fTuning][10]);
  31.         cache_get_value_name_int(i, "fTuning11", FactionCars[fc][fTuning][11]);
  32.         cache_get_value_name_int(i, "fTuning12", FactionCars[fc][fTuning][12]);
  33.         cache_get_value_name_int(i, "fTuning13", FactionCars[fc][fTuning][13]);
  34.         cache_get_value_name_int(i, "fTuning14", FactionCars[fc][fTuning][14]);
  35.         cache_get_value_name_int(i, "fTuning15", FactionCars[fc][fTuning][15]);
  36.         cache_get_value_name_int(i, "fTuning16", FactionCars[fc][fTuning][16]);
  37.         cache_get_value_name_int(i, "fTuning17", FactionCars[fc][fTuning][17]);
  38.         FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-1,FactionCars[fc][fTuning][14]);
  39.        
  40.         if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611)
  41.         {
  42.          
  43.             SetTimerEx("fCarTuning",700,0,"i",fc);
  44.             //  if(FactionCars[fc][fTuning][0] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][0]); }
  45.             if(FactionCars[fc][fTuning][1] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][1]); }
  46.             if(FactionCars[fc][fTuning][2] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][2]); }
  47.             if(FactionCars[fc][fTuning][3] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][3]); }
  48.             if(FactionCars[fc][fTuning][4] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][4]); }
  49.             if(FactionCars[fc][fTuning][5] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][5]); }
  50.             if(FactionCars[fc][fTuning][6] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][6]); }
  51.             if(FactionCars[fc][fTuning][7] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][7]); }
  52.             if(FactionCars[fc][fTuning][8] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][8]); }
  53.             if(FactionCars[fc][fTuning][9] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][9]); }
  54.             if(FactionCars[fc][fTuning][10] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][10]); }
  55.             if(FactionCars[fc][fTuning][11] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][11]); }
  56.             if(FactionCars[fc][fTuning][12] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][12]); }
  57.             if(FactionCars[fc][fTuning][13] != 0){AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][13]);}
  58.             //----------------------------------------
  59.             if(FactionCars[fc][fFaction] == 1)
  60.             {
  61.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "LSPD");
  62.             }
  63.             else if(FactionCars[fc][fFaction] == 2)
  64.             {
  65.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "F.B.I");
  66.             }
  67.             else if(FactionCars[fc][fFaction] == 3)
  68.             {
  69.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Bundeswehr");
  70.             }
  71.             else if(FactionCars[fc][fFaction] == 4)
  72.             {
  73.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Sanitäter");
  74.             }
  75.             else if(FactionCars[fc][fFaction] == 5)
  76.             {
  77.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Los Chicken Malos");
  78.             }
  79.             else if(FactionCars[fc][fFaction] == 6)
  80.             {
  81.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Yakuza");
  82.             }
  83.             else if(FactionCars[fc][fFaction] == 7)
  84.             {
  85.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Regierung");
  86.             }
  87.             else if(FactionCars[fc][fFaction] == 8)
  88.             {
  89.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Hitman");
  90.             }
  91.             else if(FactionCars[fc][fFaction] == 9)
  92.             {
  93.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "San News");
  94.             }
  95.             else if(FactionCars[fc][fFaction] == 10)
  96.             {
  97.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Transport GmbH");
  98.             }
  99.             else if(FactionCars[fc][fFaction] == 11)
  100.             {
  101.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Fahrlehrer");
  102.             }
  103.             else if(FactionCars[fc][fFaction] == 12)
  104.             {
  105.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Triaden");
  106.             }
  107.             else if(FactionCars[fc][fFaction] == 13)
  108.             {
  109.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Grove Street");
  110.             }
  111.             else if(FactionCars[fc][fFaction] == 14)
  112.             {
  113.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Ballas");
  114.             }
  115.             else if(FactionCars[fc][fFaction] == 15)
  116.             {
  117.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Keine Ahnung");
  118.             }
  119.             else if(FactionCars[fc][fFaction] == 16)
  120.             {
  121.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "LS Vagos");
  122.             }
  123.             else if(FactionCars[fc][fFaction] == 17)
  124.             {
  125.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Aztecas");
  126.             }
  127.             else if(FactionCars[fc][fFaction] == 18)
  128.             {
  129.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "SF Rifa");
  130.             }
  131.             else if(FactionCars[fc][fFaction] == 19)
  132.             {
  133.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Red Soldiers");
  134.             }
  135.             else if(FactionCars[fc][fFaction] == 20)
  136.             {
  137.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Terroristen");
  138.             }
  139.             else if(FactionCars[fc][fFaction] == 21)
  140.             {
  141.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Wheelman");
  142.             }
  143.             else if(FactionCars[fc][fFaction] == 22)
  144.             {
  145.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "S.W.A.T");
  146.             }
  147.             else if(FactionCars[fc][fFaction] == 23)
  148.             {
  149.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Russen Mafia");
  150.             }
  151.             else if(FactionCars[fc][fFaction] == 24)
  152.             {
  153.                 SetVehicleNumberPlate(FactionCars[fc][fCarid], "Ordnungsamt");
  154.             }
  155.             SetVehicleToRespawn(FactionCars[fc][fCarid]);
  156.             if(FactionCars[fc][fTuning][14] != 0)
  157.             {
  158.                 if(FactionCars[fc][fVehid] == 560)
  159.                 {
  160.                     SireneFrak[FactionCars[fc][fCarid]] = CreateDynamicObject(19419,0,0,-1000,0,0,0,100);
  161.                     AttachDynamicObjectToVehicle(SireneFrak[FactionCars[fc][fCarid]], FactionCars[fc][fCarid], 0.000000,-0.150000,0.824999, 0.0, 0.0, 0.0);
  162.                 }
  163.             }
  164.         }
  165.     }
  166.  
  167. }
  168. }
  169.  
  170. forward LoadFrakAutosNOW();
  171. public LoadFrakAutosNOW()
  172. {
  173.     new query[128];
  174.     format(query,sizeof(query),"SELECT * FROM `FraktionsVehikels`");
  175.     mysql_pquery(mysqlcon, query, "LoadFactionCars", "");
  176.     return 1;
  177. }
  178.  
  179.  
  180. ocmd:efas(playerid,params[]){  
  181.             if(PlayerInfo[playerid][pAdmin] == 2002)
  182.             {
  183.                 new vehid,col1,col2,fracid;
  184.                 if(sscanf(params,"dddd",vehid,col1,col2,fracid)) return SendClientMessage(playerid,FACTION_COL_GREY,"Benutze: '/efa [Model] [Farbe(1)] [Farbe(2)] [Hauptfraktion]'.");
  185.                 if(vehid < 400 || vehid > 611) return SendClientMessage(playerid,FACTION_COL_GREY,"Vehicle-ID nur von 400 bis 611.");
  186.                 if(col1 < 0 || col1 > 255) return SendClientMessage(playerid,FACTION_COL_GREY,"Falsche Farbe(1)!");
  187.                 if(col2 < 0 || col2 > 255) return SendClientMessage(playerid,FACTION_COL_GREY,"Falsche Farbe(2)!");
  188.                 if(fracid <1 || fracid > 24) return SCM(playerid,-1,"FracID nicht kleiner als 1 oder höher als 25!"); // falls 0 oder höher als 25
  189.            
  190.                 for(new fc=0; fc<sizeof(FactionCars); fc++)
  191.                 {
  192.                     new Float:fX,Float:fY,Float:fZ,Float:fA;
  193.                     GetPlayerPos(playerid,fX,fY,fZ),GetPlayerFacingAngle(playerid,fA);
  194.  
  195.    
  196.                     FactionCars[fc][fVehid] = vehid;
  197.  
  198.                     FactionCars[fc][fPos][0] = fX;
  199.                     FactionCars[fc][fTuning][16] = 100;
  200.                     FactionCars[fc][fPos][1] = fY;
  201.                     FactionCars[fc][fPos][2] = fZ;
  202.                     FactionCars[fc][fPos][3] = fA;
  203.                     FactionCars[fc][fCol][0] = col1;
  204.                     FactionCars[fc][fCol][1] = col2;
  205.                     FactionCars[fc][fFaction] = fracid;
  206.                     FactionCars[fc][fPrice] = 0;
  207.  
  208.                     for(new mood;mood<16;mood++)
  209.                     {
  210.                         FactionCars[fc][fTuning][mood] = 0;}
  211.  
  212.  
  213.                     FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-1, 0);
  214.  
  215.                     SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du hast das Fraktions Fahrzeug erfolgreich erstellt.");
  216.                     SendClientMessage(playerid,COLOR_LIGHTBLUE,"Vergesse es nicht mit '/parken' umzuparken.");
  217.                     PutPlayerInVehicle(playerid,FactionCars[fc][fCarid],0);
  218.                     SaveFrakCarToDB(playerid,fc);
  219.                     return 1;
  220.                 }
  221.             }else SendClientMessage(playerid,FACTION_COL_GREY,"Du bist nicht berechtigt diesen Befehl anzuwenden.");
  222.             return 1;
  223. }
  224.  
  225. forward SaveFrakCarToDB(playerid,fc);
  226. public SaveFrakCarToDB(playerid,fc)
  227. {
  228.     new query[512],Content[512];
  229.            
  230.            
  231.  
  232.     format(query,sizeof(query),"INSERT INTO FraktionsVehikels (fVehid,fPosx,fPosy,fPosz,fPosr,fCol,fCol2,fFaction,fPrice) VALUES ('%d','%f','%f','%f','%f','%d','%d','%d','%d')",
  233.     FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],FactionCars[fc][fFaction],FactionCars[fc][fPrice]);
  234.     mysql_pquery(mysqlcon, query, "OnFrakAutoCreated", "id", playerid,fc);
  235.  
  236.     return 1;
  237. }
  238.  
  239.  
  240. forward OnFrakAutoCreated(playerid,fc);
  241. public OnFrakAutoCreated(playerid,fc)
  242. {
  243.     new query[512];
  244.    
  245.     FactionCars[fc][factioncardbid] = cache_insert_id();
  246.  
  247.  
  248.  
  249.     format(query,sizeof(query),"UPDATE FraktionsVehikels SET fTuning0='%d',fTuning1='%d',fTuning2='%d',fTuning3='%d',fTuning4='%d',fTuning5='%d',fTuning6='%d',fTuning7='%d',fTuning8='%d',fTuning9='%d',fTuning10='%d',fTuning11='%d',fTuning12='%d',fTuning13='%d',fTuning14='%d',fTuning15='%d',fTuning16='%d',fTuning17='%d' WHERE factioncardbid ='%d'",
  250.     FactionCars[fc][fTuning][0],FactionCars[fc][fTuning][1],FactionCars[fc][fTuning][2],FactionCars[fc][fTuning][3],FactionCars[fc][fTuning][4],FactionCars[fc][fTuning][5],FactionCars[fc][fTuning][6],FactionCars[fc][fTuning][7],FactionCars[fc][fTuning][8],FactionCars[fc][fTuning][9],FactionCars[fc][fTuning][10],FactionCars[fc][fTuning][11],FactionCars[fc][fTuning][12],
  251.     FactionCars[fc][fTuning][12],FactionCars[fc][fTuning][13],FactionCars[fc][fTuning][14],FactionCars[fc][fTuning][15],FactionCars[fc][fTuning][16],FactionCars[fc][fTuning][17],FactionCars[fc][factioncardbid]);
  252.     mysql_pquery(mysqlcon, query, "", "");
  253.     printf(query);
  254.     SCM(playerid,-1,"ok.");
  255.    
  256.    
  257.    
  258.  
  259.     return 1;
  260. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top