Raised This Month: $ Target: $400
 0% 

whats wrong here?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
omgitsme
Veteran Member
Join Date: Mar 2010
Old 08-09-2010 , 16:04   whats wrong here?
Reply With Quote #1

yes, i know. it's another stupid vip plugin. but i'm still learning
Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define PLUGIN "CSDM Vip"
#define VERSION "1.0"
#define AUTHOR "omgitsme"

public plugin_init() 
{
    register_plugin("CSDM Vip", "1.0", "Omgitsme")
    register_clcmd("say /vipmenu", "VipMenu")
    register_clcmd("say /vip", "ShowMotd")
}

public ShowMotd(id)
{
    show_motd(id, "vip.txt")
}

public VipMenu(id)
{
    {
        if(is_user_alive(id))
        {
            get_user_flags(id, ADMIN_CHAT)
        }
    else
    {
        client_print(1, print_chat, "Jus ne turite vip statusas! Rasyk /vip")
    }    
    new menu = menu_create ("\rVipMenu", "menu_handler");
    menu_additem(menu, "\wAk47 + M4A1 + Deagle", "1", 0);
    menu_additem(menu, "\wGravity", "2", 0);
    menu_additem(menu, "\w200hp + 250ap", "3", 0);
    menu_additem(menu, "\wSpeed", "4", 0);
    menu_additem(menu, "\wPrimary Weapon + Awp", "5", 0);
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);
}

 public menu_handler(id, menu, item)
 {

    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }

    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    new key = str_to_num(data);
    switch(key)
    {
        case 1:
        {
            if(is_user_alive(id))
       strip_user_weapons(id)
       give_item(id, "weapon_knife")
       give_item(id, "weapon_deagle")
            give_item(id, "weapon_ak")
       give_item(id, "weapon_m4a1")
       client_print(1, print_chat, "Tu gavai Ak47 + M4A1 + Deagle")
            menu_destroy(menu)
       return PLUGIN_HANDLED
        }
        case 2:
        {
            if(is_user_alive(id))
        set_pev(id, pev_gravity, 0.5)
        client_print(1, print_chat, "Tavo gravity buvo sumazintas!")
        }
        case 3:
        {
            if(is_user_alive(id))
        set_user_health(id, 200)
        set_user_armor(id, 250)
        client_print(1, print_chat, "Tu gavai 200hp ir 250 armor!")
        }
    case 4:
        {
        if(is_user_alive(id))
        set_user_maxspeed(id, 450);
    }
    case 5:
    {
        if(is_user_alive(id))
        give_item(id, "weapon_awp")
    }
    menu_destroy(menu);
         return PLUGIN_HANDLED;
}
it gives these errors
Quote:
Warning: Loose indentation on line 74, 76, 77, 79, 80, 86, 92
Warning: Tag mismatch on line 98
Error: Only a single statement (or expression) can follow each "case" on line 105
Warning: Expression has no effect on line 105
Warning: Loose indentation on line 106
edit: just put in
Code:
{
        if(is_user_alive(id))
        {
            get_user_flags(id, ADMIN_CHAT)
        }
    else
    {
        client_print(1, print_chat, "Jus ne turite vip statusas! Rasyk /vip")
    }
can someone check if thats allright? thanks.
__________________

Last edited by omgitsme; 08-09-2010 at 16:17.
omgitsme is offline
Send a message via Skype™ to omgitsme
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-09-2010 , 16:10   Re: whats wrong here?
Reply With Quote #2

Didn't look at code, just fixed warnings:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define PLUGIN "CSDM Vip"
#define VERSION "1.0"
#define AUTHOR "omgitsme"

public plugin_init() 
{
    
register_plugin("CSDM Vip""1.0""Omgitsme")
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
    
register_clcmd("say /vipmenu""VipMenu")
    
register_clcmd("say /vip""ShowMotd")
}

public 
fwHamPlayerSpawnPost(id)
{
    if (
is_user_alive(id))
        if (
get_user_flags(id) & ADMIN_CHAT)
            
strip_user_weapons(id)
    
give_item(id"weapon_knife");
    
give_item(id"weapon_hegrenade");
    
give_item(id"weapon_smokegrenade");
    
give_item(id"weapon_flashbang");
    
give_item(id"weapon_flashbang");
    
set_user_armor(id100)
    
set_user_health(id150)
    
set_user_footsteps(id0)
    
set_pev(idpev_gravity0.5)
}

public 
ShowMotd(id)
{
    
show_motd(id"vip.txt")
}

public 
VipMenu(id)
{
    new 
menu menu_create ("\rVipMenu""menu_handler");
    
menu_additem(menu"\wAk47 + M4A1 + Deagle""1"0);
    
menu_additem(menu"\wGravity""2"0);
    
menu_additem(menu"\w200hp + 250ap""3"0);
    
menu_additem(menu"\wSpeed""4"0);
    
menu_additem(menu"\wPrimary Weapon + Awp""5"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem)
{
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            if(
is_user_alive(id))
                
strip_user_weapons(id)
            
give_item(id"weapon_knife")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_ak")
            
give_item(id"weapon_m4a1")
            
client_print(1print_chat"Tu gavai Ak47 + M4A1 + Deagle")
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED
        
}
        case 
2:
        {
            if(
is_user_alive(id))
                
set_pev(idpev_gravity0.5)
            
client_print(1print_chat"Tavo gravity buvo sumazintas!")
        }
        case 
3:
        {
            if(
is_user_alive(id))
                
set_user_health(id200)
            
set_user_armor(id250)
            
client_print(1print_chat"Tu gavai 200hp ir 250 armor!")
        }
        case 
4:
        {
            if(
is_user_alive(id))
                
set_user_maxspeed(id450.0)
        }
        case 
5:
        {
            if(
is_user_alive(id))
                
give_item(id"weapon_awp")
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
omgitsme
Veteran Member
Join Date: Mar 2010
Old 08-09-2010 , 16:22   Re: whats wrong here?
Reply With Quote #3

thanks, but how come when i add this to the code, it gives a error on public menu_handler
PHP Code:
public VipMenu(id)
{
    {
        if(
is_user_alive(id))
        {
            
get_user_flags(idADMIN_CHAT)
        }
    else
    {
        
client_print(1print_chat"Jus ne turite vip statusas! Rasyk /vip")
    }
    new 
menu menu_create ("\rVipMenu""menu_handler");
    
menu_additem(menu"\wAk47 + M4A1 + Deagle""1"0);
    
menu_additem(menu"\wGravity""2"0);
    
menu_additem(menu"\w200hp + 250ap""3"0);
    
menu_additem(menu"\wSpeed""4"0);
    
menu_additem(menu"\wPrimary Weapon + Awp""5"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);

__________________
omgitsme is offline
Send a message via Skype™ to omgitsme
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-09-2010 , 16:23   Re: whats wrong here?
Reply With Quote #4

Remove the second {
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
omgitsme
Veteran Member
Join Date: Mar 2010
Old 08-09-2010 , 16:28   Re: whats wrong here?
Reply With Quote #5

thanks, but it still lets non-admins use it.
__________________
omgitsme is offline
Send a message via Skype™ to omgitsme
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-09-2010 , 16:29   Re: whats wrong here?
Reply With Quote #6

if(!(get_user_flags(id) & ADMIN_CHAT))
return PLUGIN_HANDLED
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
omgitsme
Veteran Member
Join Date: Mar 2010
Old 08-09-2010 , 16:40   Re: whats wrong here?
Reply With Quote #7

PHP Code:
public VipMenu(id)
{
    
        if(
is_user_alive(id))
        {
            
get_user_flags(idADMIN_CHAT)
        }
    else
    {
        {
        if(!(
get_user_flags(id) & ADMIN_CHAT))
        return 
PLUGIN_HANDLED
    
}
    
    new 
menu menu_create ("\rVipMenu""menu_handler");
    
menu_additem(menu"\wAk47 + M4A1 + Deagle""1"0);
    
menu_additem(menu"\wGravity""2"0);
    
menu_additem(menu"\w200hp + 250ap""3"0);
    
menu_additem(menu"\wSpeed""4"0);
    
menu_additem(menu"\wPrimary Weapon + Awp""5"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);

like this? gives up a error again..
or
PHP Code:
public VipMenu(id)
{
    
        if(
is_user_alive(id))
        {
            
get_user_flags(idADMIN_CHAT)
        }
    else
        if(!(
get_user_flags(id) & ADMIN_CHAT))
        return 
PLUGIN_HANDLED
    
    
new menu menu_create ("\rVipMenu""menu_handler");
    
menu_additem(menu"\wAk47 + M4A1 + Deagle""1"0);
    
menu_additem(menu"\wGravity""2"0);
    
menu_additem(menu"\w200hp + 250ap""3"0);
    
menu_additem(menu"\wSpeed""4"0);
    
menu_additem(menu"\wPrimary Weapon + Awp""5"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);

compiles with errors, but anyone can use it
__________________
omgitsme is offline
Send a message via Skype™ to omgitsme
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-09-2010 , 16:43   Re: whats wrong here?
Reply With Quote #8

PHP Code:
public VipMenu(id)
{
    
    if(!
is_user_alive(id)    )
        return 
PLUGIN_HANDLED
    
if(!(get_user_flags(id) & ADMIN_CHAT)    )
        return 
PLUGIN_HANDLED
    
    
new menu menu_create ("\rVipMenu""menu_handler");
    
menu_additem(menu"\wAk47 + M4A1 + Deagle""1"0);
    
menu_additem(menu"\wGravity""2"0);
    
menu_additem(menu"\w200hp + 250ap""3"0);
    
menu_additem(menu"\wSpeed""4"0);
    
menu_additem(menu"\wPrimary Weapon + Awp""5"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
    return 
PLUGIN_CONTINUE

__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
omgitsme
Veteran Member
Join Date: Mar 2010
Old 08-09-2010 , 16:56   Re: whats wrong here?
Reply With Quote #9

thanks alot but for some reason, when i spawn i get a awp a grenades. but i took out my hamspawn function
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>

#define PLUGIN "CSDM Vip"
#define VERSION "1.0"
#define AUTHOR "omgitsme"

public plugin_init() 
{
    
register_plugin("CSDM Vip""1.0""Omgitsme")
    
register_clcmd("say /vipmenu""VipMenu")
    
register_clcmd("say /vip""ShowMotd")
}

public 
ShowMotd(id)
{
    
show_motd(id"vip.txt")
}

public 
VipMenu(id)
{
    
    if(!
is_user_alive(id)    )
        return 
PLUGIN_HANDLED
    
if(!(get_user_flags(id) & ADMIN_CHAT)    )
    
client_print(1print_chat"Jus neturite vip statusas! Rasyk /vip")
        return 
PLUGIN_HANDLED
    
    
new menu menu_create ("\rVipMenu""menu_handler");
    
menu_additem(menu"\wAk47 + M4A1 + Deagle""1"0);
    
menu_additem(menu"\wGravity""2"0);
    
menu_additem(menu"\w200hp + 250ap""3"0);
    
menu_additem(menu"\wSpeed""4"0);
    
menu_additem(menu"\wPrimary Weapon + Awp""5"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
    
    return 
PLUGIN_CONTINUE
}  

public 
menu_handler(idmenuitem)
{
    
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
key str_to_num(data);
    switch(
key)
    {
        case 
1:
        {
            if(
is_user_alive(id))
                
strip_user_weapons(id)
            
give_item(id"weapon_knife")
            
give_item(id"weapon_deagle")
            
give_item(id"weapon_ak47")
            
give_item(id"weapon_m4a1")
            
client_print(1print_chat"Tu gavai Ak47 + M4A1 + Deagle")
            
menu_destroy(menu)
            return 
PLUGIN_HANDLED
        
}
        case 
2:
        {
            if(
is_user_alive(id))
                
set_pev(idpev_gravity0.5)
            
client_print(1print_chat"Tavo gravity buvo sumazintas!")
        }
        case 
3:
        {
            if(
is_user_alive(id))
                
set_user_health(id200)
            
set_user_armor(id250)
            
client_print(1print_chat"Tu gavai 200hp ir 250 armor!")
        }
        case 
4:
        {
            if(
is_user_alive(id))
                
set_user_maxspeed(id450.0)
        }
        case 
5:
        {
            if(
is_user_alive(id))
                
give_item(id"weapon_awp")
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;

__________________
omgitsme is offline
Send a message via Skype™ to omgitsme
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-09-2010 , 17:11   Re: whats wrong here?
Reply With Quote #10

Instead of checking is_user_alive() in each case, do it before the switch.
And you shouldn't get anything on spawn based on that code...
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
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 22:00.


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