Raised This Month: $ Target: $400
 0% 

vip plugin[CSGO]


Post New Thread Reply   
 
Thread Tools Display Modes
Mitchell
~lick~
Join Date: Mar 2010
Old 12-15-2016 , 10:18   Re: vip plugin[CSGO]
Reply With Quote #11

Quote:
Originally Posted by nhnkl159 View Post
Why just do not compare GetClientTeam(client) to 2..
and if the player is in spectate (team == 1) ? , you can just avoid simple problems.
Well looking at the code it would get a random client from the server, no matter the team, then return and check the team of the random player to see if it's on X team. Which means that it would sometimes not pick a random player at all.
Mitchell is offline
nhnkl159
Senior Member
Join Date: Jul 2012
Location: Israel 3>
Old 12-15-2016 , 10:25   Re: vip plugin[CSGO]
Reply With Quote #12

Quote:
Originally Posted by Mitchell View Post
Well looking at the code it would get a random client from the server, no matter the team, then return and check the team of the random player to see if it's on X team. Which means that it would sometimes not pick a random player at all.
Now i was looking at the RandomPlayer function , and you are right.


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

#define PLUGIN_AUTHOR     "Arkarr"  
#define PLUGIN_VERSION     "1.00"  

EngineVersion g_Game;  

public Plugin myinfo =   
{  
    name = "[CSS/CSGO] Another shitty VIP plugin",   
    author = PLUGIN_AUTHOR,   
    description = "130HP + 100Armor each round",   
    version = PLUGIN_VERSION,   
    url = "http://www.sourcemod.net"  
};  

public void OnPluginStart()  
{  
    g_Game = GetEngineVersion();  
    if (g_Game != Engine_CSGO && g_Game != Engine_CSS)  
        SetFailState("This plugin is for CSGO/CSS only.");  
          
    HookEvent("round_start", Event_RoundStart);  
}  

public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)  
{  
    int client = GetRandomPlayer();  
      
    if(IsValidClient(client))  
    { 
         GivePlayerItem(client, "weapon_flashbang"); 
         GivePlayerItem(client, "weapon_taser"); 
         SetEntityHealth(client, 80);
         //SetEntProp(client, Prop_Data, "m_iMaxHealth", 80);  This shit isnt necessary..
         PrintToChat(client, "[BN] You got the rebel kit for this round");  
    }  
}  

stock bool IsValidClient(int iClient, bool bReplay = true)  
{  
    if (iClient <= 0 || iClient > MaxClients)  
        return false;  
    if (!IsClientInGame(iClient))  
        return false;  
    if (bReplay && (IsClientSourceTV(iClient) || IsClientReplay(iClient)))  
        return false;  
    return true;  
}  

stock GetRandomPlayer()   
{  
    int clients[MAXPLAYERS+1], clientCount;   
    for (int i = 1; i <= MaxClients; i++)  
        if (IsClientInGame(i) && GetClientTeam(i) == 2)  
            clients[clientCount++] = i;  
    return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount-1)];  
}
This code should work well for you.
__________________

Last edited by nhnkl159; 12-15-2016 at 10:44.
nhnkl159 is offline
Send a message via Skype™ to nhnkl159
YellowSwag
Senior Member
Join Date: Jul 2016
Old 12-16-2016 , 11:34   Re: vip plugin[CSGO]
Reply With Quote #13

[quote=nhnkl159;2477996]now i was looking at the randomplayer function , and you are right.


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

#define plugin_author     "arkarr"  
#define plugin_version     "1.00"  

engineversion g_game;  

public plugin myinfo =   
{  
    name = "[css/csgo] another shitty vip plugin",   
    author = plugin_author,   
    description = "130hp + 100armor each round",   
    version = plugin_version,   
    url = "http://www.sourcemod.net"  
};  

public void onpluginstart()  
{  
    g_game = getengineversion();  
    if (g_game != engine_csgo && g_game != engine_css)  
        setfailstate("this plugin is for csgo/css only.");  
          
    hookevent("round_start", event_roundstart);  
}  

public void event_roundstart(handle event, const char[] name, bool dontbroadcast)  
{  
    int client = getrandomplayer();  
      
    if(isvalidclient(client))  
    { 
         giveplayeritem(client, "weapon_flashbang"); 
         giveplayeritem(client, "weapon_taser"); 
         setentityhealth(client, 80);
         //setentprop(client, prop_data, "m_imaxhealth", 80);  this shit isnt necessary..
         Printtochat(client, "[bn] you got the rebel kit for this round");  
    }  
}  

