Aller au contenu
News ticker
  • Bienvenue sur le nouveau forum VeryGames
  • Welcome to the new VeryGames forum
  • VeryNews

    [aide] Attribuer flag sur plugin


    guillaume60510

    Messages recommandés

    Tiens , C'est possible c'est un petit plugin en plus, suis ce tuto et si tu as une question concrète demande mais essayes un minimum ou si tu veut le code déjà tout prêt va sur AliensModders

     

    Tuto : http://forum.verygames.net/showthread.php?61773-TUTO-Comment-restreindre-un-plugin-a-un-flag-(-SourceMod-)&p=357882&viewfull=1#post357882

    Lien vers le commentaire
    Partager sur d’autres sites

    Tiens , C'est possible c'est un petit plugin en plus, suis ce tuto et si tu as une question concrète demande mais essayes un minimum ou si tu veut le code déjà tout prêt va sur AliensModders

     

    Tuto : http://forum.verygames.net/showthread.php?61773-TUTO-Comment-restreindre-un-plugin-a-un-flag-(-SourceMod-)&p=357882&viewfull=1#post357882

     

    J'ai vue ce tuto mais a vrai dire je n'es pas compris grand chose ^^

    Lien vers le commentaire
    Partager sur d’autres sites

    • 2 weeks later...

    Si c'est pas trop tard :

    Je sais pas si ça vas fonctionné, j'ai juste check les 100 premières lignes, la flemme d'aller plus loins dans le code et voir si il y avais autre chose à mettre sur le flag.

     

    #include <sourcemod>
    #include <cstrike>
    #include <colors>
    #include <sdkhooks>
    #include <sdktools>
    #include <smlib>
    #include <hosties>
    #include <lastrequest>
    
    #pragma semicolon 1
    #define MAX_FILE_LEN 80
    
    new taser_ammo[32];
    new tased[32];
    new notnoticed[32];
    new g_sprite;
    new Float:ZeroVec[3] = {0.0, 0.0, 0.0};
    new Handle:g_hTsAmmo;
    new Handle:g_hSetAmmo;
    new Handle:g_hTsTime;
    new Handle:g_hTaseTime;
    new Handle:g_hTsWeapon;
    new Handle:g_hTaseTeam;
    
    #define PLUGIN_VERSION "0.0.2"
    
       public Plugin:myinfo = 
       {
           name = "Taser",
           author = "\\ Predator",
           description = "Turns a weapon into a taser",
           version = PLUGIN_VERSION,
           url = "http://www.area-community.net/"
       };
    
       public OnPluginStart()
       {
           HookEvent("round_start", Event_Round, EventHookMode_Pre);
           CreateConVar("taser_version", PLUGIN_VERSION, "Taser Plugin", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
           g_hTsAmmo = CreateConVar("taser_ammo", "3", "Ammo at start.", FCVAR_PLUGIN);
           g_hSetAmmo = CreateConVar("taser_set_ammo", "0", "Set ammo every frame.", FCVAR_PLUGIN);
           g_hTsTime = CreateConVar("taser_ammo_time", "40.0", "Delay to restore ammo.", FCVAR_PLUGIN);
           g_hTsWeapon = CreateConVar("taser_weapon", "weapon_usp", "Weapon which is to be used as a taser.", FCVAR_PLUGIN);
           g_hTaseTime = CreateConVar("taser_tase_time", "3.0", "Delay after a Player is not tased anymore.", FCVAR_PLUGIN);
           g_hTaseTeam = CreateConVar("taser_team", "3", "Team which can use the taser (3 = CT, 2 = T, 1 = Spec).", FCVAR_PLUGIN);
           AutoExecConfig(true, "sm_taser");
       }
    
       public OnMapStart()
       {
           g_sprite = PrecacheModel("materials/sprites/laser.vmt");
       }
    
       public OnClientPutInServer(client)
       {
           if(IsClientInGame(client)){
               SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
               notnoticed[client] = 0;
               tased[client] = 0;
           }
       }
    
       public OnGameFrame()
       {
           if(SetAmmo() == 1){
               for (new X = 1; X <= MaxClients; X++)
               {
                   if(IsClientInGame(X) && GetClientTeam(X) != 1 && IsPlayerAlive(X)) 
                   {
                       if(taser_ammo[X] != 0){
                           new String:waffe[255];
                           GetClientWeapon(X, waffe, sizeof(waffe));
                           decl String:buffer[128];
                           GetConVarString(g_hTsWeapon, buffer, sizeof(buffer));
                           if(StrEqual(waffe, buffer))
                           {
                               Client_SetWeaponClipAmmo(X, waffe, taser_ammo[X], 0);
                           }
                       }
                   }
               }
           }
       }
    
       public Action:Event_Round(Handle:event, const String:name[], bool:dontBroadcast)
       {
               for (new client = 1; client <= MaxClients; client++)
               {
                       if(IsClientInGame(client) && GetClientTeam(client) != 1 && IsPlayerAlive(client)) 
                       {
                           if(GetClientTeam(client) == GetTaseTeam() && GetUserFlagBits(client) & ADMFLAG_CUSTOM1)
                           {
                               taser_ammo[client] = GetStartAmmo();
                               notnoticed[client] = 0;
                               CreateTimer(GetAmmoTime(), Timer_Restore, client, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
                               SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
                           } else {
                               taser_ammo[client] = 0;
                               notnoticed[client] = 1;
                               tased[client] = 0;
                               SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
                           }
    
                       }
               }
       }
    
       public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
       {
           new String:sWeapon[32], vName[32], iName[32];
           new Float:TargetPos[3], ClientPos[3];
           GetClientWeapon(attacker, sWeapon, sizeof(sWeapon));
           GetClientName(attacker, iName, sizeof(iName));
           GetClientName(victim, vName, sizeof(vName));
           decl String:buffer[128];
           GetConVarString(g_hTsWeapon, buffer, sizeof(buffer));
    
           if(IsClientInGame(attacker) && IsClientInGame(victim)){
               if(StrEqual(sWeapon, buffer))
               {
                   if(GetClientTeam(victim) != GetClientTeam(attacker) && GetClientTeam(attacker) == GetTaseTeam() && GetClientTeam(attacker) != 1 && IsPlayerAlive(attacker) && GetClientTeam(victim) != 1 && IsPlayerAlive(victim))
                   {
                           if(taser_ammo[attacker] != 0){
                               damage = 0.0;
                               if(tased[victim] == 0){
                                   new wepIdx;
                                   for (new i; i < 4; i++)
                                       {
                                           if ((wepIdx = GetPlayerWeaponSlot(victim, i)) != -1)
                                           {
                                               RemovePlayerItem(victim, wepIdx);
                                               AcceptEntityInput(wepIdx, "Kill");
                                           }
                                       }
                                   GetClientEyePosition(victim, TargetPos);
                                   GetClientEyePosition(attacker, ClientPos);
                                   TargetPos[2] -= 20.0;
                                   ClientPos[2] -= 20.0;
                                   damage = 0.0;
    
                                   new color[4] = {25, 25, 200, 150};
    
                                   TE_SetupBeamPoints( ClientPos, TargetPos, g_sprite, 0, 0, 0, 0.3, 3.0, 3.0, 1, 1.0, color, 0);
                                   TE_SendToAll();
    
                                   SetEntPropVector(attacker, Prop_Send, "m_vecPunchAngle", ZeroVec);
    
                                   SetEntityMoveType(victim, MOVETYPE_NONE);
                                   SetEntityRenderMode(victim, RENDER_TRANSCOLOR);
                                   SetEntityRenderColor(victim, 25, 25, 150, 220);        
    
                                   CreateTimer(GetTaseTime(), ClearCamTimer, victim);
                                   taser_ammo[attacker] -= 1;
                                   tased[victim] = 1;
                                   PrintToChatAll("[sM] %s tased %s.", iName, vName);
                                   if(taser_ammo[attacker] == 0 && notnoticed[attacker] == 0)
                                   {
                                       PrintToChat(attacker, "[sM] No taser ammo left.");
                                       damage = 0.0;
                                       notnoticed[attacker] = 1;
                                   }
                               } else {
                                   PrintToChat(attacker, "[sM] %s is already tased.", vName);
                                   damage = 0.0;
                               }
                           } else {
                               if(notnoticed[attacker] == 0)
                               {
                                   PrintToChat(attacker, "[sM] No taser ammo left.");
                                   notnoticed[attacker] = 1;
                               }
                           }
                   }
               }
           }
       }
    
       public Action:ClearCamTimer(Handle:timer, any:victim)
       {
           if(IsClientInGame(victim)){
               if(GetClientTeam(victim) != 1)
               {
                   SetEntityMoveType(victim, MOVETYPE_WALK);
                   SetEntityRenderColor(victim, 255, 255, 255, 255);
                   tased[victim] = 0;
                   if(IsPlayerAlive(victim)){
                       GivePlayerItem(victim, "weapon_knife");
                       PrintToChat(victim, "[sM] You are no longer tased.");
                   }
               }
           }
       }
    
       public Action:Timer_Restore(Handle:timer, any:client)
       {
           if(IsClientInGame(client)){
               if(GetClientTeam(client) != 1 && IsPlayerAlive(client) && GetClientTeam(client) == GetTaseTeam)
               {
                   if(taser_ammo[client] < GetStartAmmo())
                   {
                       taser_ammo[client] += 1;
                       PrintToChat(client, "[sM] Taser ammo restored. (%d)", taser_ammo[client]);
                   }
               }
           }
       }
    
       public GetStartAmmo()
       {
           decl String:buffer[128];
    
           GetConVarString(g_hTsAmmo, buffer, sizeof(buffer));
    
           return StringToInt(buffer);
       }
    
       public GetAmmoTime()
       {
           decl String:buffer[128];
    
           GetConVarString(g_hTsTime, buffer, sizeof(buffer));
    
           return StringToFloat(buffer);
       }
    
       public SetAmmo()
       {
           decl String:buffer[128];
    
           GetConVarString(g_hSetAmmo, buffer, sizeof(buffer));
    
           return StringToInt(buffer);
       }
    
       public GetTaseTime()
       {
           decl String:buffer[128];
    
           GetConVarString(g_hTaseTime, buffer, sizeof(buffer));
    
           return StringToFloat(buffer);
       }
    
       public GetTaseTeam()
       {
           decl String:buffer[128];
    
           GetConVarString(g_hTaseTeam, buffer, sizeof(buffer));
    
           return StringToInt(buffer);
       }
    

     

    Compile le en LOCALE avec la liste des includes sur ton pc ;)

     

    Kriax.

    Lien vers le commentaire
    Partager sur d’autres sites

    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.

    Invité
    Répondre à ce sujet…

    ×   Collé en tant que texte enrichi.   Coller en tant que texte brut à la place

      Seulement 75 émoticônes maximum sont autorisées.

    ×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

    ×   Votre contenu précédent a été rétabli.   Vider l’éditeur

    ×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

    ×
    ×
    • Créer...