Raised This Month: $32 Target: $400
 8% 

Player Gravity/Speed changes when respawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
easytutz
Junior Member
Join Date: Mar 2021
Old 03-24-2021 , 22:44   Player Gravity/Speed changes when respawn
Reply With Quote #1

i've a vip menu plugin, code below , plugin is working the only issue is that when player respawn, it's gravity and speed changes back to normal:
e.g if player chooses "Low Gravity" and "Double Speed" from menu, it works fine but when player die and respawn, it changes back to normal!

WHAT I WANT IS that, when player chooses "Low Gravity" or "Double Speed" from menu, it remains constant throughout the map.

Thank you in Advance!

Plugin Code:
Code:
// Generated with v3x's AMXX Menu Generator

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

public plugin_init()
{
	register_plugin("My Menu", "1.0", "Me");
	register_clcmd("say /vip ", "ShowMenu", ADMIN_MENU, "");
        register_clcmd("say /vipmenu ", "ShowMenu", ADMIN_MENU, "");
        register_clcmd("say /vipsmenu ", "ShowMenu", ADMIN_MENU, "");
}

public ShowMenu(id, lvl, cid)
{
	if(!cmd_access(id, lvl, cid, 0))
		return PLUGIN_HANDLED;

	new menu = menu_create("VIP Menu", "vip_menu");

	menu_additem(menu, "Multi Jump", "", 0); // case 0
	menu_additem(menu, "Double Speed", "", 0); // case 1
	menu_additem(menu, "Low Gravity", "", 0); // case 2

	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_setprop(menu, MPROP_PERPAGE, 3);

	menu_display(id, menu, 0);

	return PLUGIN_HANDLED;
}

public vip_menu(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_cancel(id);
		return PLUGIN_HANDLED;
	}

	new command[6], name[64], access, callback;

	menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

	switch(item)
	{
		case 0: {
client_print(id, print_chat, "You have selected Multi Jump");
}
		case 1: {
client_print(id, print_chat, "You have selected Double Speed");
set_user_maxspeed(id, 500.0)
}
		case 2: {
client_print(id, print_chat, "You have selected Low Gravity");
set_user_gravity ( id, 0.5) 
}
	}

	menu_destroy(menu);

	return PLUGIN_HANDLED;
}
easytutz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-24-2021 , 23:04   Re: Player Gravity/Speed changes when respawn
Reply With Quote #2

Not tested at all
PHP Code:

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

enum VIPStuff
{
    
bool:Speed,
    
bool:Jump,
    
bool:Gravity
}
new 
bool:g_VIPMAX_PLAYERS ][ VIPStuff ];

public 
plugin_init()
{
    
register_plugin("My Menu""1.0""Me");
    
register_clcmd("say /vip ""ShowMenu"ADMIN_MENU"");
    
register_clcmd("say /vipmenu ""ShowMenu"ADMIN_MENU"");
    
register_clcmd("say /vipsmenu ""ShowMenu"ADMIN_MENU"");
    
    
RegisterHamHam_Spawn "player" "HamSpawn" true );
}

public 
client_connectid )
{
    
arraysetg_VIPid ][ VIPStuff:] , sizeofg_VIP[] ) );
}

public 
HamSpawniPlayer )
{
    if ( 
is_user_aliveiPlayer ) )
    {
        if ( 
g_VIPiPlayer ][ Speed ] )
            
set_user_maxspeediPlayer 500.0 );

        if ( 
g_VIPiPlayer][ Gravity ] )
            
set_user_gravity iPlayer 0.5 ) ;    
    }
}

public 
ShowMenu(idlvlcid)
{
    if(!
cmd_access(idlvlcid0))
        return 
PLUGIN_HANDLED;

    new 
menu menu_create("VIP Menu""vip_menu");

    
menu_additem(menu"Multi Jump"""0); // case 0
    
menu_additem(menu"Double Speed"""0); // case 1
    
menu_additem(menu"Low Gravity"""0); // case 2

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_setprop(menuMPROP_PERPAGE3);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
vip_menu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    new 
command[6], name[64], accesscallback;

    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);

    switch(
item)
    {
        case 
0
        {
            
client_print(idprint_chat"You have selected Multi Jump");
            
g_VIPid ][ Jump ] = true;
        }
        case 
1
        {
            
client_print(idprint_chat"You have selected Double Speed");
            
set_user_maxspeed(id500.0)
            
g_VIPid ][ Speed ] = true;
        }
        case 
