Jujuv

[SA:MP | GM] Free-Mode

Apr 9th, 2012
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 22.51 KB | None | 0 0
  1. #include <a_samp>
  2. #include "../include/gl_common.inc"
  3.  
  4. /*
  5. -------------------------------------
  6. Macros pour la configuration
  7. -------------------------------------
  8. */
  9. #define MAX_AMMO 1000//Maximum de munitions
  10. #define LS_SPAWNS 32//Nombre de points d'apparitionqs à LS
  11. #define LV_SPAWNS 43//Nombre de points d'apparitions à LV
  12. #define SF_SPAWNS 31//Nombres de points d'apparition à SF
  13. #define MONEYDROP_AMMOUNT 1000//Quantité maximum d'argent perdu lors de la mort
  14. #define MONEY4KILLS_AMMOUNT 1000//Quantité maximum d'argent gagné lors d'un "kill"
  15. #define VOTE_KICK_DELAY 60//Delai pour le "votekick" (en secondes)
  16. #define MSG_TIME 10//Temps d'affichage des messages generaux (en secondes)
  17.  
  18.  
  19. /*
  20. ------------------------------------------
  21. Macros pour la lisibilité du script
  22. ------------------------------------------
  23. */
  24. #define KNIFE 4
  25. #define GRENADE 16
  26. #define MOLOTOV 18
  27. #define C45 22
  28. #define SC45 23
  29. #define DEAGLE 24
  30. #define SHOTGUN 25
  31. #define SPAZZ 27
  32. #define UZI 28
  33. #define MP5 29
  34. #define AK47 30
  35. #define M4 31
  36. #define TECH9 32
  37. #define RIFLE 33
  38. #define SNIPER 34
  39. #define RPG 35
  40. #define ROCKET 36
  41. #define PARA 46
  42.  
  43. /*
  44. ------------------------------------------
  45. Variables globales (definitions)
  46. ------------------------------------------
  47. */
  48. new gMaxPlayers = 0;
  49. new gPlayersConnected = 0;
  50. new kicktimer;//Utilisé pour retenir l'ID du timer "Votekick"
  51.  
  52. /*
  53. ------------------------------------------
  54. Prototypes de fonctions publiques
  55. ------------------------------------------
  56. */
  57. forward AbortVoteKick();//Prototype de la fonction publique AbortVoteKick()
  58. forward SetPickupPickable(pickupID);
  59.  
  60. /*
  61. -------------------------------------------
  62. Structures d'énumeration
  63. -------------------------------------------
  64. */
  65. enum E_PICKUPSINFO
  66. {
  67.     weaponid,
  68.     pickable
  69. }
  70. enum
  71. {
  72.     DIALOG_HELP,
  73.     DIALOG_VOTEKICK,
  74.     DIALOG_ABORT_VOTE,
  75.     DIALOG_VOTEKICK_CONFIRM,
  76.     DIALOG_VOTEKICK_ERROR,
  77.     DIALOG_TAB_CLICK_MENU,
  78.     DIALOG_PM,
  79.     DIALOG_PM_ERROR,
  80.     DIALOG_ADD_CONTACT,
  81.     DIALOG_ADD_CONTACT_ERROR,
  82.     DIALOG_TP,
  83. }
  84.  
  85. /*
  86. ---------------------------------------------
  87. Tableaux globaux (definitions)
  88. ---------------------------------------------
  89. */
  90.  
  91. new gWeaponPickups[MAX_PICKUPS][E_PICKUPSINFO];//Ascocie à chaque pickup (par ID) l'arme qu'il donne
  92.  
  93. //Copié-Collé de la librairie gl_spawns
  94. new Float:gRandomSpawns_LosSantos[LS_SPAWNS][4] = {
  95.     {1751.1097,-2106.4529,13.5469,183.1979}, // El-Corona - Outside random house
  96.     {2652.6418,-1989.9175,13.9988,182.7107}, // Random house in willowfield - near playa de seville and stadium
  97.     {2489.5225,-1957.9258,13.5881,2.3440}, // Hotel in willowfield - near cluckin bell
  98.     {2689.5203,-1695.9354,10.0517,39.5312}, // Outside stadium - lots of cars
  99.     {2770.5393,-1628.3069,12.1775,4.9637}, // South in east beach - north of stadium - carparks nearby
  100.     {2807.9282,-1176.8883,25.3805,173.6018}, // North in east beach - near apartments
  101.     {2552.5417,-958.0850,82.6345,280.2542}, // Random house north of Las Colinas
  102.     {2232.1309,-1159.5679,25.8906,103.2939}, // Jefferson motel
  103.     {2388.1003,-1279.8933,25.1291,94.3321}, // House south of pig pen
  104.     {2481.1885,-1536.7186,24.1467,273.4944}, // East LS - near clucking bell and car wash
  105.     {2495.0720,-1687.5278,13.5150,359.6696}, // Outside CJ's house - lots of cars nearby
  106.     {2306.8252,-1675.4340,13.9221,2.6271}, // House in ganton - lots of cars nearby
  107.     {2191.8403,-1455.8251,25.5391,267.9925}, // House in south jefferson - lots of cars nearby
  108.     {1830.1359,-1092.1849,23.8656,94.0113}, // Mulholland intersection carpark
  109.     {2015.3630,-1717.2535,13.5547,93.3655}, // Idlewood house
  110.     {1654.7091,-1656.8516,22.5156,177.9729}, // Right next to PD
  111.     {1219.0851,-1812.8058,16.5938,190.0045}, // Conference Center
  112.     {1508.6849,-1059.0846,25.0625,1.8058}, // Across the street of BANK - lots of cars in intersection carpark
  113.     {1421.0819,-885.3383,50.6531,3.6516}, // Outside house in vinewood
  114.     {1133.8237,-1272.1558,13.5469,192.4113}, // Near hospital
  115.     {1235.2196,-1608.6111,13.5469,181.2655}, // Backalley west of mainstreet
  116.     {590.4648,-1252.2269,18.2116,25.0473}, // Outside "BAnk of San Andreas"
  117.     {842.5260,-1007.7679,28.4185,213.9953}, // North of Graveyard
  118.     {911.9332,-1232.6490,16.9766,5.2999}, // LS Film Studio
  119.     {477.6021,-1496.6207,20.4345,266.9252}, // Rodeo Place
  120.     {255.4621,-1366.3256,53.1094,312.0852}, // Outside propery in richman
  121.     {281.5446,-1261.4562,73.9319,305.0017}, // Another richman property
  122.     {790.1918,-839.8533,60.6328,191.9514}, // Mulholland house
  123.     {1299.1859,-801.4249,84.1406,269.5274}, // Maddoggs
  124.     {1240.3170,-2036.6886,59.9575,276.4659}, // Verdant Bluffs
  125.     {2215.5181,-2627.8174,13.5469,273.7786}, // Ocean docks 1
  126.     {2509.4346,-2637.6543,13.6453,358.3565} // Ocean Docks spawn 2
  127. };
  128.  
  129. new Float:gRandomSpawns_LasVenturas[LV_SPAWNS][4] = {
  130.     {1435.8024,2662.3647,11.3926,1.1650}, //  Northern train station
  131.     {1457.4762,2773.4868,10.8203,272.2754}, //  Northern golf club
  132.     {1739.6390,2803.0569,14.2735,285.3929}, //  Northern housing estate 1
  133.     {1870.3096,2785.2471,14.2734,42.3102}, //  Northern housing estate 2
  134.     {1959.7142,2754.6863,10.8203,181.4731}, //  Northern house 1
  135.     {2314.2556,2759.4504,10.8203,93.2711}, //  Northern industrial estate 1
  136.     {2216.5674,2715.0334,10.8130,267.6540}, //  Northern industrial estate 2
  137.     {2101.4192,2678.7874,10.8130,92.0607}, //  Northern near railway line
  138.     {1951.1090,2660.3877,10.8203,180.8461}, //  Northern house 2
  139.     {1666.6949,2604.9861,10.8203,179.8495}, //  Northern house 3
  140.     {2808.3367,2421.5107,11.0625,136.2060}, //  Northern shopping centre
  141.     {2633.3203,2349.7061,10.6719,178.7175}, //  V-Rock
  142.     {2606.6348,2161.7490,10.8203,88.7508}, //  South V-Rock
  143.     {2616.5286,2100.6226,10.8158,177.7834}, //  North Ammunation 1
  144.     {2491.8816,2397.9370,10.8203,266.6003}, //  North carpark 1
  145.     {2531.7891,2530.3223,21.8750,91.6686}, //  North carpark 2
  146.     {2340.6677,2530.4324,10.8203,177.8630}, //  North Pizza Stack
  147.     {2097.6855,2491.3313,14.8390,181.8117}, //  Emerald Isle
  148.     {1893.1000,2423.2412,11.1782,269.4385}, //  Souvenir shop
  149.     {1698.9330,2241.8320,10.8203,357.8584}, //  Northern casino
  150.     {1479.4559,2249.0769,11.0234,306.3790}, //  Baseball stadium 1
  151.     {1298.1548,2083.4016,10.8127,256.7034}, //  Baseball stadium 2
  152.     {1117.8785,2304.1514,10.8203,81.5490}, //  North carparks
  153.     {1108.9878,1705.8639,10.8203,0.6785}, //  Dirtring racing 1
  154.     {1423.9780,1034.4188,10.8203,90.9590}, //  Sumo
  155.     {1537.4377,752.0641,11.0234,271.6893}, //  Church
  156.     {1917.9590,702.6984,11.1328,359.2682}, //  Southern housing estate
  157.     {2089.4785,658.0414,11.2707,357.3572}, //  Southern house 1
  158.     {2489.8286,928.3251,10.8280,67.2245}, //  Wedding chapel
  159.     {2697.4717,856.4916,9.8360,267.0983}, //  Southern construction site
  160.     {2845.6104,1288.1444,11.3906,3.6506}, //  Southern train station
  161.     {2437.9370,1293.1442,10.8203,86.3830}, //  Wedding chapel (near Pyramid)
  162.     {2299.5430,1451.4177,10.8203,269.1287}, //  Carpark (near Pyramid)
  163.     {2214.3008,2041.9165,10.8203,268.7626}, //  Central parking lot
  164.     {2005.9174,2152.0835,10.8203,270.1372}, //  Central motel
  165.     {2222.1042,1837.4220,10.8203,88.6461}, //  Clowns Pocket
  166.     {2025.6753,1916.4363,12.3382,272.5852}, //  The Visage
  167.     {2087.9902,1516.5336,10.8203,48.9300}, //  Royal Casino
  168.     {2172.1624,1398.7496,11.0625,91.3783}, //  Auto Bahn
  169.     {2139.1841,987.7975,10.8203,0.2315}, //  Come-a-lot
  170.     {1860.9672,1030.2910,10.8203,271.6988}, //  Behind 4 Dragons
  171.     {1673.2345,1316.1067,10.8203,177.7294}, //  Airport carpark
  172.     {1412.6187,2000.0596,14.7396,271.3568} //  South baseball stadium houses
  173. };
  174.  
  175. new Float:gRandomSpawns_SanFierro[SF_SPAWNS][4] = {
  176.     {-2723.4639,-314.8138,7.1839,43.5562},  // golf course spawn
  177.     {-2694.5344,64.5550,4.3359,95.0190},  // in front of a house
  178.     {-2458.2000,134.5419,35.1719,303.9446},  // hotel
  179.     {-2796.6589,219.5733,7.1875,88.8288},  // house
  180.     {-2706.5261,397.7129,4.3672,179.8611},  // park
  181.     {-2866.7683,691.9363,23.4989,286.3060},  // house
  182.     {-2764.9543,785.6434,52.7813,357.6817},  // donut shop
  183.     {-2660.9402,883.2115,79.7738,357.4440},  // house
  184.     {-2861.0796,1047.7109,33.6068,188.2750}, //  parking lot
  185.     {-2629.2009,1383.1367,7.1833,179.7006},  // parking lot at the bridge
  186.     {-2079.6802,1430.0189,7.1016,177.6486},  // pier
  187.     {-1660.2294,1382.6698,9.8047,136.2952}, //  pier 69
  188.     {-1674.1964,430.3246,7.1797,226.1357},  // gas station]
  189.     {-1954.9982,141.8080,27.1747,277.7342},  // train station
  190.     {-1956.1447,287.1091,35.4688,90.4465},  // car shop
  191.     {-1888.1117,615.7245,35.1719,128.4498},  // random
  192.     {-1922.5566,886.8939,35.3359,272.1293},  // random
  193.     {-1983.3458,1117.0645,53.1243,271.2390},  // church
  194.     {-2417.6458,970.1491,45.2969,269.3676},  // gas station
  195.     {-2108.0171,902.8030,76.5792,5.7139},  // house
  196.     {-2097.5664,658.0771,52.3672,270.4487},  // random
  197.     {-2263.6650,393.7423,34.7708,136.4152},  // random
  198.     {-2287.5027,149.1875,35.3125,266.3989},  // baseball parking lot
  199.     {-2039.3571,-97.7205,35.1641,7.4744},  // driving school
  200.     {-1867.5022,-141.9203,11.8984,22.4499},  // factory
  201.     {-1537.8992,116.0441,17.3226,120.8537},  // docks ship
  202.     {-1708.4763,7.0187,3.5489,319.3260},  // docks hangar
  203.     {-1427.0858,-288.9430,14.1484,137.0812},  // airport
  204.     {-2173.0654,-392.7444,35.3359,237.0159},  // stadium
  205.     {-2320.5286,-180.3870,35.3135,179.6980},  // burger shot
  206.     {-2930.0049,487.2518,4.9141,3.8258}  // harbor
  207. };
  208.  
  209. main()
  210. {
  211.     print("\n----------------------------------");
  212.     print("(^_^) Free Mode by Jujuv (^_^)");
  213.     print("----------------------------------\n");
  214. }
  215.  
  216.  
  217. public OnGameModeInit()
  218. {
  219.     SetGameModeText("Free Mode");
  220.    
  221.     /*Chargements des vehicules
  222.    
  223.     Je vais pas m'enuyer à prendre des tones de positions et/ou à "convertire" des coordonés
  224.    
  225.     */
  226.    
  227.     LoadPickups();
  228.    
  229.     LoadStaticVehiclesFromFile("/vehicles/flint.txt");
  230.     LoadStaticVehiclesFromFile("/vehicles/bone.txt");
  231.     LoadStaticVehiclesFromFile("/vehicles/ls_airport.txt");
  232.     LoadStaticVehiclesFromFile("/vehicles/ls_gen_inner.txt");
  233.     LoadStaticVehiclesFromFile("/vehicles/ls_gen_outer.txt");
  234.     LoadStaticVehiclesFromFile("/vehicles/ls_law.txt");
  235.     LoadStaticVehiclesFromFile("/vehicles/lv_airport.txt");
  236.     LoadStaticVehiclesFromFile("/vehicles/lv_gen.txt");
  237.     LoadStaticVehiclesFromFile("/vehicles/lv_law.txt");
  238.     LoadStaticVehiclesFromFile("/vehicles/pilots.txt");
  239.     LoadStaticVehiclesFromFile("/vehicles/red_country.txt");
  240.     LoadStaticVehiclesFromFile("/vehicles/sf_airport.txt");
  241.     LoadStaticVehiclesFromFile("/vehicles/sf_gen.txt");
  242.     LoadStaticVehiclesFromFile("/vehicles/sf_law.txt");
  243.     LoadStaticVehiclesFromFile("/vehicles/sf_train.txt");
  244.     LoadStaticVehiclesFromFile("/vehicles/tierra.txt");
  245.     LoadStaticVehiclesFromFile("/vehicles/trains.txt");
  246.     LoadStaticVehiclesFromFile("/vehicles/trains_platform.txt");
  247.     LoadStaticVehiclesFromFile("/vehicles/whetstone.txt");
  248.    
  249.     return 1;
  250. }
  251.  
  252.  
  253. public OnPlayerConnect(playerid)
  254. {
  255.     //Certaines PVars doivent être initialisé à des valeurs par défaut
  256.    
  257.    
  258.     if(gMaxPlayers < playerid) { gMaxPlayers = playerid;}
  259.    
  260.     gPlayersConnected++;
  261.    
  262.    
  263.     SetPVarInt(playerid, "playerClicked", INVALID_PLAYER_ID);//Stoque le joueur cliqué/séléctioné (cible de l'OP)
  264.     SetPVarInt(playerid, "chat_member_1", INVALID_PLAYER_ID);
  265.     SetPVarInt(playerid, "chat_member_2", INVALID_PLAYER_ID);
  266.     SetPVarInt(playerid, "chat_member_3", INVALID_PLAYER_ID);
  267.     SetPVarInt(playerid, "chat_member_4", INVALID_PLAYER_ID);
  268.     SetPVarInt(playerid, "chat_member_5", INVALID_PLAYER_ID);
  269.    
  270.     return 1;
  271. }
  272.  
  273. public OnPlayerDisconnect(playerid, reason)
  274. {
  275.     if(GetPVarInt(playerid, "Kicked"))//Si le joueur fait l'objet d'un "votekick"
  276.     {
  277.         ResetVoteKick();//R-à-Z des "voteskick" (voir la fonction ResetVoteKick() )
  278.     }
  279.    
  280.     if(playerid == gMaxPlayers)
  281.     {
  282.         for(new i = gMaxPlayers-1; i >= 0; i--)//TY Mini'.J'ai juste CC et changé le nom d'la var
  283.         {
  284.             if(IsPlayerConnected(i))
  285.             {gMaxPlayers = i; break;}
  286.         }
  287.     }
  288.    
  289.     gPlayersConnected--;
  290.    
  291.     return 1;
  292. }
  293.  
  294.  
  295. public OnPlayerDeath(playerid, killerid, reason)
  296. {
  297.     RandomSpawn(playerid);//Pour que l-on aparaisse à un endroit différent aprés chaque mort
  298.     if(killerid != INVALID_PLAYER_ID)
  299.     {
  300.         GivePlayerMoney(playerid, random(MONEYDROP_AMMOUNT)*(-1));//x*(-1) = -x
  301.         GivePlayerMoney(killerid, random(MONEY4KILLS_AMMOUNT));
  302.     }
  303.     SendDeathMessage(killerid, playerid, reason);
  304.     return 1;
  305. }
  306.  
  307. public OnPlayerText(playerid, text[])
  308. {
  309.     SendPlayerChatMessage(playerid, text);//Chat par groupe
  310.     return 0;//Le chat principale est désactivé
  311. }
  312.  
  313. public OnPlayerCommandText(playerid, cmdtext[])
  314. {
  315.     if (!strcmp("/aide", cmdtext, true))//La seul commande que vous verrez dans ce mode de jeu !
  316.     {
  317.         ShowPlayerDialog(playerid, DIALOG_HELP, DIALOG_STYLE_MSGBOX, "Aide", "Ici, vous pouvez faire ce que vous voulez!\nEn cliquant sur le pseudonyme d'un joueur dans le menu des scores (touche Tabulation),\n vous pouvez acceder aux fonctions communautaires dont vous avez besoin.\nAmusez vous bien!", "Fermer", "");
  318.         return 1;
  319.     }
  320.     return 0;
  321. }
  322.  
  323. public OnPlayerUpdate(playerid)
  324. {
  325.     if(GetPVarInt(playerid, "Kicked") >= gPlayersConnected/2 && gPlayersConnected >= 2)//Si au moins la moitié des joueurs ont voté pour expulsé un joueur ET qu'il y a au moins 2 joueurs (1/2=0.5 et 1>0.5, ndlr)
  326.     {
  327.         new kickedName[MAX_PLAYER_NAME+1], string[250];
  328.         ReturnPlayerName(playerid);
  329.         format(string, sizeof(string), "~r~ %s a été éxpulsé du jeu !", kickedName);
  330.         GameTextForAll(string, MSG_TIME*1000, 0);
  331.         Kick(playerid);
  332.         ResetVoteKick();
  333.         KillTimer(kicktimer);//Arret du "timer" "kicktimer" puisque le joueur a été expulsé dans les temps
  334.     }
  335.    
  336.    
  337.    
  338.     /*
  339.     Il arrive moins souvent qu'un joueur soit à l'une des deux positions.
  340.     Tandis qu'il est plus probable qu'un joueur soit dans l'un des trois modeles de vehcules.
  341.    
  342.     Ainsi, on évite des opérations inutiles dans bien des cas !
  343.    
  344.     */
  345.    
  346.     if(IsPlayerInRangeOfPoint(playerid, 20.0, 1515.4438,-1376.8842,242.0400))
  347.     {
  348.        
  349.         new vehModel = GetVehicleModel(GetPlayerVehicleID(playerid));//Plus lisible et évite des operations inutiles car redondantes
  350.        
  351.         if(vehModel == 592 || vehModel == 557 || vehModel == 553)
  352.         {
  353.             RemoveBuildingForPlayer(playerid, 4550, 1544.5703, -1355.7891, 117.0703, 1000);
  354.             RemoveBuildingForPlayer(playerid, 4561, 1544.5703, -1355.7891, 117.0703, 1000);
  355.             RemoveBuildingForPlayer(playerid, 4716, 1544.5703, -1355.7891, 117.0703, 1000);
  356.             RemoveBuildingForPlayer(playerid, 4728, 1544.5781, -1356.3750, 327.1328, 1000);
  357.             RemoveBuildingForPlayer(playerid, 4726, 1544.5781, -1356.3750, 327.1328, 1000);
  358.             RemoveBuildingForPlayer(playerid, 4727, 1544.5781, -1356.3750, 327.6719, 1000);
  359.             CreateExplosion(1544.5703, -1355.7891, 117.0703, 6, 50);
  360.             CreateExplosion(1544.5781, -1356.3750, 327.1328, 6, 50);
  361.             CreateExplosion(1544.5781, -1356.3750, 327.6719, 6, 50);
  362.         }
  363.     }
  364.     else if(IsPlayerInRangeOfPoint(playerid, 20.0,1567.6016, -1248.6953, 102.5234))
  365.     {
  366.        
  367.         new vehModel = GetVehicleModel(GetPlayerVehicleID(playerid));
  368.        
  369.         if(vehModel == 592 || vehModel == 557 || vehModel == 553)
  370.         {
  371.             RemoveBuildingForPlayer(playerid, 4563, 1567.6016, -1248.6953, 102.5234, 0.25);
  372.             RemoveBuildingForPlayer(playerid, 4566, 1567.6016, -1248.6953, 102.5234, 0.25);
  373.             RemoveBuildingForPlayer(playerid, 4715, 1567.7188, -1248.6953, 102.5234, 0.25);
  374.             CreateExplosion(1567.6016, -1248.6953, 102.5234, 6, 50);
  375.             CreateExplosion(1567.7188, -1248.6953, 102.5234, 6, 50);
  376.         }
  377.     }
  378.    
  379.     return 1;
  380. }
  381.  
  382. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  383. {
  384.     switch(dialogid)
  385.     {
  386.         case DIALOG_VOTEKICK_CONFIRM:
  387.         {
  388.             switch(response)
  389.             {
  390.                 case 1:
  391.                 {
  392.                     SetPVarInt(GetPVarInt(playerid, "playerClicked"), "kicked", GetPVarInt(GetPVarInt(playerid, "playerClicked"), "Kicked")+1);
  393.                     SetPVarInt(playerid, "Kicking", 1);//Booleen ;)
  394.                    
  395.                     new kickedName[MAX_PLAYER_NAME+1], string[100];
  396.                     kickedName = ReturnPlayerName(GetPVarInt(playerid, "playerClicked"));
  397.                    
  398.                     format(string, sizeof(string), "~r~ Un vote a ete lance pour expulser %s!", kickedName);
  399.                     GameTextForAll(string, MSG_TIME*1000, 0);
  400.                     kicktimer = SetTimer("AbortVoteKick", VOTE_KICK_DELAY*1000, false);//Delai de vote: 60secondes sinon le vote est annulé
  401.                 }
  402.                 case 0:
  403.                 {
  404.                     ShowPlayerDialog(playerid, DIALOG_ABORT_VOTE, DIALOG_STYLE_MSGBOX, "Annulé", "Votre vote a été annulé", "Ok", "");
  405.                 }
  406.             }
  407.         }
  408.         case DIALOG_TAB_CLICK_MENU:
  409.         {
  410.             if(response)
  411.             {
  412.                 switch(listitem)
  413.                 {
  414.                     case 0://VoteKick
  415.                     {
  416.                         if(!GetPVarInt(playerid, "Kicking") && playerid != GetPVarInt(playerid, "playerClicked"))
  417.                         {
  418.                             new string[250], clickedname[MAX_PLAYER_NAME+1];
  419.                            
  420.                             clickedname = ReturnPlayerName(GetPVarInt(playerid, "playerClicked"));
  421.                            
  422.                             format(string, sizeof(string), "Etes vous sûr de vouloir voter pour l'expulsion de  %s ?", clickedname);
  423.                             ShowPlayerDialog(playerid, DIALOG_VOTEKICK_CONFIRM, DIALOG_STYLE_MSGBOX, "Certain ?", string, "Oui", "Non");
  424.                         }
  425.                         else { ShowPlayerDialog(playerid, DIALOG_VOTEKICK_ERROR, DIALOG_STYLE_MSGBOX, "Operation impossible", "Vous avé dèja voté pour une expulsion ou tentez de voter pour votre propre expulsion !", "Ok", ""); }
  426.                        
  427.                     }
  428.                     case 1://MP
  429.                     {
  430.                         pm(playerid, GetPVarInt(playerid, "playerClicked"));
  431.                     }
  432.                     case 2://Aajouter un conact
  433.                     {
  434.                         AddPlayerChatMember(playerid, GetPVarInt(playerid, "playerClicked"));
  435.                     }
  436.                     case 3://TP
  437.                     {
  438.                         TP(playerid, GetPVarInt(playerid, "playerclicked"));
  439.                     }
  440.                 }
  441.             }
  442.         }
  443.         case DIALOG_PM:
  444.         {
  445.             if(response)
  446.             {
  447.                 if(strlen(inputtext))
  448.                 {
  449.                     SendPlayerMessageToPlayer(GetPVarInt(playerid, "playerClicked"), playerid, inputtext);
  450.                     SendPlayerMessageToPlayer(playerid, playerid, inputtext);
  451.                 }
  452.                 else {  ShowPlayerDialog(playerid, DIALOG_PM,  DIALOG_STYLE_INPUT, "Message", "Entrer le contenue de votre MP:", "Envoyer", "Annuler");}
  453.             }
  454.         }
  455.     }
  456.     return 1;
  457. }
  458.  
  459. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  460. {
  461.    
  462.    
  463.    
  464.     SetPVarInt(playerid, "playerClicked", clickedplayerid);
  465.     ShowPlayerDialog(playerid, DIALOG_TAB_CLICK_MENU, DIALOG_STYLE_LIST, "Que faire ?", "Voter pour l'expulsion de ce joueur\r\nEnvoyer un MP à ce joueur\r\nAjouter ce joueur à votre chat\r\nSe TP à ce joueur", "Ok", "Annuler");
  466.    
  467.     return 1;
  468. }
  469.  
  470.  
  471. public OnPlayerRequestClass(playerid,classid)
  472. {
  473.     RandomSpawn(playerid);
  474.     SpawnPlayer(playerid);
  475. }
  476.  
  477. public OnPlayerPickUpPickup(playerid, pickupid)
  478. {
  479.     if(gWeaponPickups[pickupid][weaponid] >= 1 && gWeaponPickups[pickupid][weaponid] <= 46 && gWeaponPickups[pickupid][pickable])
  480.     {
  481.         GivePlayerWeapon(playerid, gWeaponPickups[pickupid][weaponid], random(MAX_AMMO));
  482.         SetTimerEx("SetPickupPickable", 30*1000, false, "i", pickupid);
  483.     }
  484. }
  485.  
  486. RandomSpawn(playerid)
  487. {
  488.     new Float:x, Float:y, Float:z, Float:angle, r;
  489.     if(gPlayersConnected < 50)
  490.     {
  491.         r = random(LS_SPAWNS);
  492.         x = gRandomSpawns_LosSantos[r][0];
  493.         y = gRandomSpawns_LosSantos[r][1];
  494.         z = gRandomSpawns_LosSantos[r][2];
  495.         angle = gRandomSpawns_LosSantos[r][3];
  496.     }
  497.     else if(gPlayersConnected < 100)
  498.     {
  499.         r = random(LS_SPAWNS);
  500.         x = gRandomSpawns_LasVenturas[r][0];
  501.         y = gRandomSpawns_LasVenturas[r][1];
  502.         z = gRandomSpawns_LasVenturas[r][2];
  503.         angle = gRandomSpawns_LasVenturas[r][3];
  504.     }
  505.     else
  506.     {
  507.         r = random(LS_SPAWNS);
  508.         x = gRandomSpawns_SanFierro[r][0];
  509.         y = gRandomSpawns_SanFierro[r][1];
  510.         z = gRandomSpawns_SanFierro[r][2];
  511.         angle = gRandomSpawns_SanFierro[r][3];
  512.     }
  513.     SetSpawnInfo(playerid, NO_TEAM, random(300), x, y, z, angle, random(46), random(MAX_AMMO), random(46), random(MAX_AMMO), random(46), random(MAX_AMMO));
  514.    
  515. }
  516. ResetVoteKick()
  517. {
  518.     new i;
  519.     for(i = 0; i < gMaxPlayers; i++)
  520.     {
  521.         SetPVarInt(i, "Kicking", 0);
  522.     }
  523.    
  524. }
  525.  
  526. public AbortVoteKick()
  527. {
  528.     GameTextForAll("~r~Le joueur n'a pas ete expulse (Votes insufissants)", MSG_TIME*1000, 0);
  529.     ResetVoteKick();
  530. }
  531.  
  532. pm(senderid, receiverid)
  533. {
  534.     if(IsPlayerConnected(receiverid) && receiverid != INVALID_PLAYER_ID && senderid != receiverid)
  535.     {
  536.         ShowPlayerDialog(senderid, DIALOG_PM,  DIALOG_STYLE_INPUT, "Message", "Entrer le contenue de votre MP:", "Envoyer", "Annuler");
  537.     }
  538.     else {ShowPlayerDialog(senderid, DIALOG_PM_ERROR, DIALOG_STYLE_MSGBOX, "Invalid ID", "l'ID spécifié ne correspond à aucun joueur connécté!", "Ok", ""); }
  539.    
  540. }
  541.  
  542. SendPlayerChatMessage(senderid, message[])
  543. {
  544.     new i, string[20], tmp;
  545.     tmp = false;// Faux si le joueur n'a pas reçu son propre message, sinon vrais ... trouver un nom correct pour cette var est impossible ...
  546.    
  547.     for(i = 1; i <= 5; i++)
  548.     {
  549.         format(string, sizeof(string), "chat_member_%i", i);
  550.         if(GetPVarInt(senderid, string) != INVALID_PLAYER_ID && IsPlayerConnected(GetPVarInt(senderid, string)))
  551.         {
  552.             SendPlayerMessageToPlayer(GetPVarInt(senderid, string), senderid, message);
  553.             if(!tmp) { SendPlayerMessageToPlayer(senderid, senderid, message); tmp = true;}
  554.         }
  555.     }
  556.    
  557.    
  558. }
  559.  
  560. stock AddPlayerChatMember(playerid, memberid)
  561. {
  562.    
  563.     if(IsPlayerConnected(memberid) && memberid != playerid)
  564.     {
  565.         new i, string[20];
  566.        
  567.         for(i = 1; i <= 5; i++)
  568.         {
  569.             format(string, sizeof(string), "chat_member_%i", i);
  570.             if(GetPVarInt(playerid, string) == INVALID_PLAYER_ID || !IsPlayerConnected(GetPVarInt(playerid, string)))
  571.             {
  572.                 SetPVarInt(playerid, string, memberid);
  573.                 ShowPlayerDialog(playerid, DIALOG_ADD_CONTACT, DIALOG_STYLE_MSGBOX, "Contacte ajouté!", "ce joueur a bien été ajouté à votre chat!", "Ok", "");
  574.                 break;
  575.             }
  576.             else if(i == 5)
  577.             {
  578.                 ShowPlayerDialog(playerid, DIALOG_ADD_CONTACT_ERROR, DIALOG_STYLE_MSGBOX, "Operation failed!", "Vous avez dèja 5 joueurs dans votre chat.", "Ok", "");
  579.             }
  580.         }
  581.     }
  582.     else {  ShowPlayerDialog(playerid, DIALOG_ADD_CONTACT_ERROR, DIALOG_STYLE_MSGBOX, "Operation failed!", "Vous avez spécifié un ID de joueur invalide.", "Ok", ""); }
  583. }
  584.  
  585.  
  586. stock TP(playerid, playerid2)
  587. {
  588.    
  589.    
  590.     if(playerid != playerid2 && IsPlayerConnected(playerid2) && IsPlayerConnected(playerid))//Sais-t-on jamais ! L'un des deux peux se déconnecter pendant l'OP
  591.     {
  592.         new Float:x, Float:y, Float:z;
  593.        
  594.        
  595.         GetPlayerPos(playerid2, Float:x, Float:y, Float:z);
  596.         if(IsPlayerInAnyVehicle(playerid))
  597.         {
  598.             SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  599.         }
  600.         SetPlayerPos(playerid, Float:x, Float:y, Float:z);
  601.     }
  602.    
  603.    
  604. }
  605.  
  606. stock ReturnPlayerName(playerid)
  607. {
  608.    
  609.     new pName[MAX_PLAYER_NAME+1];
  610.    
  611.     if(IsPlayerConnected(playerid))
  612.     {
  613.         GetPlayerName(playerid, pName, sizeof(pName));
  614.     }
  615.     else { pName = "Invalid player name"; }
  616.    
  617.     return pName;
  618.    
  619. }
  620.  
  621. stock LoadPickups()
  622. {
  623.     new pickupID;
  624.    
  625.     pickupID = CreatePickup(356, 2, 1753.8345, -1855.0022, 13.4141, -1);
  626.     gWeaponPickups[pickupID][weaponid] = M4;
  627.    
  628.     pickupID = CreatePickup(353, 2, 1762.1573, -1854.9021, 13.4141, -1);
  629.     gWeaponPickups[pickupID][weaponid] = MP5;
  630.    
  631.    
  632. }
  633.  
  634. public SetPickupPickable(pickupID)
  635. {
  636.     gWeaponPickups[pickupID][pickable] = true;
  637. }
Add Comment
Please, Sign In to add comment