Raised This Month: $ Target: $400
 0% 

[HELP] Check this code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lawnmoverman
Member
Join Date: Jan 2017
Old 02-24-2017 , 19:11   [HELP] Check this code
Reply With Quote #1

Hi, as I finally done with this plugin I would like that someone take a look at it and tell me is there something wrong, or is there any kind of issues. Plugin compiles with some minor warnings, I still not tested it on server. I wanted your opinions first. Please correct what you can, or let me know.

Here's plugin:

PHP Code:
/**
 * Nozgaming.eu VIP Management 1.0 (c) Lawnmoverman
 * www.nozgaming.eu | cs.nozgaming.eu
 *
 * Precache vip player models in your sub plugin
 * This plugin should be last in your plugins.ini list
**/

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike> 
#include <fun> 
#include <hamsandwich> 
#include <chatcolor>
#include <dhudmessage>

new UserName[32];
new 
SteamID[34];
new 
UserID[3];
new 
CsTeams:g_iTeam[33];
new 
bool:HasSite;

public 
plugin_init()
{
    
register_plugin("Nozgaming.eu VIP Management""1.0""Lawnmoverman");
    
register_event("TeamInfo""event_TeamInfo""a");
}

// Tell to all that VIP joined the server
public client_putinserver(id)
{
    if(
get_user_flags(id) & read_flags("s"))
    { 
        
get_user_name(idUserNamecharsmax(UserName));

        
client_print_color(00,"^3[Vip] ^4User^3 %s ^4have joined the server, ^3VIP ^4priveleges granted!"UserName);
    }
}

// Set VIP model to player
public fw_spawn_post(id
{
    if(
get_user_flags(id) & read_flags("s"))
    {
        if (!
is_user_alive(id)) 
            return 
HAM_IGNORED;

        new 
CsTeams:team cs_get_user_team(id); 
        
cs_set_user_model(idteam == CS_TEAM_CT "noz_vip_ct" "noz_vip_t"); // Your model names here 

        
return HAM_IGNORED;
    } 
}

// VIP extras on spawn
public player_spawn(id
{
    if(
get_user_flags(id) & read_flags("s"))
    {
        if (!
is_user_alive(id)) 

        
cs_set_user_money(id, (cs_get_user_money(id) + 500)); // Gives extra $500 on every spawn
        // Gives 2 flashbangs and 1 smokegrenade
        
give_item(id,"weapon_flashbang");
        
give_item(id,"weapon_flashbang");
        
give_item(id,"weapon_smokegrenade");

        
set_user_health(id120); // Sets user health to 120

        
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,30); // Makes player semi transparent
        
set_task(5.0"renderNormal"id); // Makes player normal after 5 secs

        // Gives defuser if CT
        
if( is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT )
        {
            
cs_set_user_defuse(id1);
        } 
    } 
}

// Makes player rendering normal
public renderNormal(id)
{
    
set_user_rendering(idkRenderNormal);
}

// Events on VIP when changing team, or when joining team for the first time
public event_TeamInfo(id)
{
    if(
get_user_flags(id) & read_flags("s"))
    {    
        static 
sTeam[16];
        static const 
iTeamLen sizeof(sTeam) - 1;
        
read_data(2sTeamiTeamLen);
    
        static 
CsTeams:iTeam;
        switch(
sTeam[0])
        {
            case 
'U'iTeam CS_TEAM_UNASSIGNED;
            case 
'T'iTeam CS_TEAM_T;
            case 
'C'iTeam CS_TEAM_CT;
            case 
'S'iTeam CS_TEAM_SPECTATOR;
        }
    
        static 
idid read_data(1);
        if(
g_iTeam[id] != iTeam)
        {
            
// VIP joined new team
            
get_user_name(idUserNamecharsmax(UserName));

            if(
iTeam == CS_TEAM_T)
            {
                
// This will alert all players that VIP joined Ts
                
client_print_color(00,"^3[Vip] ^4User^3 %s ^4have joined the ^3Terrorists ^4team!"UserName);
            }
            if(
iTeam == CS_TEAM_CT)
            {
                
// This will alert all players that VIP joined CTs
                
client_print_color(00,"^3[Vip] ^4User^3 %s ^4have joined the ^3Counter-Terrorists ^4team!"UserName);
            }
            else
            {
                
// This will alert all players that VIP joined Spectators
                
client_print_color(00,"^3[Vip] ^4User^3 %s ^4have gone to ^3Spectators^4!"UserName);
            }

            if(
g_iTeam[id] == CS_TEAM_UNASSIGNED)
            {
            
// VIP joins team for the first time
            
set_task(10.0"alertPlayer"id);
            
set_task(10.0"setupVIP_3rdparty"id);
            }
        }
        
g_iTeam[id] = iTeam;
        return 
PLUGIN_CONTINUE;
    }
}

// This code alerts player that he is VIP, this is called after 10 secs, when player joins team for the first time 
public alertPlayer(id)
{
    
get_user_name(idUserNamecharsmax(UserName));
    
client_print_color(id0,"^3[Vip] ^4Welcome^3 %s ^4, you have ^3VIP ^4access, priveleges granted!"UserName);
    
set_dhudmessage4479255, -1.00.2526.03.00.11.5 );
    
show_dhudmessage(id"[Vip] Special priveleges granted!");
    
client_cmd(id"spk ^"access granted^"");
}