2
        {
            
client_print(idprint_chat"You have selected Low Gravity");
            
set_user_gravity id0.5
            
g_VIPid ][ Gravity ] = true;
        }
    }

    
menu_destroy(menu);

    return 
PLUGIN_HANDLED;

__________________

Last edited by Bugsy; 03-24-2021 at 23:48.
Bugsy is offline
easytutz
Junior Member
Join Date: Mar 2021
Old 03-24-2021 , 23:08   Re: Player Gravity/Speed changes when respawn
Reply With Quote #3

Unable to compile it
ERROR:

Code:
//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// vipmenu1.sma
// D:\Games\Counter-Strike 1.6\hlds\Counter-Strike WaRzOnE\cstrike\addons\amxmodx\scripting\vipmenu1.sma(13) : error 017: undefined symbol "MAX_PLAYERS"
// D:\Games\Counter-Strike 1.6\hlds\Counter-Strike WaRzOnE\cstrike\addons\amxmodx\scripting\vipmenu1.sma(27) : warning 224: indeterminate array size in "sizeof" expression (symbol "")
//
// 1 Error.
// Could not locate output file D:\Games\Counter-Strike 1.6\hlds\Counter-Strike WaRzOnE\cstrike\addons\amxmodx\scripting\compiled\vipmenu1.amx (compile failed).
//
// Compilation Time: 0.11 sec
// ----------------------------------------

Press enter to exit ...
easytutz is offline
easytutz
Junior Member
Join Date: Mar 2021
Old 03-24-2021 , 23:13   Re: Player Gravity/Speed changes when respawn
Reply With Quote #4

Thank you Sir for your help !

i just fixed it, MAX_Player was not defined

FIXED CODE:

Code:
#include <amxmodx>
#include <amxmisc> 
#include <cstrike> 
#include <hamsandwich> 
#include <fun> 

#define MAX_PLAYERS 32

enum VIPStuff
{
    bool:Speed,
    bool:Jump,
    bool:Gravity
}
new bool:g_VIP[ MAX_PLAYERS + 1 ][ VIPStuff ];

public plugin_init()
{
    register_plugin("My Menu", "1.0", "Me");
    register_clcmd("say /vip ", "ShowMenu", ADMIN_MENU, "");
    register_clcmd("say /vipmenu ", "ShowMenu", ADMIN_MENU, "");
    register_clcmd("say /vipsmenu ", "ShowMenu", ADMIN_MENU, "");
    
    RegisterHam( Ham_Spawn , "player" , "HamSpawn" , true );
}

public client_connect( id )
{
    arrayset( g_VIP[ id ][ VIPStuff:0 ] , 0 , sizeof( g_VIP ) );
}

public HamSpawn( iPlayer )
{
    if ( is_user_alive( iPlayer ) )
    {
        if ( g_VIP[ iPlayer ][ Speed ] )
            set_user_maxspeed( iPlayer , 500.0 );

        if ( g_VIP[ iPlayer][ Gravity ] )
            set_user_gravity ( iPlayer , 0.5 ) ;    
    }
}

public ShowMenu(id, lvl, cid)
{
    if(!cmd_access(id, lvl, cid, 0))
        return PLUGIN_HANDLED;

    new menu = menu_create("VIP Menu", "vip_menu");

    menu_additem(menu, "Multi Jump", "", 0); // case 0
    menu_additem(menu, "Double Speed", "", 0); // case 1
    menu_additem(menu, "Low Gravity", "", 0); // case 2

    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_setprop(menu, MPROP_PERPAGE, 3);

    menu_display(id, menu, 0);

    return PLUGIN_HANDLED;
}

public vip_menu(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_cancel(id);
        return PLUGIN_HANDLED;
    }

    new command[6], name[64], access, callback;

    menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

    switch(item)
    {
        case 0: 
        {
            client_print(id, print_chat, "You have selected Multi Jump");
            g_VIP[ id ][ Jump ] = true;
        }
        case 1: 
        {
            client_print(id, print_chat, "You have selected Double Speed");
            set_user_maxspeed(id, 500.0)
            g_VIP[ id ][ Speed ] = true;
        }
        case 2: 
        {
            client_print(id, print_chat, "You have selected Low Gravity");
            set_user_gravity ( id, 0.5) 
            g_VIP[ id ][ Gravity ] = true;
        }
    }

    menu_destroy(menu);

    return PLUGIN_HANDLED;
}
easytutz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-24-2021 , 23:49   Re: Player Gravity/Speed changes when respawn
Reply With Quote #5

Just made a slight fix in public client_connect( id ), replace that function.
__________________
Bugsy 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 02:46.


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