Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
04-15-2015
, 02:23
Re: Holding user's speed and gravity
#3
I have reproduced the relevant part of the plugin.
Spoiler
PHP Code:
#include < amxmodx > #include < color_print > #include < cstrike > #include < fun > #pragma semicolon 1 #define VIP_BRONZE ADMIN_LEVEL_F #define VIP_SILVER ADMIN_LEVEL_G #define VIP_GOLD ADMIN_LEVEL_H #define MAXOPTIONS_SM 5 #define MAXOPTIONS_GM 5 #define BRONZE_SPEED 300.0 #define BRONZE_GRAVITY 700.0 #define SILVER_SPEED 400.0 #define SILVER_GRAVITY 600.0 #define GOLD_SPEED 500.0 #define GOLD_GRAVITY 500.0 #define FOUNDER_SPEED 900.0 #define FOUNDER_GRAVITY 200.0 new PLUG [] = "Epic VIP" ; new VERS [] = "1.0" ; new const Options_sm [ MAXOPTIONS_SM ][] = { "\w Bronze\g -\r 300" , "\w Silver\g -\r 400" , "\w Gold\g -\r 500" , "\w Default\g -\r 250" , "\w Founder\g -\r 900" }; new const Options_gm [ MAXOPTIONS_GM ][] = { "\w Bronze\g -\r 700" , "\w Silver\g -\r 600" , "\w Gold\g -\r 500" , "\w Default\g -\r 800" , "\w Founder\g -\r 200" }; new bool : Bronze [ 33 ]; new bool : Silver [ 33 ]; new bool : Gold [ 33 ]; new bool : HasSpeed [ 33 ]; new bool : HasGravity [ 33 ]; new UserSpeed [ 33 ]; new UserGravity [ 33 ]; public plugin_init () { register_plugin ( PLUG , VERS , "EpicKiller" ); register_event ( "CurWeapon" , "fCurWeapon" , "be" , "1=1" ); register_clcmd ( "say /speed" , "cmdSpeed" ); register_clcmd ( "say_team /speed" , "cmdSpeed" ); register_clcmd ( "say /gravity" , "cmdGravity" ); register_clcmd ( "say_team /gravity" , "cmdGravity" ); } public client_putinserver ( id ) { Bronze [ id ] = false ; Silver [ id ] = false ; Gold [ id ] = false ; HasSpeed [ id ] = false ; HasGravity [ id ] = false ; UserSpeed [ id ] = 0 ; UserGravity [ id ] = 0 ; new f = get_user_flags ( id ); if( f & VIP_BRONZE ) Bronze [ id ] = true ; else if( f & VIP_SILVER ) Silver [ id ] = true ; else if( f & VIP_GOLD ) Gold [ id ] = true ; } public client_disconnect ( id ) { HasSpeed [ id ] = false ; HasGravity [ id ] = false ; Bronze [ id ] = false ; Silver [ id ] = false ; Gold [ id ] = false ; UserSpeed [ id ] = 0 ; UserGravity [ id ] = 0 ; } public fCurWeapon ( id ) { if( HasSpeed [ id ]) set_user_maxspeed ( id , UserSpeed [ id ]); if( HasGravity [ id ]) set_user_gravity ( id , UserGravity [ id ]); } public cmdSpeed ( id ) { if(! VIP ( id )) { color_print ( id , ".g [.v VIP.g ].x You're no.v VIP.x !" ); return PLUGIN_CONTINUE ; } new sm = menu_create ( "\r SPEED MENU" , "sm_handler" ); for(new i = 0 ; i < MAXOPTIONS_SM ; i ++) menu_additem ( sm , Options_sm [ i ], "i" ); menu_setprop ( sm , MPROP_EXIT , MEXIT_ALL ); menu_display ( id , sm , 0 ); return PLUGIN_CONTINUE ; } public sm_handler ( id , sm , item ) { if( item == MENU_EXIT ) { menu_destroy ( sm ); return PLUGIN_CONTINUE ; } switch( item ) { case 0 : { set_user_maxspeed ( id , BRONZE_SPEED ); UserSpeed [ id ] = BRONZE_SPEED ; HasSpeed [ id ] = true ; } case 1 : { set_user_maxspeed ( id , SILVER_SPEED ); UserSpeed [ id ] = SILVER_SPEED ; HasSpeed [ id ] = true ; } case 2 : { set_user_maxspeed ( id , GOLD_SPEED ); UserSpeed [ id ] = GOLD_SPEED ; HasSpeed [ id ] = true ; } case 3 : { set_user_maxspeed ( id , FOUNDER_SPEED ); UserSpeed [ id ] = FOUNDER_SPEED ; HasSpeed [ id ] = true ; } case 4 : { set_user_maxspeed ( id , 250.0 ); UserSpeed [ id ] = 0 ; HasSpeed [ id ] = false ; } } menu_destroy ( sm ); return PLUGIN_CONTINUE ; } public cmdGravity ( id ) { if(! VIP ( id )) { color_print ( id , ".g [.v VIP.g ].x You're no.v VIP.x !" ); return PLUGIN_CONTINUE ; } new gm = menu_create ( "\r GRAVITY MENU" , "gm_handler" ); for(new i = 0 ; i < MAXOPTIONS_GM ; i ++) menu_additem ( gm , Options_gm [ i ], "i" ); menu_setprop ( gm , MPROP_EXIT , MEXIT_ALL ); menu_display ( id , gm , 0 ); return PLUGIN_CONTINUE ; } public gm_handler ( id , gm , item ) { if( item == MENU_EXIT ) { menu_destroy ( gm ); return PLUGIN_CONTINUE ; } switch( item ) { case 0 : { set_user_gravity ( id , BRONZE_GRAVITY / 800.0 ); UserGravity [ id ] = BRONZE_GRAVITY ; HasGravity [ id ] = true ; } case 1 : { set_user_gravity ( id , SILVER_GRAVITY / 800.0 ); UserGravity [ id ] = SILVER_GRAVITY ; HasGravity [ id ] = true ; } case 2 : { set_user_gravity ( id , GOLD_GRAVITY / 800.0 ); UserGravity [ id ] = GOLD_GRAVITY ; HasGravity [ id ] = true ; } case 3 : { set_user_gravity ( id , FOUNDER_GRAVITY / 800.0 ); UserGravity [ id ] = FOUNDER_GRAVITY ; HasGravity [ id ] = true ; } case 4 : { set_user_gravity ( id , 800.0 / 800.0 ); UserGravity [ id ] = 0 ; HasGravity [ id ] = false ; } } menu_destroy ( gm ); return PLUGIN_CONTINUE ; } stock VIP ( id ) { if( Bronze [ id ] || Silver [ id ] || Gold [ id ]) return true ; return false ; }
So every line that is trying to assign UserSpeed[id] or UserGravity[id] a value returns a tag mismatch. The lines in fCurWeapon, the ones trying to set user's values to the variable's value, returns the same. At first, I've tried filling the variable by copying, but I got the same warnings. I've tried making the two variables floats, in the hope of at least reducing the warning count by two, the two in fCurWeapon. So I'm clueless. What should I do?
__________________
~ Swiftly and with style ~