// Third party plugin commands to execute on VIP, when he joins team for the first time
public setupVIP_3rdparty(id)
{
    
server_cmd("amx_speed #%d ON 106"get_user_userid(id));
    
server_cmd("amx_autobhop #%d 1"get_user_userid(id));

Oh, and Please dont call me lame or smth. similar. Im still learning pawn.
__________________


www.nozgaming.eu | cs.nozgaming.eu

Last edited by Lawnmoverman; 02-24-2017 at 19:18.
Lawnmoverman is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-24-2017 , 21:15   Re: [HELP] Check this code
Reply With Quote #2

errors fixed :
PHP Code:
/**
 * Nozgaming.eu VIP Management 1.0 (c) Lawnmoverman
 * www.nozgaming.eu | cs.nozgaming.eu
 *
 * Precache vip player models in your sub plugin
 * This plugin should be last in your plugins.ini list
**/

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike> 
#include <fun> 
#include <hamsandwich> 
#include <chatcolor>
#include <dhudmessage>

new UserName[32];
/*new SteamID[34];
new UserID[3];*/
new CsTeams:g_iTeam[33];
/*new bool:HasSite;*/

public plugin_init()
{
    
register_plugin("Nozgaming.eu VIP Management""1.0""Lawnmoverman");
    
register_event("TeamInfo""event_TeamInfo""a");
}

// Tell to all that VIP joined the server
public client_putinserver(id)
{
    if(
get_user_flags(id) & read_flags("s"))
    { 
        
get_user_name(idUserNamecharsmax(UserName));

        
client_print_color(00,"^3[Vip] ^4User^3 %s ^4have joined the server, ^3VIP ^4priveleges granted!"UserName);
    }
}

// Set VIP model to player
public fw_spawn_post(id
{
    if(
get_user_flags(id) & read_flags("s"))
    {
        if (!
is_user_alive(id)) 
            return 
HAM_IGNORED;
        
        new 
CsTeams:team cs_get_user_team(id); 
        
cs_set_user_model(idteam == CS_TEAM_CT "noz_vip_ct" "noz_vip_t"); // Your model names here 
        
        
return HAM_IGNORED;
    }
    return 
PLUGIN_HANDLED;
}

// VIP extras on spawn
public player_spawn(id
{
    if(
get_user_flags(id) & read_flags("s"))
    {
        if (!
is_user_alive(id)) 

        
cs_set_user_money(id, (cs_get_user_money(id) + 500)); // Gives extra $500 on every spawn
        // Gives 2 flashbangs and 1 smokegrenade
        
give_item(id,"weapon_flashbang");
        
give_item(id,"weapon_flashbang");
        
give_item(id,"weapon_smokegrenade");

        
set_user_health(id120); // Sets user health to 120

        
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,30); // Makes player semi transparent
        
set_task(5.0"renderNormal"id); // Makes player normal after 5 secs

        // Gives defuser if CT
        
if( is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT )
        {
            
cs_set_user_defuse(id1);
        } 
    } 
}

// Makes player rendering normal
public renderNormal(id)
{
    
set_user_rendering(idkRenderNormal);
}

// Events on VIP when changing team, or when joining team for the first time
public event_TeamInfo(id)
{
    if(
get_user_flags(id) & read_flags("s"))
    {    
        static 
sTeam[16];
        static const 
iTeamLen sizeof(sTeam) - 1;
        
read_data(2sTeamiTeamLen);
        
        static 
CsTeams:iTeam;
        switch(
sTeam[0])
        {
            case 
'U'iTeam CS_TEAM_UNASSIGNED;
            case 
'T'iTeam CS_TEAM_T;
            case 
'C'iTeam CS_TEAM_CT;
            case 
'S'iTeam CS_TEAM_SPECTATOR;
        }
        
        static 
idid read_data(1);
        if(
g_iTeam[id] != iTeam)
        {
            
// VIP joined new team
            
get_user_name(idUserNamecharsmax(UserName));

            if(
iTeam == CS_TEAM_T)
            {
                
// This will alert all players that VIP joined Ts
                
client_print_color(00,"^3[Vip] ^4User^3 %s ^4have joined the ^3Terrorists ^4team!"UserName);
            }
            if(
iTeam == CS_TEAM_CT)
            {
                
// This will alert all players that VIP joined CTs
                
client_print_color(00,"^3[Vip] ^4User^3 %s ^4have joined the ^3Counter-Terrorists ^4team!"UserName);
            }
            else
            {
                
// This will alert all players that VIP joined Spectators
                
client_print_color(00,"^3[Vip] ^4User^3 %s ^4have gone to ^3Spectators^4!"UserName);
            }
            
            if(
g_iTeam[id] == CS_TEAM_UNASSIGNED)
            {
            
// VIP joins team for the first time
            
set_task(10.0"alertPlayer"id);
            
set_task(10.0"setupVIP_3rdparty"id);
            }
        }
        
g_iTeam[id] = iTeam;
        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_HANDLED;
}

// This code alerts player that he is VIP, this is called after 10 secs, when player joins team for the first time 
public alertPlayer(id)
{
    
get_user_name(idUserNamecharsmax(UserName));
    
client_print_color(id0,"^3[Vip] ^4Welcome^3 %s ^4, you have ^3VIP ^4access, priveleges granted!"UserName);
    
set_dhudmessage4479255, -1.00.2526.03.00.11.5 );
    
show_dhudmessage(id"[Vip] Special priveleges granted!");
    
client_cmd(id"spk ^"access granted^"");
}

// Third party plugin commands to execute on VIP, when he joins team for the first time
public setupVIP_3rdparty(id)
{
    
server_cmd("amx_speed #%d ON 106"get_user_userid(id));
    
server_cmd("amx_autobhop #%d 1"get_user_userid(id));

yas17sin is offline
Send a message via ICQ to yas17sin
Lawnmoverman
Member
Join Date: Jan 2017
Old 02-25-2017 , 06:17   Re: [HELP] Check this code
Reply With Quote #3

Lots of code is not working, or is working not how it should be. I thing its my problem. Ill post new code as soon as I can fix it up.
__________________


www.nozgaming.eu | cs.nozgaming.eu
Lawnmoverman is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-25-2017 , 06:45   Re: [HELP] Check this code
Reply With Quote #4

i didn't test it i just did compile it, so ...
yas17sin is offline
Send a message via ICQ to yas17sin
Lawnmoverman
Member
Join Date: Jan 2017
Old 02-25-2017 , 06:49   Re: [HELP] Check this code
Reply With Quote #5

I know, in fact I told that those are my errors. I need to tweak it better. Probably Im going to ask to someone to write the plugin for me with what I want. I suppose that I cant do it myself.
__________________


www.nozgaming.eu | cs.nozgaming.eu

Last edited by Lawnmoverman; 02-25-2017 at 06:52.
Lawnmoverman is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-25-2017 , 06:52   Re: [HELP] Check this code
Reply With Quote #6

yeah, you did test the code or not ?
yas17sin is offline
Send a message via ICQ to yas17sin
Lawnmoverman
Member
Join Date: Jan 2017
Old 02-25-2017 , 07:12   Re: [HELP] Check this code
Reply With Quote #7

I tested it but many things are not working at all or are working in wrong way.
__________________


www.nozgaming.eu | cs.nozgaming.eu
Lawnmoverman is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-25-2017 , 07:32   Re: [HELP] Check this code
Reply With Quote #8

any log or smth ?
yas17sin is offline
Send a message via ICQ to yas17sin
Lawnmoverman
Member
Join Date: Jan 2017
Old 02-25-2017 , 07:36   Re: [HELP] Check this code
Reply With Quote #9

Well.

set_user_money is not working
all players are anonounced as vip
3rd party works for normal users and not vip
give nades are not working
player models are not working (neither with cl_minmodels 0)
render on round start is not working

this is for sure (id) problem, so I need to rewrite this completely
__________________


www.nozgaming.eu | cs.nozgaming.eu
Lawnmoverman is offline
Lawnmoverman
Member
Join Date: Jan 2017
Old 02-25-2017 , 08:02   Re: [HELP] Check this code
Reply With Quote #10

Moved here https://forums.alliedmods.net/showthread.php?t=294338
__________________


www.nozgaming.eu | cs.nozgaming.eu
Lawnmoverman 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:56.


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