Raised This Month: $51 Target: $400
 12% 

!gift and flag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Coyote570
Junior Member
Join Date: Apr 2013
Old 08-16-2016 , 18:31   !gift and flag
Reply With Quote #1

Hello,

I need to add a flag to use command !gift on this .sp, but I don't know where I need to set it.

Code:
#include <sdktools>
#include <sourcemod>

new gift[MAXPLAYERS+1];

public Plugin:myinfo = 
{
    name = "Gift",
    author = "Delachambre",
    description = "Plugin Gift",
    version = "1.0",
    url = "http://rp.team-magnetik.fr"
}

public OnPluginStart()
{
    RegConsoleCmd("sm_gift", Command_Gift);
    
    HookEvent("player_spawn", OnPlayerSpawn);
}

public OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    
    if (IsPlayerAlive(client))
    {
        PrintToChat(client, "[VIP] : Vous pouvez tapé !gift.");
        gift[client] = 1;
    }
}

public Action:Command_Gift(client, args)
{
    if (IsPlayerAlive(client))
    {
        if (gift[client] > 0)
        {
            new bonus = GetRandomInt(1, 19);
                
            if ((bonus == 1) || (bonus == 2) || (bonus == 3))
            {
                new health = GetClientHealth(client);
                new nowhealth = health + 15;
                    
                SetEntityHealth(client, nowhealth);
                    
                PrintToChat(client, "[VIP] : Vous avez gagné 15 HP.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
            else if ((bonus == 4) || (bonus == 5) || (bonus == 6))
            {
                new armor = GetEntProp(client, Prop_Send, "m_ArmorValue", 4);
                new nowarmor = armor + 15;
                    
                SetEntProp(client, Prop_Send, "m_ArmorValue", nowarmor, 1);
                    
                PrintToChat(client, "[VIP] : Vous avez gagné 15 d'armure en plus.");
                gift[client]--;
                
                return Plugin_Handled;
            }
            else if (bonus == 7)
            {
                GivePlayerItem(client, "weapon_awp");
                    
                PrintToChat(client, "[VIP] : Vous avez gagné une awp.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
            else if ((bonus == 8) || (bonus == 9) || (bonus == 10))
            {
                new Float:speed = GetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue");
                new Float:nowspeed = speed + 0.2;
                    
                SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", nowspeed);
                    
                PrintToChat(client, "[VIP] : Vous avez gagné de la vitesse.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
            else if ((bonus == 11) || (bonus == 12))
            {
                GivePlayerItem(client, "weapon_hegrenade");
                GivePlayerItem(client, "weapon_flashbang");
                GivePlayerItem(client, "weapon_smokegrenade");
                    
                PrintToChat(client, "[VIP] : Vous avez gagné un pack de grenade.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
            else if ((bonus == 13) || (bonus == 14) || (bonus == 15))
            {
                PrintToChat(client, "[VIP] : Vous n'avez rien gagné.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
            else if ((bonus == 16))
            {
                new Float:speed = GetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue");
                new Float:nowspeed = speed - 0.2;
                    
                SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", nowspeed);
                    
                PrintToChat(client, "[VIP] : Vous avez perdu de la vitesse.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
            else if ((bonus == 17))
            {
                new armor = GetEntProp(client, Prop_Send, "m_ArmorValue", 4);
                new nowarmor = armor - 15;
                    
                SetEntProp(client, Prop_Send, "m_ArmorValue", nowarmor, 1);
                    
                PrintToChat(client, "[VIP] : Vous avez perdu 15 d'armure en plus.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
            if ((bonus == 18))
            {
                new health = GetClientHealth(client);
                new nowhealth = health - 15;
                    
                SetEntityHealth(client, nowhealth);
                    
                PrintToChat(client, "[VIP] : Vous avez perdu 15 HP.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
            else if (bonus == 19)
            {
                GivePlayerItem(client, "weapon_ssg08");
                    
                PrintToChat(client, "[VIP] : Vous avez gagné un SSG-08.");
                gift[client]--;
                    
                return Plugin_Handled;
            }
        }
        else
        {
            PrintToChat(client, "[VIP] : Vous avez déjà utilisé votre !gift.");
                
            return Plugin_Handled;
        }
    }
    else
    {
        PrintToChat(client, "[VIP] : Vous devez être vivant.");
        
        return Plugin_Handled;
    }
    return Plugin_Continue;
}
Do you have an idea ?
Coyote570 is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 08-16-2016 , 19:38   Re: !gift and flag
Reply With Quote #2

Trashed by request of author because of a duplicate thread, original thread here: https://forums.alliedmods.net/showthread.php?t=286400
sneaK is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode