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

Solved VIP Plugin (help)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Furi
New Member
Join Date: Jan 2022
Old 01-23-2022 , 14:59   VIP Plugin (help)
Reply With Quote #1

Hello!
Im a beginner who started to learn sourcepawn like 1 week ago. My first project was to make a working vip menu wich includes a menu where u can find options to use sm_votekick and sm_voteban, I studied a little bit and i wrote a menu script wich has both of the options but now i dont know what i need to add to make those commands on the list really work when they are used.

php code:
PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart() {
    
    
RegConsoleCmd("sm_vip"Command_VIP"Diplays a VIP menu");
}

public 
Action Command_VIP(int clientint args) {
    
Menu menu = new Menu(Menu_Callback);
    
menu.SetTitle("Vip Menu :)");
    
menu.AddItem("Votekick""Votekick"); 
    
menu.AddItem("Voteban""Voteban"); 
    
menu.Display(client30); 
    return 
Plugin_Handled;
}

public 
int Menu_Callback(Menu menuMenuAction actionint param1int param2
{
    switch (
action) {
        case 
MenuAction_Select:
        {
            
char item[32];
            
menu.GetItem(param2itemsizeof(item));
            
            if (
StrEqual(item"Votekick")) {
                
            }
            else if (
StrEqual(item"Voteban")) {
                
            }
        }
        case 
MenuAction_End:
        {
            
delete menu
        }
    }


I would appreciate any help to get this working!

Last edited by Furi; 01-24-2022 at 02:21.
Furi is offline
Cruze
Veteran Member
Join Date: May 2017
Old 01-23-2022 , 16:04   Re: VIP Plugin (help)
Reply With Quote #2

PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart() {
    
    
RegAdminCmd("sm_vip"Command_VIPADMFLAG_RESERVATION"Diplays a VIP menu");
}

public 
Action Command_VIP(int clientint args) {
    
Menu menu = new Menu(Menu_Callback);
    
menu.SetTitle("Vip Menu :)");
    
menu.AddItem("Votekick""Votekick"); 
    
menu.AddItem("Voteban""Voteban"); 
    
menu.Display(client30); 
    return 
Plugin_Handled;
}

public 
int Menu_Callback(Menu menuMenuAction actionint param1int param2
{
    switch (
action) {
        case 
MenuAction_Select:
        {
            
char item[32];
            
menu.GetItem(param2itemsizeof(item));
            
            if (
StrEqual(item"Votekick")) {
                
ClientCommand(param1"sm_votekick");
            }
            else if (
StrEqual(item"Voteban")) {
                
ClientCommand(param1"sm_voteban");
            }
        }
        case 
MenuAction_End:
        {
            
delete menu
        }
    }

__________________
Taking paid private requests! Contact me

Last edited by Cruze; 01-24-2022 at 04:38. Reason: param1 instead of client
Cruze is offline
Furi
New Member
Join Date: Jan 2022
Old 01-23-2022 , 16:31  
Reply With Quote #3

Thanks man! Really Appreciate the help! it still gives undefined symbol "client" on lines 38 and 41, not sure whats wrong with that

Last edited by Furi; 01-23-2022 at 16:39.
Furi is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 01-24-2022 , 00:41   Re: VIP Plugin (help)
Reply With Quote #4

Quote:
Originally Posted by Furi View Post
Thanks man! Really Appreciate the help! it still gives undefined symbol "client" on lines 38 and 41, not sure whats wrong with that
Change this:
PHP Code:
            if (StrEqual(item"Votekick")) {
                
ClientCommand(client"sm_votekick");
            }
            else if (
StrEqual(item"Voteban")) {
                
ClientCommand(client"sm_voteban");
            } 
to read this:
PHP Code:
            if (StrEqual(item"Votekick")) {
                
ClientCommand(param1"sm_votekick");
            }
            else if (
StrEqual(item"Voteban")) {
                
ClientCommand(param1"sm_voteban");
            } 
When using menus the client becomes param1
PC Gamer is offline
Furi
New Member
Join Date: Jan 2022
Old 01-24-2022 , 02:21   Re: VIP Plugin (help)
Reply With Quote #5

Thank you! i was thinking about that when i was reading the code and thinking but just didn't try it for some reason !
Furi is offline
Cruze
Veteran Member
Join Date: May 2017
Old 01-24-2022 , 04:38   Re: VIP Plugin (help)
Reply With Quote #6

Quote:
Originally Posted by PC Gamer View Post
Change this:
PHP Code:
            if (StrEqual(item"Votekick")) {
                
ClientCommand(client"sm_votekick");
            }
            else if (
StrEqual(item"Voteban")) {
                
ClientCommand(client"sm_voteban");
            } 
to read this:
PHP Code:
            if (StrEqual(item"Votekick")) {
                
ClientCommand(param1"sm_votekick");
            }
            else if (
StrEqual(item"Voteban")) {
                
ClientCommand(param1"sm_voteban");
            } 
When using menus the client becomes param1
Oh yeah, I didn't check that ._. Thanks for correcting that out
__________________
Taking paid private requests! Contact me
Cruze is offline
Reply


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:03.


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