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

    probleme script


    Azik

    Messages recommandés

    Bonjour,

     

    J'utilise un script, mais quand on tue la personne sa donne 4xxxxxx HP à la place de 10 HP.

     

    Le code:

    #pragma semicolon 1
    #include <sourcemod>
    #define PLUGIN_VERSION "1.0"
    
    
    
    
    new Handle:g_hEnable;
    new Handle:g_hAnnouce;
    new Handle:kniferhealth = INVALID_HANDLE;
    
    
    public OnPluginStart()
    {
    CreateConVar("css_kniferhealth_version", PLUGIN_VERSION, "La version du plugins", FCVAR_PLUGIN|FCVAR_NOTIFY|FCVAR_SPONLY);
    g_hEnable = CreateConVar("css_kniferhealth_enable", "1", "Mettre le plugins ON (1) et OFF (2)", FCVAR_PLUGIN, true, 0.0, true, 1.0);
    g_hAnnouce = CreateConVar("css_kniferhealth_message", "1", "Mettre un message si on tue au couteau?", FCVAR_PLUGIN);
    kniferhealth = CreateConVar("css_kniferhealth", "10", "Combien d'HP gagne t-on si on tue au cut ?", FCVAR_PLUGIN);
    RegConsoleCmd("kh", Command_OnOff, "Is KniferHealth On/Off?");
    HookEvent("player_death", Event_player_knifed);
    //The Config File
    AutoExecConfig(true, "css_kniferhealth");
    }
    
    
    public Action:Event_player_knifed(Handle:event, const String:name[], bool:dontBroadcast)
    {
    //Enables The Plugin.
    if (GetConVarInt(g_hEnable) > 0)
    {
    	new client = GetClientOfUserId(GetEventInt(event, "attacker"));
    	//checks to see whether its an actual client.
    	//if (client > 0 && client < 20)
    	for(client = 0; client <= MaxClients; client++)
    	{
    		decl String:weaponName[32];
    		decl String:killerName[32];
    		decl String:victimName[32];
    		//decl String:target[32], String:health[10];
    		GetEventString(event,"weapon",weaponName,32);
    
    		//if the weapon used in death was a knife it continues
    
    		if(StrEqual(weaponName, "knife"))
    		{
    			new userid = GetEventInt(event, "userid");
    			new userid2 = GetEventInt(event, "attacker");
    			new victim = GetClientOfUserId(userid);
    			new killer = GetClientOfUserId(userid2);
    			//continues
    			if(victim != 0 && killer != 0)
    			{
    				new victimTeam = GetClientTeam(victim);
    				new killerTeam = GetClientTeam(killer);
    
    
    				if(killerTeam != victimTeam)
    				{
    					GetClientName(victim, victimName, 32);
    					GetClientName(killer, killerName, 32);
    
    					//Hints Messages to attacker and victim
    					if (GetConVarInt(g_hAnnouce) > 0)
    					{
    						PrintHintText(victim, "Tu as ete tue au couteau par %s !", killerName);
    						PrintHintText(killer, "Tu as tue %s. Tu gagnes %i hp !", victimName, kniferhealth);
    					}
    					//new m_Offset = FindSendPropOffs("CTFPlayer", "m_iHealth"); //Offset
    
    					//adds health to the knifer according to the convar's integer.
    					new kHealth = GetClientHealth(killer);
    					SetEntityHealth(killer, kHealth + GetConVarInt(kniferhealth));
    				}
    			}
    		}
    	}
    }
    }
    
    
    public Action:Command_OnOff(client, args)
    {
    if (GetConVarInt(g_hEnable) == 1)
    {
    	//\x04 is the color green(I think)
    	PrintToChat(client, "\x01Le script CutHP est actuellement \x04Actif\x01!");
    }
    else if (GetConVarInt(g_hEnable) == 0)
    {
    	PrintToChat(client, "\x01Le script CutHP est actuellement \x04Inactif\x01!");
    }
    return Plugin_Handled;
    }
    
    
    

     

    Merci :D

    Lien vers le commentaire
    Partager sur d’autres sites

    Tiens : https://forums.alliedmods.net/forumdisplay.php?f=52

     

    Je suis gentil :

     

    [b]SetEntityHealth[/b]
    
    [b]Syntax:[/b][color=#000000] stock SetEntityHealth(entity, amount)[/color] 
    
    [b]Usage: [/b]
    entity    Entity index.  
    amount    Health amount.[b]
    
    Notes[/b]: Sets an entity's health                           
    
    [b]Return: [/b][i]No return.[/i]
    
    [b]Version Added:[/b]
    1.0.0.1946
    [b]On error / Errors: [/b]Invalid entity index, or lack of mod compliance.
    

     

    Kriax.

    Lien vers le commentaire
    Partager sur d’autres sites

    Tien test

     

    #pragma semicolon 1
    #include <sourcemod>
    #define PLUGIN_VERSION "1.0"
    
    public Plugin:myinfo =
    {
       name    = "Plugin Knifed",
       author    = "Azik" ,
       version     = PLUGIN_VERSION,
    };
    
    new Handle:g_hEnable;
    new Handle:g_hAnnouce;
    new Handle:g_hKniferhealth = INVALID_HANDLE;
    new g_iKniferhealt = 0;
    
    
    public OnPluginStart()
    {
       CreateConVar("css_kniferhealth_version", PLUGIN_VERSION, "La version du plugins", FCVAR_PLUGIN|FCVAR_NOTIFY|FCVAR_SPONLY);
       g_hEnable = CreateConVar("css_kniferhealth_enable", "1", "Mettre le plugins ON (1) et OFF (2)", FCVAR_PLUGIN, true, 0.0, true, 1.0);
       g_hAnnouce = CreateConVar("css_kniferhealth_message", "1", "Mettre un message si on tue au couteau?", FCVAR_PLUGIN);
       g_hKniferhealth = CreateConVar("css_kniferhealth", "10", "Combien d'HP gagne t-on si on tue au cut ?", FCVAR_PLUGIN);
       RegConsoleCmd("kh", Command_OnOff, "Is KniferHealth On/Off?");
       HookEvent("player_death", Event_player_knifed);
       //The Config File
       AutoExecConfig(true, "css_kniferhealth");
    }
    
    public OnConfigsExecuted()
    {
       g_iKniferhealt = GetConVarInt(g_hKniferhealth);
    }
    
    public Action:Event_player_knifed(Handle:event, const String:name[], bool:dontBroadcast)
    {
       //Enables The Plugin.
       if (GetConVarInt(g_hEnable) > 0)
       {
           new client = GetClientOfUserId(GetEventInt(event, "attacker"));
           //checks to see whether its an actual client.
           //if (client > 0 && client < 20)
           for(client = 0; client <= MaxClients; client++)
           {
               decl String:weaponName[32];
               decl String:killerName[32];
               decl String:victimName[32];
               //decl String:target[32], String:health[10];
               GetEventString(event,"weapon",weaponName,32);
    
               //if the weapon used in death was a knife it continues
    
               if(StrEqual(weaponName, "knife"))
               {
                   new userid = GetEventInt(event, "userid");
                   new userid2 = GetEventInt(event, "attacker");
                   new victim = GetClientOfUserId(userid);
                   new killer = GetClientOfUserId(userid2);
                   //continues
                   if(victim != 0 && killer != 0)
                   {
                       new victimTeam = GetClientTeam(victim);
                       new killerTeam = GetClientTeam(killer);
    
    
                       if(killerTeam != victimTeam)
                       {
                           GetClientName(victim, victimName, 32);
                           GetClientName(killer, killerName, 32);
    
                           //Hints Messages to attacker and victim
                           if (GetConVarInt(g_hAnnouce) > 0)
                           {
                               PrintHintText(victim, "Tu as ete tue au couteau par %s !", killerName);
                               PrintHintText(killer, "Tu as tue %s. Tu gagnes %i hp !", victimName, g_iKniferhealt);
                           }
                           //new m_Offset = FindSendPropOffs("CTFPlayer", "m_iHealth"); //Offset
    
                           //adds health to the knifer according to the convar's integer.
                           new kHealth = GetClientHealth(killer);
                           SetEntityHealth(killer, kHealth + g_iKniferhealt);
                       }
                   }
               }
           }
       }
    }
    
    
    public Action:Command_OnOff(client, args)
    {
       if (GetConVarInt(g_hEnable) == 1)
       {
           //\x04 is the color green(I think)
           PrintToChat(client, "\x01Le script CutHP est actuellement \x04Actif\x01!");
       }
       else if (GetConVarInt(g_hEnable) == 0)
       {
           PrintToChat(client, "\x01Le script CutHP est actuellement \x04Inactif\x01!");
       }
       return Plugin_Handled;
    }
    

    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...