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

Solved [CS:GO] !kit req


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jezis
AlliedModders Donor
Join Date: Jul 2016
Location: Czech Republic
Old 08-27-2017 , 12:05   [CS:GO] !kit req
Reply With Quote #1

Hello,

could somebody do a plugin, which would give ak and deagle once per round after writing !kit? But only for people who have specific word in name?


Thanks in advance,
Jezis
__________________


Last edited by Jezis; 08-27-2017 at 18:47.
Jezis is offline
Send a message via ICQ to Jezis
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 08-27-2017 , 15:37   Re: [CS:GO] !kit req
Reply With Quote #2

Should work
PHP Code:
#pragma semicolon 1

#define PLUGIN_AUTHOR "CamerDisco"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>

#define Loop(%1) for(int %1 = 1; %1 < MaxClients; %1++) if(IsValidClient(%1))
#define WORD "MAX-PLAY.PL"

#pragma newdecls required

bool Can[MAXPLAYERS 1];

public 
Plugin myinfo 
{
    
name "Give ak and deagle",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url "http://max-play.pl"
};

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_kit"Kit);
    
    
HookEvent("round_end"End);
}

public 
Action End(Event event, const char[] namebool dontBroadcast)
{
    
Loop(i)
        
Can[i] = true;
}

public 
void OnClientPutInServer(int client)
{
    
Can[client] = true;
}

public 
Action Kit(int clientint args)
{
    if(
Can[client])
    {
        
char sName[MAX_NAME_LENGTH];
        
GetClientName(clientsNamesizeof(sName));
        if(
StrContains(sNameWORD) != -1)
        {
            
GivePlayerItem(client"weapon_ak47");
            
GivePlayerItem(client"weapon_deagle");
        }
        else
        {
            
PrintToChat(client"You don't have %s in your nickname!"WORD);
        }
    }
    else
    {
        
PrintToChat(client"You used it on this round!");
    }
}

stock bool IsValidClient(int client)
{
    if(
client >= && client <= MaxClients && IsClientInGame(client))
        return 
true;

    return 
false;

__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
Jezis
AlliedModders Donor
Join Date: Jul 2016
Location: Czech Republic
Old 08-27-2017 , 18:47   Re: [CS:GO] !kit req
Reply With Quote #3

Works fine.
Thank you
__________________

Jezis is offline
Send a message via ICQ to Jezis
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 08-27-2017 , 20:30   Re: [CS:GO] !kit req
Reply With Quote #4

Quote:
Originally Posted by CamerDisco View Post
Should work
PHP Code:

#define Loop(%1) for(int %1 = 1; %1 < MaxClients; %1++) if(IsValidClient(%1)) 
I have read some times that #define for loops isn't a good way.
edit: found it https://forums.alliedmods.net/showthread.php?p=2228277
__________________
coding & free software

Last edited by shanapu; 08-27-2017 at 20:32.
shanapu is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 08-28-2017 , 06:05   Re: [CS:GO] !kit req
Reply With Quote #5

Thanks shanapu, I will remember this ;)
__________________


Max-Play.pl - the best polish servers
CamerDisco 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 02:14.


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