Raised This Month: $ Target: $400
 0% 

VIP Plugin! need help with code


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Wardenis
New Member
Join Date: Jul 2010
Old 07-04-2010 , 15:43   VIP Plugin! need help with code
Reply With Quote #1

Ok this is my first attempt in coding, and i need your help!

Code:
#define DAMAGE_RECIEVED
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <sqlx>
#include <nvault>
#include <hamsandwich>
#include <fakemeta>
static const COLOR[] = "^x04" //green
static const CONTACT[] = ""
new maxplayers
new gmsgSayText
new g_MsgSync
new g_menu_active


#define Keysrod (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<9) // Keys: 1234567890
new round = 1
#if defined DAMAGE_RECIEVED
    new g_MsgSync2
#endif

public plugin_init()
{
    register_plugin("Gruzas Vip menu", "1.0", "Gruzas")
    g_menu_active = register_cvar("menu_active", "1")
    register_event("Damage","Damage","b")
    register_event("DeathMsg","death_msg","a")
    register_logevent("logevent_Round_Start", 2, "1=Round_Start");
    register_event("DeathMsg", "hook_death", "a", "1>0")
    register_cvar("vp_knife_hp", "300")

    maxplayers = get_maxplayers()

    register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")

    g_MsgSync = CreateHudSyncObj()

#if defined DAMAGE_RECIEVED
    g_MsgSync2 = CreateHudSyncObj()
#endif
    register_menucmd(register_menuid("rod"), Keysrod, "Pressedrod")
    register_logevent("logevent_Round_Start", 2, "1=Round_Start")
    register_clcmd("say /vip","ShowMotd")
    maxplayers = get_maxplayers()
    gmsgSayText = get_user_msgid("SayText")
    register_clcmd("say", "handle_say")
    register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)
}

public on_damage(id)
{
    new attacker = get_user_attacker(id)

#if defined DAMAGE_RECIEVED
    // id should be connected if this message is sent, but lets check anyway
    if ( is_user_connected(id) && is_user_connected(attacker) )
    if (get_user_flags(attacker) & ADMIN_LEVEL_H)
    {
        new damage = read_data(2)

        set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1)
        ShowSyncHudMsg(id, g_MsgSync2, "%i^n", damage)
#else
    if ( is_user_connected(attacker) && if (get_user_flags(attacker) & ADMIN_LEVEL_H) )
    {
        new damage = read_data(2)
#endif
        set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
        ShowSyncHudMsg(attacker, g_MsgSync, "%i^n", damage)
    }
}


public logevent_Round_Start()
{
    round++;
    new players[32], player, pnum;
    get_players(players, pnum, "a");
    for(new i = 0; i < pnum; i++)
    {
        player = players[i];
        if(get_user_flags(player) & ADMIN_LEVEL_H)
        {
        if (!get_pcvar_num(g_menu_active))
            return PLUGIN_CONTINUE
        if(round > 1) Showrod(player)
        }
    }
    return PLUGIN_HANDLED
}

public Showrod(id) {
    show_menu(id, Keysrod, "VIP Menu^n\w1. 300HP+Knife Only ^n\w2.Normal Play Mode^n0. Exit^n", -1, "rod") // Display menu
}
public Pressedrod(id, key) {
    /* Menu:
    * VIP Menu
    * 1. "300HP+Knife Only"
    * 2. "Normal Play Mode"
    * 0. Exit
    */

    new team[32], User[32];
    get_user_team(id,team,32);
    get_user_name(id,User,32);
    switch (key) {
        case 0: { 
            strip_user_weapon(id)
            give_item(id, "weapon_knife");
            set_user_health(id, get_user_health(id)+get_cvar_num("vp_knife_hp"))
            }
            if(get_user_weapon(id) != CSW_KNIFE && get_user_weapon(id) != CSW_C4)
        {
            set_task(0.2, "drop_c4", id)
        }
    }
}
        case 1: { 
   set_user_health( id, 120)
   set_user_armor( id, 150)
   give_item(id, "weapon_flashbang");
   give_item(id, "weapon_flashbang");
   give_item(id, "weapon_hegrenade");
               }
            if(get_user_weapon(id) != CSW_KNIFE && is_user_alive(id))
        {
            new hp = get_user_health(id);
                
                if(hp < 130)
                {
                    set_task(2.5,"gyogyitas", id)
            }
        }
    }
            case 2: { // 0
            
        }
    }
    return PLUGIN_CONTINUE
}

public gyogyitas(id) {
    
    new hp = get_user_health(id);
    
    if(hp < 130)
    {
        set_user_health(id, hp + 5);
        set_task(2.5,"gyogyitas", id);
    }
    else
    {
        client_print(id, print_chat, "No More HP For you. Good Luck", hp)
        return PLUGIN_HANDLED;
    }
    
    return PLUGIN_CONTINUE;
}

public drop_c4(id)
{
    engclient_cmd(id,"drop", "weapon_c4")
    set_task(0.2, "strip_weapons", id)
}

public strip_weapons(id)
{
    strip_user_weapons(id)
    set_task(0.2, "give_knife", id)
}

public give_knife(id)
{
    give_item(id,"weapon_knife")
}


public ShowMotd(id)
{
 show_motd(id, "vip.txt")
}
public client_authorized(id)
{
 set_task(30.0, "PrintText" ,id)
}
public PrintText(id)
{
 client_print(id, print_chat, "Welcome To Gruzas TeamPlay GunGame Server.")
}

public handle_say(id) {
    new said[192]
    read_args(said,192)
    if( ( containi(said, "who") != -1 && containi(said, "admin") != -1 ) || contain(said, "/nooption") != -1 )
        set_task(0.1,"print_adminlist",id)
    return PLUGIN_CONTINUE
}

public print_adminlist(user) 
{
    new adminnames[33][32]
    new message[256]
    new contactinfo[256], contact[112]
    new id, count, x, len
    
    for(id = 1 ; id <= maxplayers ; id++)
        if(is_user_connected(id))
            if(get_user_flags(id) & ADMIN_LEVEL_H)
                get_user_name(id, adminnames[count++], 31)

    len = format(message, 255, "%s VIP ONLINE: ",COLOR)
    if(count > 0) {
        for(x = 0 ; x < count ; x++) {
            len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
            if(len > 96 ) {
                print_message(user, message)
                len = format(message, 255, "%s ",COLOR)
            }
        }
        print_message(user, message)
    }
    else {
        len += format(message[len], 255-len, "No VIP online.")
        print_message(user, message)
    }
    
    get_cvar_string("amx_contactinfo", contact, 63)
    if(contact[0])  {
        format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact)
        print_message(user, contactinfo)
    }
}

print_message(id, msg[]) {
    message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
    write_byte(id)
    write_string(msg)
    message_end()
}
I'm trying to do this VIP menu, but when i try to compile this code to .amxx i get alot of errors So please someone tell me what i'm doing wronge.

compilation error: http://yfrog.com/jlasdasdqtj
Wardenis is offline
 


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 07:11.


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