Raised This Month: $32 Target: $400
 8% 

[CSS] Gift random.


Post New Thread Reply   
 
Thread Tools Display Modes
Author
delachambre
AlliedModders Donor
Join Date: Jan 2011
Location: France
Plugin ID:
2808
Plugin Version:
1.0
Plugin Category:
Gameplay
Plugin Game:
Counter-Strike: Source
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    a lot of gift choose random
    Old 02-19-2012 , 14:17   [CSS] Gift random.
    Reply With Quote #1

    A gift choose random for CS : S

    Preferency, JailBreak Server.

    Cordialy
    Attached Files
    File Type: sp Get Plugin or Get Source (gift.sp - 2569 views - 4.0 KB)
    delachambre is offline
    Blacksilver
    Member
    Join Date: Aug 2011
    Location: G E R M A N Y
    Old 02-19-2012 , 18:33   Re: [CSS] Gift random.
    Reply With Quote #2

    More details about the Plugin like commands?
    __________________
    Come to the dark side, we have cookies *muhaha*
    Visit us!

    Blacksilver is offline
    Mitchell
    ~lick~
    Join Date: Mar 2010
    Old 02-20-2012 , 00:37   Re: [CSS] Gift random.
    Reply With Quote #3

    Since he is french, here is what it does: from me running through the Source codec.

    Player can type !gift, and picks a number from 1 to 19.

    if you get a 1, 2, or a 3: you get a 15points added to your health.
    if you get a 4, 5, or a 6: you get a 15point armor bonus.
    if you roll a 7: you get a usp.
    if you roll a 8,9,10: you get a little speed bonus.
    roll a 11, or 12: you get 1 hegrenade, 1 flash, 1 smoke.
    roll a 13, 14,15: nothing.
    roll a 17 you get a -15 armor bonus.
    roll a 18 you get a -15 health bonus.
    roll a 19 you get a glock.

    This is basically a RTD, meant for jail mod.
    but it also is in french with no support of translation.
    So i will do it with love:
    PHP 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] : Type !gift for a free grft!");
            
    gift[client] = 1;
        }
    }

    public 
    Action:Command_Gift(clientargs)
    {
        if (
    IsPlayerAlive(client))
        {
            if (
    gift[client] > 0)
            {
                new 
    bonus GetRandomInt(119);
                    
                if ((
    bonus == 1) || (bonus == 2) || (bonus == 3))
                {
                    new 
    health GetClientHealth(client);
                    new 
    nowhealth health 15;
                        
                    
    SetEntityHealth(clientnowhealth);
                        
                    
    PrintToChat(client"[VIP] : You were gifted extra HP!");
                    
    gift[client]--;
                        
                    return 
    Plugin_Handled;
                }
                else if ((
    bonus == 4) || (bonus == 5) || (bonus == 6))
                {
                    new 
    armor GetEntProp(clientProp_Send"m_ArmorValue"4);
                    new 
    nowarmor armor 15;
                        
                    
    SetEntProp(clientProp_Send"m_ArmorValue"nowarmor1);
                        
                    
    PrintToChat(client"[VIP] : You were gifted extra Armor!");
                    
    gift[client]--;
                    
                    return 
    Plugin_Handled;
                }
                else if (
    bonus == 7)
                {
                    
    GivePlayerItem(client"weapon_usp");
                        
                    
    PrintToChat(client"[VIP] : You were gifted an USP!");
                    
    gift[client]--;
                        
                    return 
    Plugin_Handled;
                }
                else if ((
    bonus == 8) || (bonus == 9) || (bonus == 10))
                {
                    new 
    Float:speed GetEntPropFloat(clientProp_Data"m_flLaggedMovementValue");
                    new 
    Float:nowspeed speed 0.2;
                        
                    
    SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"nowspeed);
                        
                    
    PrintToChat(client"[VIP] : You were gifted a speed bonus!");
                    
    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] : You were gifted a grenade pack!");
                    
    gift[client]--;
                        
                    return 
    Plugin_Handled;
                }
                else if ((
    bonus == 13) || (bonus == 14) || (bonus == 15))
                {
                    
    PrintToChat(client"[VIP] : Sorry, you didnt get any gifts.");
                    
    gift[client]--;
                        
                    return 
    Plugin_Handled;
                }
                else if ((
    bonus == 16))
                {
                    new 
    Float:speed GetEntPropFloat(clientProp_Data"m_flLaggedMovementValue");
                    new 
    Float:nowspeed speed 0.2;
                        
                    
    SetEntPropFloat(clientProp_Data"m_flLaggedMovementValue"nowspeed);
                        
                    
    PrintToChat(client"[VIP] : You were gifted a slower speed.");
                    
    gift[client]--;
                        
                    return 
    Plugin_Handled;
                }
                else if ((
    bonus == 17))
                {
                    new 
    armor GetEntProp(clientProp_Send"m_ArmorValue"4);
                    new 
    nowarmor armor 15;
                        
                    
    SetEntProp(clientProp_Send"m_ArmorValue"nowarmor1);
                        
                    
    PrintToChat(client"[VIP] : You were gifted less armor.");
                    
    gift[client]--;
                        
                    return 
    Plugin_Handled;
                }
                if ((
    bonus == 18))
                {
                    new 
    health GetClientHealth(client);
                    new 
    nowhealth health 15;
                        
                    
    SetEntityHealth(clientnowhealth);
                        
                    
    PrintToChat(client"[VIP] : You were gifted less HP.");
                    
    gift[client]--;
                        
                    return 
    Plugin_Handled;
                }
                else if (
    bonus == 19)
                {
                    
    GivePlayerItem(client"weapon_glock");
                        
                    
    PrintToChat(client"[VIP] : You were gifted a Glock!");
                    
    gift[client]--;
                        
                    return 
    Plugin_Handled;
                }
            }
            else
            {
                
    PrintToChat(client"[VIP] : You only get one gift per life!");
                    
                return 
    Plugin_Handled;
            }
        }
        else
        {
            
    PrintToChat(client"[VIP] : You must be alive to claim your gift!");
            
            return 
    Plugin_Handled;
        }
        return 
    Plugin_Continue;


    Last edited by Mitchell; 02-20-2012 at 00:38.
    Mitchell is offline
    delachambre
    AlliedModders Donor
    Join Date: Jan 2011
    Location: France
    Old 02-20-2012 , 13:14   Re: [CSS] Gift random.
    Reply With Quote #4

    Thanks for translations

    I'm French :s I don't speak english.
    delachambre is offline
    Drixevel
    AlliedModders Donor
    Join Date: Sep 2009
    Location: Somewhere headbangin'
    Old 02-20-2012 , 18:02   Re: [CSS] Gift random.
    Reply With Quote #5

    Add translation support ot the plugin so people can use their native language.
    Drixevel is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 02-21-2012 , 16:34   Re: [CSS] Gift random.
    Reply With Quote #6

    This was done rather quickly and is completely untested, but here's a version with translation support.

    I probably should have just had one translation string for each line, but I noticed a lot of repetition, so I split things like "gained" and "lost" into their own translations. You can change them around if you wish.
    Attached Files
    File Type: zip gift translations.zip (8.0 KB, 343 views)
    File Type: sp Get Plugin or Get Source (gift.sp - 1293 views - 4.0 KB)
    __________________
    Not currently working on SourceMod plugin development.
    Powerlord is offline
    delachambre
    AlliedModders Donor
    Join Date: Jan 2011
    Location: France
    Old 02-22-2012 , 13:59   Re: [CSS] Gift random.
    Reply With Quote #7

    Thanks for translations
    delachambre is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 02-24-2012 , 15:59   Re: [CSS] Gift random.
    Reply With Quote #8

    Wow, I don't know what I was thinking with my previous translation stuff.

    Here's a new one that translates them as whole phrases. Oh, and it fixes some bugs in the translation files, too.

    The new version also allows you to specify the amount of health or armor lost in the translation string, in case you decide to change the amount later.
    Attached Files
    File Type: sp Get Plugin or Get Source (gift.sp - 1316 views - 3.9 KB)
    File Type: zip gift translations.zip (2.7 KB, 336 views)
    __________________
    Not currently working on SourceMod plugin development.

    Last edited by Powerlord; 02-24-2012 at 15:59.
    Powerlord is offline
    delachambre
    AlliedModders Donor
    Join Date: Jan 2011
    Location: France
    Old 02-24-2012 , 16:08   Re: [CSS] Gift random.
    Reply With Quote #9

    Wow thx
    delachambre is offline
    Reply


    Thread Tools
    Display Modes

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


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