dowz Posté(e) le 11 novembre 2015 Share Posté(e) le 11 novembre 2015 Bonjour, J'aimerais un plugin qui permet de demander au debut de round si un joueur veux etre le chef ( un joueur random) et si il accepte sa taille augmente de environ 1.5 % si il refuse sa taille reste normal, j'aimerais faire sa pour les ct. Et pour finir la meme chose mais pour les terro, mais si il accepte il devienplus petit ( comme des criminels ) contrairement au ct; ce plugin m'aiderais pour mon jail, pour mettre un peu plus de fun :D Merci Citer Lien vers le commentaire Partager sur d’autres sites More sharing options...
Kriax Posté(e) le 18 novembre 2015 Share Posté(e) le 18 novembre 2015 Désolé pour le retard, j'ai beaucoup de taff en ce moment. Test ceci : #include <sourcemod> #include <morecolors> #include <scp> #define CT_SIZE 1.2 #define T_SIZE 0.8 new bool:g_bWant[MAXPLAYERS+1] = false; new g_CaptainCT; new g_CaptainT; public OnPluginStart() { HookEvent("round_start", Event_RoundStart); HookEvent("player_death", Event_PlayerDeath); } public OnClientDisconnect(client) { if(client == g_CaptainT) g_CaptainT = -1; if(client == g_CaptainCT) g_CaptainCT = -1; } public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast) { g_CaptainT = -1; g_CaptainCT = -1; for(new i = 1; i <= MaxClients; i++) if(IsClientValid(i) && IsPlayerAlive(i)) MenuCaptain(i); CreateTimer(15.0, Timer_ChooseCaptain); } public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { new client = GetClientOfUserId(GetEventInt(event, "userid")); if(client == g_CaptainCT) { g_CaptainCT = -1; CPrintToChatAll("{green}[JAIL] Le chef des CT est mort !"); PrintCenterTextAll("Le chef des CT est mort !"); PrintHintTextToAll("Le chef des CT est mort !"); } if(client == g_CaptainT) { g_CaptainT = -1; CPrintToChatAll("{green}[JAIL] Le chef des T est mort !"); PrintCenterTextAll("Le chef des T est mort !"); PrintHintTextToAll("Le chef des T est mort !"); } } public MenuCaptain(client) { g_bWant[client] = false; new Handle:hMenu = CreateMenu(MenuHandler_Captain); SetMenuTitle(hMenu, "Voulez-vous être le capitaine"); AddMenuItem(hMenu, "oui", "Oui"); AddMenuItem(hMenu, "", "Non"); SetMenuExitButton(hMenu, false); DisplayMenu(hMenu, client, 14); } public MenuHandler_Captain(Handle:hMenu, MenuAction:action, client, param) { if(action == MenuAction_Select) { decl String:sParam[64]; GetMenuItem(hMenu, param, sParam, sizeof(sParam)); if(StrEqual(sParam, "oui")) g_bWant[client] = true; } if(action == MenuAction_End) CloseHandle(hMenu); } public Action:Timer_ChooseCaptain(Handle:timer) { g_CaptainCT = GetRandomClient(3); g_CaptainT = GetRandomClient(2); if(IsClientValid(g_CaptainCT) && IsPlayerAlive(g_CaptainCT)) { CPrintToChatAll("{green}[JAIL] Le chef des CT est : {lightgreen}%N", g_CaptainCT); PrintCenterTextAll("Le chef des CT est : %N", g_CaptainCT); PrintHintTextToAll("Le chef des CT est : %N", g_CaptainCT); SetEntPropFloat(g_CaptainCT, Prop_Send, "m_flModelScale", CT_SIZE); } if(IsClientValid(g_CaptainT) && IsPlayerAlive(g_CaptainT)) { CPrintToChatAll("{green}[JAIL] Le chef des T est : {lightgreen}%N", g_CaptainT); PrintCenterTextAll("Le chef des T est : %N", g_CaptainT); PrintHintTextToAll("Le chef des T est : %N", g_CaptainT); SetEntPropFloat(g_CaptainT, Prop_Send, "m_flModelScale", T_SIZE); } } public Action:OnChatMessage(&author, Handle:recipients, String:name[], String:message[]) { if(author == g_CaptainCT) Format(name, MAXLENGTH_NAME, "\x01[CHEF CT] \x03%s", name); if(author == g_CaptainT) Format(name, MAXLENGTH_NAME, "\x01[CHEF T] \x03%s", name); return Plugin_Changed; } public GetRandomClient(team) { new client[MaxClients+1]; new count; for (new i = 1; i <= MaxClients; i++) if (IsClientValid(i) && IsPlayerAlive(i) && GetClientTeam(i) == team && g_bWant[i]) client[count++] = i; return (count == 0) ? -1 : client[GetRandomInt(0, count-1)]; } stock bool:IsClientValid(client) { if(client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client)) return true; return false; } Dit moi se qui vas et ne vas pas, j'ai rien tester et j'ai repris le code dans une autre section. Tu modifies la tailles dans les defines au dessus, sachant que la taille normal est de 1.0 Tu risques d'avoir des "loose identation", c'est rien de grave, ça arrive quand je c/c un plugin du forum. Citer Lien vers le commentaire Partager sur d’autres sites More sharing options...
dowz Posté(e) le 25 novembre 2015 Auteur Share Posté(e) le 25 novembre 2015 Merci beaucoup ça marche nickel ;) Citer Lien vers le commentaire Partager sur d’autres sites More sharing options...
Kriax Posté(e) le 26 novembre 2015 Share Posté(e) le 26 novembre 2015 De-riens :) Citer Lien vers le commentaire Partager sur d’autres sites More sharing options...
Messages recommandés
Rejoindre la conversation
Vous pouvez publier maintenant et vous inscrire plus tard. Si vous avez un compte, connectez-vous maintenant pour publier avec votre compte.