stock bool isvalidclient(int iclient, bool breplay = true)  
{  
    if (iclient <= 0 || iclient > maxclients)  
        return false;  
    if (!isclientingame(iclient))  
        return false;  
    if (breplay && (isclientsourcetv(iclient) || isclientreplay(iclient)))  
        return false;  
    return true;  
}  

stock getrandomplayer()   
{  
    int clients[maxplayers+1], clientcount;   
    for (int i = 1; i <= maxclients; i++)  
        if (isclientingame(i) && getclientteam(i) == 2)  
            clients[clientcount++] = i;  
    return (clientcount == 0) ? -1 : Clients[getrandomint(0, clientcount-1)];  
}
plugin.sp(7) : error 139: could not find type "engineversion"
plugin.sp(9) : error 139: could not find type "plugin"
plugin.sp(16) : error 010: invalid function or declaration
plugin.sp(20) : error 017: undefined symbol "getengineversion"
plugin.sp(21) : error 017: undefined symbol "engine_csgo"
plugin.sp(22) : error 017: undefined symbol "setfailstate"
plugin.sp(24) : error 017: undefined symbol "hookevent"
plugin.sp(27) : error 139: could not find type "handle"
plugin.sp(33) : error 017: undefined symbol "giveplayeritem"
plugin.sp(34) : error 017: undefined symbol "giveplayeritem"
plugin.sp(35) : error 017: undefined symbol "setentityhealth"
plugin.sp(37) : error 017: undefined symbol "Printtochat"
plugin.sp(43) : error 017: undefined symbol "maxclients"
plugin.sp(45) : error 017: undefined symbol "isclientingame"
plugin.sp(47) : error 017: undefined symbol "isclientsourcetv"
plugin.sp(54) : error 017: undefined symbol "maxplayers"
plugin.sp(55) : error 017: undefined symbol "maxclients"
plugin.sp(56) : error 017: undefined symbol "isclientingame"
plugin.sp(5 : error 017: undefined symbol "Clients"
plugin.sp(5 : error 017: undefined symbol "getrandomint"
plugin.sp(5 : error 029: invalid expression, assumed zero
plugin.sp(5 : fatal error 190: too many error messages on one line

Last edited by YellowSwag; 12-16-2016 at 11:40.
YellowSwag is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 12-16-2016 , 12:52   Re: vip plugin[CSGO]
Reply With Quote #14

This shoud work:
PHP Code:
#include <sourcemod>  
#include <sdkhooks>
#include <colors>
#include <mystocks>

#define plugin_author     "arkarr"  
#define plugin_version     "1.00"  

EngineVersion g_Game;  

public 
Plugin myinfo =   
{  
    
name "[css/csgo] another shitty vip plugin",   
    
author plugin_author,   
    
description "130hp + 100armor each round",   
    
version plugin_version,   
    
url "http://www.sourcemod.net"  
};  

public 
void onpluginstart()  
{  
    
g_Game GetEngineVersion();
    if(
g_Game != Engine_CSGO && g_Game != Engine_CSS)
    {
        
SetFailState("This plugin is for CSGO/CSS only.");    
    }

    
HookEvent("round_start"event_roundstart);  
}  

public 
void event_roundstart(Handle event, const char[] namebool dontbroadcast)  
{  
    
int client GetRandomAlivePlayer();  
      
    if(
IsValidClient(client))  
    { 
         
GivePlayerItem(client"weapon_flashbang"); 
         
GivePlayerItem(client"weapon_taser"); 
         
SetEntityHealth(client80);
         
//setentprop(client, prop_data, "m_imaxhealth", 80);  this shit isnt necessary..
         
CPrintToChat(client"{green}[SM]{darkred}You got rebel kit for this round");  
    }  

Make sure use this (mystocks.inc) include. (by shanapu)

PS: In your paste what appened with Capital letters?
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 12-16-2016 at 12:55.
Papero is offline
YellowSwag
Senior Member
Join Date: Jul 2016
Old 12-16-2016 , 18:02   Re: vip plugin[CSGO]
Reply With Quote #15

Quote:
Originally Posted by Papero View Post
This shoud work:
PHP Code:
#include <sourcemod>  
#include <sdkhooks>
#include <colors>
#include <mystocks>

#define plugin_author     "arkarr"  
#define plugin_version     "1.00"  

EngineVersion g_Game;  

public 
Plugin myinfo =   
{  
    
name "[css/csgo] another shitty vip plugin",   
    
author plugin_author,   
    
description "130hp + 100armor each round",   
    
version plugin_version,   
    
url "http://www.sourcemod.net"  
};  

public 
void onpluginstart()  
{  
    
g_Game GetEngineVersion();
    if(
g_Game != Engine_CSGO && g_Game != Engine_CSS)
    {
        
SetFailState("This plugin is for CSGO/CSS only.");    
    }

    
HookEvent("round_start"event_roundstart);  
}  

public 
void event_roundstart(Handle event, const char[] namebool dontbroadcast)  
{  
    
int client GetRandomAlivePlayer();  
      
    if(
IsValidClient(client))  
    { 
         
GivePlayerItem(client"weapon_flashbang"); 
         
GivePlayerItem(client"weapon_taser"); 
         
SetEntityHealth(client80);
         
//setentprop(client, prop_data, "m_imaxhealth", 80);  this shit isnt necessary..
         
CPrintToChat(client"{green}[SM]{darkred}You got rebel kit for this round");  
    }  

Make sure use this (mystocks.inc) include. (by shanapu)

PS: In your paste what appened with Capital letters?
Code:
         CPrintToChat(client, "{green}[SM]{darkred}You got rebel kit for this round");
i think this plugin only for css i need to csgo, maybe its for csgo (not tested) but i think you wrong im right?
YellowSwag is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 12-17-2016 , 07:40   Re: vip plugin[CSGO]
Reply With Quote #16

Quote:
Originally Posted by YellowSwag View Post
Code:
         CPrintToChat(client, "{green}[SM]{darkred}You got rebel kit for this round");
i think this plugin only for css i need to csgo, maybe its for csgo (not tested) but i think you wrong im right?
Nope, I tested it and the color worked.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
YellowSwag
Senior Member
Join Date: Jul 2016
Old 12-17-2016 , 08:50   Re: vip plugin[CSGO]
Reply With Quote #17

Quote:
Originally Posted by Papero View Post
Nope, I tested it and the color worked.
Code:
#include <sourcemod>  
#include <sdkhooks>
#include <colors>
#include <mystocks>

#define plugin_author     "arkarr"  
#define plugin_version     "1.00"  

EngineVersion g_Game;  

public Plugin myinfo =   
{  
    name = "[css/csgo] another shitty vip plugin",   
    author = plugin_author,   
    description = "130hp + 100armor each round",   
    version = plugin_version,   
    url = "http://www.sourcemod.net"  
};  

public void onpluginstart()  
{  
    g_Game = GetEngineVersion();
    if(g_Game != Engine_CSGO && g_Game != Engine_CSS)
    {
        SetFailState("This plugin is for CSGO/CSS only.");    
    }

    HookEvent("round_start", event_roundstart);  
}  

public void event_roundstart(Handle event, const char[] name, bool dontbroadcast)  
{  
    int client = GetRandomAlivePlayer();  
      
    if(IsValidClient(client))  
    { 
         GivePlayerItem(client, "weapon_flashbang"); 
         GivePlayerItem(client, "weapon_taser"); 
         SetEntityHealth(client, 80);
         //setentprop(client, prop_data, "m_imaxhealth", 80);  this shit isnt necessary..
         CPrintToChat(client, " \x05[sm]\x01 You got \x07rebel kit\x01 for this round");  
    }  
}
this will work? i cant test because i have server problems
YellowSwag is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 12-17-2016 , 10:40   Re: vip plugin[CSGO]
Reply With Quote #18

For me worked but if you want a version without colors here you are:
PHP Code:
#include <sourcemod>  
#include <sdkhooks>
#include <mystocks>

#define plugin_author     "arkarr"  
#define plugin_version     "1.00"  

EngineVersion g_Game;  

public 
Plugin myinfo =   
{  
    
name "[css/csgo] another shitty vip plugin",   
    
author plugin_author,   
    
description "130hp + 100armor each round",   
    
version plugin_version,   
    
url "http://www.sourcemod.net"  
};  

public 
void onpluginstart()  
{  
    
g_Game GetEngineVersion();
    if(
g_Game != Engine_CSGO && g_Game != Engine_CSS)
    {
        
SetFailState("This plugin is for CSGO/CSS only.");    
    }

    
HookEvent("round_start"event_roundstart);  
}  

public 
void event_roundstart(Handle event, const char[] namebool dontbroadcast)  
{  
    
int client GetRandomAlivePlayer();  
      
    if(
IsValidClient(client))  
    { 
         
GivePlayerItem(client"weapon_flashbang"); 
         
GivePlayerItem(client"weapon_taser"); 
         
SetEntityHealth(client80);
         
//setentprop(client, prop_data, "m_imaxhealth", 80);  this shit isnt necessary..
         
PrintToChat(client" \x05[sm]\x01 You got \x07rebel kit\x01 for this round");  
    }  

__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 12-17-2016 at 10:40.
Papero 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 08:58.


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