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

how to change this (add item into a menu)


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-28-2020 , 15:43   Re: how to change this (add item into a menu)
Reply With Quote #11

You get an error on that line because that variable no longer exists because you changed it's name. I didn't say to do that. Also, you removed some of the original functionality and the original jetpack (which you said you wanted to keep). When you go to precache the new model, you have to ADD code, not change the existing code.

For the cvars, you implemented the use of them correctly but the new cvars don't exist. Look at how the other cvars are implemented in the code and you need to replicate that. In summary, you have to create a variable for the cvar, register the cvar and assign it to that variable and then use the cvar (you already implemented using of the cvar correctly). You should have a total of 9 uses of register_cvar() in your code (one of which is the PLUGIN_NAME) cvar.

After fixing those issues and implementing the entity_set_model() code that I posted above, I think it should compile properly. Based on only these changes, you should get your VIP jetpack model instead of the original. When that is working, you can then go to the next step of external access.
__________________
fysiks is offline
gfxchris
Member
Join Date: Feb 2016
Old 11-29-2020 , 01:34   Re: how to change this (add item into a menu)
Reply With Quote #12

Code:
new g_HasJetpack2[33]
sorry for bothering, what's the correct way to set this ?
Code:
new g_HasJetpack[33] 2
maybe like this? i cant search for information right know cause i dont have my computer today, im gonna edit it later today and post the result but i wanna know how to set this to 2
gfxchris is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-29-2020 , 06:19   Re: how to change this (add item into a menu)
Reply With Quote #13

You actually already did it in the function _give_Jetpack(id). Nothing about the variable declaration (the line with "new") needs to change.

However, you'll want to revert the change you did in _give_Jetpack(id) and then copy that function to create a new one and rename it something like "give_vip_jetpack(id)" and then set the variable to 2 in this new version. Then register a new console command: register_concmd("vipjetpack", "give_vip_jetpack") so that you can test it by typing "vipjetpack" in console to give yourself the VIP jetpack.
__________________
fysiks is offline
gfxchris
Member
Join Date: Feb 2016
Old 11-29-2020 , 19:44   Re: how to change this (add item into a menu)
Reply With Quote #14

alright,did some testing,seem to work fine,i put the normal jetpack and this one on a test server and they seem to be normal,when i get the normal jetpack it uses its normal cvars,and when i get the vip jetpack it uses its vip cvars

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <engine>

new JETPACK_PMODEL[]     = "models/p_longjump.mdl"
new JETPACK_PMODEL_VIP[]     = "models/p_longjump.mdl"
new JETPACK_GOTSOUND[]     = "items/ammopickup2.wav"

new cvar_thrust
new cvar_min_speed
new cvar_max_speed
new cvar_thrust_vip
new cvar_minspeed_vip
new cvar_maxspeed_vip

new g_HasJetpack[33]
new g_JetpackEnt[33]

static const PLUGIN_NAME[]     = "SyN Vip Jetpack"
static const PLUGIN_AUTHOR[]     = "Cheap_Suit"
static const PLUGIN_VERSION[]    = "1.5"

public plugin_init()
{
    new mapName[33]
    get_mapname(mapName, 32)
    
    if(!equali(mapName, "surf_", 5))
    {
        new pluginName[33]
        format(pluginName, 32, "[Disabled] %s", PLUGIN_NAME)
        register_plugin(pluginName, PLUGIN_VERSION, PLUGIN_AUTHOR)
        pause("ade")
    }
    else
    {
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
        register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)
        
        register_clcmd("amx_givevipjp" ,         "cmd_GiveSJVIP",         ADMIN_IMMUNITY, "<userid> - Gives free surf jetpack")
        register_clcmd("amx_stripvipjp" ,         "cmd_StripSJVIP",         ADMIN_IMMUNITY, "<userid> - Strips users surf jetpack")
        register_concmd("vipjp", "give_vip_jetpack")

        cvar_thrust     = register_cvar("sjp_thrust", "10")
        cvar_min_speed     = register_cvar("sjp_min_speed", "400")
        cvar_max_speed     = register_cvar("sjp_max_speed", "1200")
        cvar_thrust_vip     = register_cvar("vip_thrust", "15")
        cvar_minspeed_vip    = register_cvar("vip_minspeed", "500")
        cvar_maxspeed_vip     = register_cvar("vip_maxspeed", "1300")
       
        register_event("DeathMsg",         "Event_DeathMsg", "a")
    }
}

public plugin_precache()
{
    precache_sound(JETPACK_GOTSOUND)
    precache_model(JETPACK_PMODEL)
    precache_model(JETPACK_PMODEL_VIP)
}

public client_connect(id)
{
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)
}
    
public client_disconnect(id)
{
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)
}

public Event_DeathMsg()
{
    new id = read_data(2)

    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)

    return PLUGIN_CONTINUE
} 

public cmd_GiveSJVIP(id , level , cid) 
{
    if(!cmd_access(id , level , cid , 2))
        return PLUGIN_HANDLED
        
    new arg1[33]
    read_argv(1 , arg1 , 32)

    new target = cmd_target(id , arg1 , 0)
    if(!is_user_connected(target))
    {
        console_print(id, "Player does not exist")
        return PLUGIN_HANDLED
    }

    if(g_HasJetpack[target])
    {
        console_print(id, "Player already has a surf jetpack")
        return PLUGIN_HANDLED
    }
    
    give_vip_jetpack(target)

    new Name[33], Name2[33]
    get_user_name(id, Name, 32)
    get_user_name(target, Name2, 32)
    
    console_print(id, "You gave %s a surf jetpack", Name2)
    client_print(target, print_chat, "ADMIN: %s gave you a surf jetpack", Name)
    
    return PLUGIN_HANDLED
}

public cmd_StripSJVIP(id , level , cid) 
{
    if(!cmd_access(id , level , cid , 2))
        return PLUGIN_HANDLED
        
    new arg1[33]
    read_argv(1 , arg1 , 32)

    new target = cmd_target(id , arg1 , 0)
    if(!is_user_connected(target))
    {
        console_print(id, "Player does not exist")
        return PLUGIN_HANDLED
    }

    if(!g_HasJetpack[target])
    {
        console_print(id, "Player does not have a surf jetpack")
        return PLUGIN_HANDLED
    }
    
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)

    new Name[33], Name2[33]
    get_user_name(id, Name, 32)
    get_user_name(target, Name2, 32)
    
    console_print(id, "You stripped %s a surf jetpack", Name2)
    client_print(target, print_chat, "ADMIN: %s stripped your surf jetpack", Name)
    
    return PLUGIN_HANDLED
}

public give_vip_jetpack(id)

{
    g_HasJetpack[id] = 2
    client_cmd(id, "spk %s", JETPACK_GOTSOUND)
    client_print(id, print_chat, "You've got a surf jetpack! :: HOW TO USE :: ~ Just Surf ~ ")
    
    if(g_JetpackEnt[id] < 2)
    {
        g_JetpackEnt[id] = create_entity("info_target")
        if(is_valid_ent(g_JetpackEnt[id]))
        {
            entity_set_model(g_JetpackEnt[id], g_HasJetpack[id] == 2 ? JETPACK_PMODEL_VIP : JETPACK_PMODEL)
            entity_set_int(g_JetpackEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW)
            entity_set_edict(g_JetpackEnt[id], EV_ENT_aiment, id)
        }
    }
}

public _removeJetpackEnt(id)
{
    if(g_JetpackEnt[id] > 0)
        remove_entity(g_JetpackEnt[id])
    g_JetpackEnt[id] = 0
}

public client_PreThink(id)
{
    if(!is_user_alive(id) || !g_HasJetpack[id])
        return PLUGIN_CONTINUE
        
    if(get_user_speed(id) < get_pcvar_num( g_HasJetpack[id] == 2 ? cvar_minspeed_vip : cvar_min_speed))
        return PLUGIN_CONTINUE    
        
    new Button = get_user_button(id)
    if(Button & IN_MOVELEFT || Button & IN_MOVERIGHT)
    {           
        _jetThrust(id)
    }
    return PLUGIN_CONTINUE
}

public _jetThrust(id)
{    
    new Float:fVelocity[3]
    entity_get_vector(id, EV_VEC_velocity, fVelocity)

    new Float:fAngle[3]
    entity_get_vector(id, EV_VEC_angles, fAngle)
    engfunc(EngFunc_MakeVectors, fAngle)
                
    new Float:fForward[3]
    get_global_vector(GL_v_forward, fForward)
                
    fVelocity[0] += fForward[0] * get_pcvar_num( g_HasJetpack[id] == 2 ? cvar_thrust_vip :cvar_thrust )
    fVelocity[1] += fForward[1] * get_pcvar_num( g_HasJetpack[id] == 2 ? cvar_thrust_vip :cvar_thrust )
            
    if(get_user_speed(id) < get_pcvar_num( g_HasJetpack[id] == 2 ? cvar_maxspeed_vip : cvar_max_speed ))
        entity_set_vector(id, EV_VEC_velocity, fVelocity)
        
    return PLUGIN_CONTINUE
}

stock get_user_speed(id)
{
    new Float:fVelocity[3]
    entity_get_vector(id, EV_VEC_velocity, fVelocity)
    
    new iVelocity[3]
    FVecIVec(fVelocity, iVelocity)
    
    new iVelocity0 = iVelocity[0] * iVelocity[0]
    new iVelocity1 = iVelocity[1] * iVelocity[1]
    
    return sqroot(iVelocity0 + iVelocity1)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
this is the code,i eliminated the buy commands cause they were useless,changed the cvars and everything compiles fine,see any issues here?

question 1: to implement this into the vip plugin i have to change this line
Code:
client_cmd(id, "jpvip" , "Jetpack")
to
Code:
client_cmd(id, "vipjp", "give_vip_jetpack")
am i right? or do i need another native for this to work?
question 2: to put the custom PMODEL i have to edit the JETPACK_PMODEL_VIP[] ?
gfxchris is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-01-2020 , 01:55   Re: how to change this (add item into a menu)
Reply With Quote #15

You keep removing the normal jetpack from this plugin. If you wanted to have two separate plugins for the two separate jetpacks you should have said that early on in our conversation. What I see when you post your code is that you keep doing things that I've not said to do which makes it harder to verify your code and give you further advice because I can't tell if just don't understand my advice or you are intentionally doing something else.

You also changed "g_JetpackEnt[id] < 1" to "g_JetpackEnt[id] < 2" but it shouldn't have changed.

If you want the two jetpacks in separate plugins, the edits can be much simpler. Go back to the original plugin and do the following things:
  • Edit the JETPACK_PMODEL variable to use your model
  • Change the name of everything that is "registered" (the first argument of any register_* commands like register_cvar, register_clcmd, and register_concmd). In the case of the plugin name, it uses a variable which you would just edit the variable (you already did this in your current version).
  • Test
  • If it works as expected, remove parts that you don't want (which you've already done once before)
  • Test again

Quote:
Originally Posted by gfxchris View Post
question 1: to implement this into the vip plugin i have to change this line
Code:
client_cmd(id, "jpvip" , "Jetpack")
to
Code:
client_cmd(id, "vipjp", "give_vip_jetpack")
am i right?
No, that is not how client_cmd() works and is invalid code (it will probably compile but will cause a run-time error). See post #3 and replace "buyjetpack".

However, this will allow people to get a VIP jet pack for free anytime they want. To prevent this, you'll want to create a dynamic native. The "handler" plugin would be your jetpack plugin and the "client" plugin would be your VIP menu plugin. In the handler function, you would replace "set_user_health(id,get_user_health(id) / 2)" with "_give_Jetpack(id)". Changing the name of the registered native and the include file is recommended so that it's obvious of what the function does.
__________________

Last edited by fysiks; 12-01-2020 at 02:07.
fysiks is offline
gfxchris
Member
Join Date: Feb 2016
Old 12-01-2020 , 03:23   Re: how to change this (add item into a menu)
Reply With Quote #16

Quote:
If you wanted to have two separate plugins for the two separate jetpacks you should have said that early on in our conversation.
*sorry for not saying it from the first post,yes that's what i've been trying to do ^

anyways,this is the code i came up with the suggestions you told me

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <engine>

new JETPACK_PMODEL_VIP[]     = "models/p_longjump_vip.mdl"
new JETPACK_GOTSOUND[]     = "items/ammopickup2.wav"

new cvar_thrust
new cvar_min_speed
new cvar_max_speed

new g_HasJetpack[33]
new g_JetpackEnt[33]


static const PLUGIN_NAME[]     = "Vip Surf Jetpack"
static const PLUGIN_AUTHOR[]     = "Cheap_Suit"
static const PLUGIN_VERSION[]    = "1.5"

public plugin_init()
{
    new mapName[33]
    get_mapname(mapName, 32)
    
    if(!equali(mapName, "surf_", 5))
    {
        new pluginName[33]
        format(pluginName, 32, "[Disabled] %s", PLUGIN_NAME)
        register_plugin(pluginName, PLUGIN_VERSION, PLUGIN_AUTHOR)
        pause("ade")
    }
    else
    {
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
        register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)
        
        register_clcmd("amx_givejpvip" ,         "cmd_GiveSJVIP",         ADMIN_IMMUNITY, "<userid> - Gives free surf jetpack")
        register_clcmd("amx_stripjpvip" ,         "cmd_StripSJVIP",         ADMIN_IMMUNITY, "<userid> - Strips users surf jetpack")
        
        cvar_thrust     = register_cvar("vip_thrust", "8")
        cvar_min_speed     = register_cvar("vip_minspeed", "700")
        cvar_max_speed     = register_cvar("vip_maxspeed", "1100")
        
        register_event("DeathMsg",         "Event_DeathMsg", "a")
    }
}

public plugin_precache()
{
    precache_sound(JETPACK_GOTSOUND)
    precache_model(JETPACK_PMODEL_VIP)
}

public plugin_natives()
{
	register_native("give_vip_jetpack", "native_give_vip_jetpack")
}


public client_connect(id)
{
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)
}
    
public client_disconnect(id)
{
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)
}

public Event_DeathMsg()
{
    new id = read_data(2)

    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)

    return PLUGIN_CONTINUE
}

public cmd_GiveSJVIP(id , level , cid) 
{
    if(!cmd_access(id , level , cid , 2))
        return PLUGIN_HANDLED
        
    new arg1[33]
    read_argv(1 , arg1 , 32)

    new target = cmd_target(id , arg1 , 0)
    if(!is_user_connected(target))
    {
        console_print(id, "Player does not exist")
        return PLUGIN_HANDLED
    }

    if(g_HasJetpack[target])
    {
        console_print(id, "Player already has a surf jetpack")
        return PLUGIN_HANDLED
    }
    
    _vip_jetpack(target)

    new Name[33], Name2[33]
    get_user_name(id, Name, 32)
    get_user_name(target, Name2, 32)
    
    console_print(id, "You gave %s a surf jetpack", Name2)
    client_print(target, print_chat, "ADMIN: %s gave you a surf jetpack", Name)
    
    return PLUGIN_HANDLED
}

public cmd_StripSJVIP(id , level , cid) 
{
    if(!cmd_access(id , level , cid , 2))
        return PLUGIN_HANDLED
        
    new arg1[33]
    read_argv(1 , arg1 , 32)

    new target = cmd_target(id , arg1 , 0)
    if(!is_user_connected(target))
    {
        console_print(id, "Player does not exist")
        return PLUGIN_HANDLED
    }

    if(!g_HasJetpack[target])
    {
        console_print(id, "Player does not have a surf jetpack")
        return PLUGIN_HANDLED
    }
    
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)

    new Name[33], Name2[33]
    get_user_name(id, Name, 32)
    get_user_name(target, Name2, 32)
    
    console_print(id, "You stripped %s a surf jetpack", Name2)
    client_print(target, print_chat, "ADMIN: %s stripped your surf jetpack", Name)
    
    return PLUGIN_HANDLED
}

public _vip_jetpack(id)
{
    g_HasJetpack[id] = 2
    client_cmd(id, "spk %s", JETPACK_GOTSOUND)
    client_print(id, print_chat, "SURF UP VIP TEST!!!!!!!!")
    
    if(g_JetpackEnt[id] < 1)
    {
        g_JetpackEnt[id] = create_entity("info_target")
        if(is_valid_ent(g_JetpackEnt[id]))
        {
            entity_set_model(g_JetpackEnt[id], JETPACK_PMODEL_VIP)
            entity_set_int(g_JetpackEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW)
            entity_set_edict(g_JetpackEnt[id], EV_ENT_aiment, id)
        }
    }
}

public _removeJetpackEnt(id)
{
    if(g_JetpackEnt[id] > 0)
        remove_entity(g_JetpackEnt[id])
    g_JetpackEnt[id] = 0
}

public client_PreThink(id)
{
    if(!is_user_alive(id) || !g_HasJetpack[id])
        return PLUGIN_CONTINUE
        
    if(get_user_speed(id) < get_pcvar_num(cvar_min_speed))
        return PLUGIN_CONTINUE    
        
    new Button = get_user_button(id)
    if(Button & IN_MOVELEFT || Button & IN_MOVERIGHT)
    {           
        _jetThrust(id)
    }
    return PLUGIN_CONTINUE
}

public _jetThrust(id)
{    
    new Float:fVelocity[3]
    entity_get_vector(id, EV_VEC_velocity, fVelocity)

    new Float:fAngle[3]
    entity_get_vector(id, EV_VEC_angles, fAngle)
    engfunc(EngFunc_MakeVectors, fAngle)
                
    new Float:fForward[3]
    get_global_vector(GL_v_forward, fForward)
                
    fVelocity[0] += fForward[0] * get_pcvar_num(cvar_thrust)
    fVelocity[1] += fForward[1] * get_pcvar_num(cvar_thrust)
            
    if(get_user_speed(id) < get_pcvar_num(cvar_max_speed))
        entity_set_vector(id, EV_VEC_velocity, fVelocity)
        
    return PLUGIN_CONTINUE
}

stock get_user_speed(id)
{
    new Float:fVelocity[3]
    entity_get_vector(id, EV_VEC_velocity, fVelocity)
    
    new iVelocity[3]
    FVecIVec(fVelocity, iVelocity)
    
    new iVelocity0 = iVelocity[0] * iVelocity[0]
    new iVelocity1 = iVelocity[1] * iVelocity[1]
    
    return sqroot(iVelocity0 + iVelocity1)
}
public native_give_vip_jetpack(iPluginID, iPluginParams)
{
	_vip_jetpack(get_param(1))
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
and then for the vip plugin i edited it like this:
Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <engine>
#include <colorchat>

#define VIP_LEVEL_ACCES ADMIN_LEVEL_H

#define SCOREATTRIB_NONE    0
#define SCOREATTRIB_DEAD    ( 1 << 0 )
#define SCOREATTRIB_BOMB    ( 1 << 1 )
#define SCOREATTRIB_VIP  ( 1 << 2 )

#define REMOVE_FLAGS "r"

native give_vip_jetpack(id)

new const g_szBeginning[ ] = "VIPS"
new g_szMessage[ 256 ];

new cvar_vip_maxap, cvar_vip_maxhp, cvar_vip_showC, cvar_vip_showH, cvar_vip_in_out, cvar_tag, cvar_start_hp, cvar_start_ap, cvar_start_money, cvar_vip_jump, cvar_hp_kill, cvar_ap_kill, jumpnum[33], bool: dojump[33], iUse[33], SyncHudMessage;
new cvar_vip_gmenu;

public plugin_init() 
{
	register_plugin("SURFXMOD VIP SYSTEM", "2.0", "Jica Macelaru");
	
	RegisterHam(Ham_Spawn, "player", "Spawn", 1);
	
	register_clcmd("say /vmenu", "check_acces", -1);
        register_clcmd("say /vipmenu", "check_acces", -1);
	register_clcmd("say /vip", "vip_info");
	register_clcmd("say /vips", "handle_say");
	register_clcmd("say_team /vips", "handle_say");
	
	register_event("DeathMsg", "eDeathMsg", "a");
	register_event("HLTV", "Event_NewRound", "a", "1=0", "2=0");
	register_message(get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib");	

	cvar_tag = register_cvar("amx_vip_tag", "VIP");
	cvar_start_hp = register_cvar("amx_start_hp", "125");
	cvar_start_ap = register_cvar("amx_start_ap", "100");
	cvar_start_money = register_cvar("amx_start_money", "800");
	cvar_vip_jump = register_cvar("amx_vip_jump", "1" );
	cvar_hp_kill = register_cvar("amx_vip_addhp", "10");	
	cvar_ap_kill = register_cvar("amx_vip_addap", "0");
	cvar_vip_in_out = register_cvar("amx_vip_in_out", "1");
	cvar_vip_showC = register_cvar("amx_vip_show_chat", "1");
	cvar_vip_showH = register_cvar("amx_vip_show_hud", "0");
	cvar_vip_maxhp = register_cvar("amx_vip_maxhp", "250");
	cvar_vip_maxap = register_cvar("amx_vip_maxap", "100");	
	cvar_vip_gmenu = register_cvar("amx_vip_gmuse", "10" );

	set_task(120.0, "mesaj_info", _, _, _, "b");
	set_task( 1.0, "TaskDisplayVips", _, _, _, "b", 0 );
	SyncHudMessage = CreateHudSyncObj( );
		
}

public Event_NewRound()
{
	arrayset(iUse, 0, 33);
}

public check_acces(id){
    if(!is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_SPECTATOR)){
	ColorChat(id,GREEN,"^1****^3You must be alive to use the ^4/vmenu^1!");
	return;
    }
    new iFlag = get_user_flags(id);
    if( iFlag & ADMIN_LEVEL_H )
        vip_menu(id)
    else
        ColorChat(id,GREEN,"^1****^3You can't access the ^4/vmenu ^1you're not a ^4VIP MEMBER!");

}

public vip_menu(id) 
{
	new menu
	switch(cs_get_user_team(id))
	{
		case CS_TEAM_CT:
		{
			menu = menu_create("\y[\rVIPMENU\y]\wSURFXMOD \yv2.0", "menu_ammunition");
			menu_additem(menu, "\yM4A1+DEAGLE+GRENADES", "1", VIP_LEVEL_ACCES);
			menu_additem(menu, "\yAWP+DEAGLE+GRENADES", "2", VIP_LEVEL_ACCES);
			menu_additem(menu, "\y[\rVIP\y] \wJetpack", "3", VIP_LEVEL_ACCES);
		}
	
		case CS_TEAM_T:
		{
			menu = menu_create("\y[\rVIPMENU\y]\wSURFXMOD \yv2.0", "menu_ammunition");
			menu_additem(menu, "\yAK47+DEAGLE+GRENADES", "1", VIP_LEVEL_ACCES);
			menu_additem(menu, "\yAWP+DEAGLE+GRENADES", "2", VIP_LEVEL_ACCES);
			menu_additem(menu, "\y[\rVIP\y] \wJetpack", "3", VIP_LEVEL_ACCES);
		}
	}
	menu_display(id, menu, 0)
	return PLUGIN_HANDLED;
}

public menu_ammunition ( id, menu, item ) 
{
	new tag[32], iMaxUse = get_pcvar_num( cvar_vip_gmenu );
	get_pcvar_string(cvar_tag, tag, charsmax(tag));
	
	if(iUse[id] >= iMaxUse )
	{
		ColorChat(id, GREEN,"^4[%s] ^1Vip menu can only be used^3 %i times^1 on a map !", tag, iMaxUse );
		return PLUGIN_HANDLED;
	}
	
	if(item == MENU_EXIT)
	{
		return PLUGIN_HANDLED;
	}

	new data[6], szName[64];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
	new key = str_to_num(data);

	if(cs_get_user_team(id) == CS_TEAM_CT)
	{
		switch(key)
		{
			case 1:
			{
				if(++iUse[id] >= iMaxUse )
				{
					ColorChat(id, GREEN,"^4[%s] ^1Vip menu can only be used^3 %i times^1 on a map !", tag, iMaxUse );
					return PLUGIN_HANDLED;
				}
				
				strip_user_weapons(id)
				give_item(id, "weapon_knife");	
				give_item(id, "weapon_m4a1");
				give_item(id, "weapon_deagle");
				give_item(id, "weapon_hegrenade");
				give_item(id, "weapon_flashbang");
				give_item(id, "weapon_smokegrenade");
				cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);
				cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
				cs_set_user_bpammo(id, CSW_M4A1, 90);
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				ColorChat(id,GREEN,"^4[%s] ^1You chose ^4M4a1^1+^4DEAGLE^1+^4NADE SET^1.",tag);
			}
			case 2:
			{
				if(++iUse[id] >= iMaxUse )
				{
					ColorChat(id, GREEN,"^4[%s] ^1Vip menu can only be used^3 %i times^1 on a map !", tag, iMaxUse );
					return PLUGIN_HANDLED;
				}
                                strip_user_weapons(id)
				give_item(id, "weapon_knife");
				give_item(id, "weapon_awp");
				give_item(id, "weapon_deagle");
				give_item(id, "weapon_hegrenade");
				give_item(id, "weapon_flashbang");
				give_item(id, "weapon_smokegrenade");
				cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);
				cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
				cs_set_user_bpammo(id, CSW_AWP, 30);
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				ColorChat(id,GREEN,"^4[%s] ^1You chose ^4AWP^1+^4DEAGLE^1+^4NADE SET^1.",tag);
			}
            case 3:
			{
				if(++iUse[id] >= iMaxUse )
				{
					ColorChat(id, GREEN,"^4[%s] ^1Vip menu can only be used^3 %i times^1 on a map !", tag, iMaxUse );
					return PLUGIN_HANDLED;
				}
				give_vip_jetpack(id);
				ColorChat(id,GREEN,"^4[%s]^1You chose the ^4VIP ^3Jetpack ^1!",tag);
			}			
		}
	}
	if(cs_get_user_team(id) == CS_TEAM_T)
	{
		switch(key)
		{
			case 1:
			{
				if(++iUse[id] >= iMaxUse )
				{
					ColorChat(id, GREEN,"^4[%s] ^1Vip menu can only be used^3 %i times^1 on a map !", tag, iMaxUse );
					return PLUGIN_HANDLED;
				}
				strip_user_weapons(id)
				give_item(id, "weapon_knife");
				give_item(id, "weapon_ak47");
				give_item(id, "weapon_deagle");
				give_item(id, "weapon_hegrenade");
				give_item(id, "weapon_flashbang");
				give_item(id, "weapon_smokegrenade");
				cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);
				cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
				cs_set_user_bpammo(id, CSW_AK47, 90);
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				ColorChat(id,GREEN,"^4[%s] ^1You chose ^4AK47^1+^4DEAGLE^1+^4NADE SET^1.",tag);
			}      
			case 2:
			{
				if(++iUse[id] >= iMaxUse )
				{
					ColorChat(id, GREEN,"^4[%s] ^1Vip menu can only be used^3 %i^1 on a map !", tag, iMaxUse );
					return PLUGIN_HANDLED;
				}
				strip_user_weapons(id)
				give_item(id, "weapon_knife");
				give_item(id, "weapon_awp");
				give_item(id, "weapon_deagle");
				give_item(id, "weapon_hegrenade");
				give_item(id, "weapon_flashbang");
				give_item(id, "weapon_smokegrenade");
				cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);
				cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
				cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
				cs_set_user_bpammo(id, CSW_AWP, 30);
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				ColorChat(id,GREEN,"^4[%s] ^1You chose ^4AWP^1+^4DEAGLE^1+^4NADE SET^1.",tag);
			}
                        case 3:
			{
				if(++iUse[id] >= iMaxUse )
				{
					ColorChat(id, GREEN,"^4[%s] ^1Vip menu can only be used^3 %i times^1 on a map !", tag, iMaxUse );
					return PLUGIN_HANDLED;
				}
				strip_user_weapons(id)
				client_cmd(id, "vipjp" , "Jetpack")
				ColorChat(id,GREEN,"^4[%s]^1You chose the ^4VIP ^3Jetpack ^1!",tag);
			}						
		}
	}
	
	menu_destroy(menu);
	return PLUGIN_HANDLED;  
}

public Spawn(id) 
{ 
	if(!is_user_alive(id))
		return;
    
	new CsTeams:team = cs_get_user_team(id) 
	if(get_user_flags(id) & VIP_LEVEL_ACCES) 
	{
		switch(team) 
	    {
		case CS_TEAM_T: 
		{
			set_user_health(id, get_pcvar_num(cvar_start_hp));
			set_user_armor(id, get_pcvar_num(cvar_start_ap));
			cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(cvar_start_money));
		}
		case CS_TEAM_CT: 
		{
			set_user_health(id, get_pcvar_num( cvar_start_hp ));
			set_user_armor(id, get_pcvar_num( cvar_start_ap ));
			cs_set_user_money(id, cs_get_user_money(id) + get_pcvar_num(cvar_start_money));
		}
	    }
	}
}

public client_disconnect( id )
{
	set_task(2.0, "out", id);

	jumpnum[id] = 0;
	dojump[id] = false;
	iUse[ id ] = 0;
}

public client_PreThink( id )
{
	if(!is_user_alive(id)) 
		return PLUGIN_CONTINUE;

	new BUTON = get_user_button(id)
	new OLDBUTON = get_user_oldbutton(id)
	new JUMP_VIP = get_pcvar_num(cvar_vip_jump) 

	if((BUTON & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(OLDBUTON & IN_JUMP))
	{
		if(((get_user_flags(id) & VIP_LEVEL_ACCES) && (jumpnum[id] < JUMP_VIP)))
		{
			dojump[id] = true
			jumpnum[id]++
		}
	}

	if((BUTON & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		jumpnum[id] = 0
	}

	return PLUGIN_CONTINUE;
}

public client_PostThink(id) 
{
	if(!is_user_alive(id)) 
		return PLUGIN_CONTINUE;

	if(dojump[id] == true)
	{
		new Float: velocity[3]	
		entity_get_vector(id, EV_VEC_velocity, velocity)
		velocity[2] = random_float(265.0, 285.0)
		entity_set_vector(id, EV_VEC_velocity, velocity)
		dojump[id] = false
	}
	return PLUGIN_CONTINUE;
}

public eDeathMsg()
{
	new id_Killer = read_data(1);
	new VIP_MAXHP = get_pcvar_num(cvar_vip_maxhp);
	new VIP_MAX_HP = get_user_health(id_Killer);
	new VIP_MAXAP = get_pcvar_num(cvar_vip_maxap);
	new VIP_MAX_AP = get_user_armor(id_Killer);

	if(is_user_alive(id_Killer))
	{
		if(get_user_flags(id_Killer) & VIP_LEVEL_ACCES )
			{
				set_user_health(id_Killer, get_user_health(id_Killer) + get_pcvar_num(cvar_hp_kill));
				set_user_armor(id_Killer, get_user_armor(id_Killer) + get_pcvar_num(cvar_ap_kill));
			}
	}

	if(VIP_MAX_HP >= VIP_MAXHP)
	{
               	set_user_health(id_Killer, get_pcvar_num(cvar_vip_maxhp));
		return PLUGIN_HANDLED;
	}
	
	if(VIP_MAX_AP >= VIP_MAXAP)
	{
               	set_user_armor(id_Killer, get_pcvar_num(cvar_vip_maxap));
		return PLUGIN_HANDLED;
	}

	return PLUGIN_HANDLED;
}

public in(id) 	
{
	if(get_pcvar_num(cvar_vip_in_out))
	{
		new tag[32], name[32];

		get_pcvar_string(cvar_tag, tag, charsmax(tag)); 
		get_user_name(id, name, charsmax(name)); 

		if(get_user_flags(id) & VIP_LEVEL_ACCES)   
		{ 
			ColorChat(0, GREEN, "^3[%s]^4%s ^1entered the server.", tag, name); 
		}
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public out(id) 	
{	
	if(get_pcvar_num(cvar_vip_in_out))
	{
		new tag[32], name[32];

		get_pcvar_string(cvar_tag, tag, charsmax(tag)); 
		get_user_name(id, name, charsmax(name)); 

		if(get_user_flags(id) & VIP_LEVEL_ACCES)   
		{ 
			ColorChat(0, GREEN, "^3[%s]^4%s ^1left the server.", tag, name); 
		}
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public vip_info(id)
{
	show_motd(id, "/addons/amxmodx/configs/vip_info.html");
}

public mesaj_info()	
{
	new tag[32];
	get_pcvar_string(cvar_tag, tag, charsmax(tag));
	
	ColorChat(0, GREEN, "^3[%s] ^1Type in chat ^4/vip ^1to see the vip price and its benefits.", tag);
}

public TaskDisplayVips( )
{
	if(get_pcvar_num(cvar_vip_showH))
	{
		static iPlayers[ 32 ];
		static iPlayersNum;
	
		get_players( iPlayers, iPlayersNum, "ch" );
		if( !iPlayersNum )
			return 1;
	
		static iVipsConnected, szVipsNames[ 128 ], szName[ 32 ];
		formatex( szVipsNames, sizeof ( szVipsNames ) -1, "" ); // Is this needed ?
		iVipsConnected = 0;
	
		static id, i;
		for( i = 0; i < iPlayersNum; i++ )
		{
			id = iPlayers[ i ];
			if( get_user_flags( id ) & VIP_LEVEL_ACCES )
			{
				get_user_name( id, szName, sizeof ( szName ) -1 );
			
				add( szVipsNames, sizeof ( szVipsNames ) -1, szName );
				add( szVipsNames, sizeof ( szVipsNames ) -1, "^n" );
			
				iVipsConnected++;
			}
		}
	
		formatex( g_szMessage, sizeof ( g_szMessage ) -1, "%s ( %i )^n%s",
			g_szBeginning, iVipsConnected, szVipsNames );
		
		set_hudmessage( 25, 255, 25, 0.01, 0.25, 0, 0.0, 1.0, 0.1, 0.1, -1 );
		ShowSyncHudMsg( 0, SyncHudMessage, g_szMessage );
	}
	return PLUGIN_CONTINUE;
		
}

public handle_say(id)
{
    new said[192];
    read_args(said,192);
    if(contain(said, "/vips") != -1)
    set_task(0.1,"print_adminlist",id);
    return PLUGIN_CONTINUE;
}
 
public print_adminlist(user)
{
    if(get_pcvar_num(cvar_vip_showC))
    {
        new tag[32];
        get_pcvar_string(cvar_tag, tag, charsmax(tag));
   
        new adminnames[33][32];
        new message[256];
        new id, count, x, len;
 
        for(id = 1 ; id <= get_maxplayers() ; id++)
            if(is_user_connected(id))
                if(get_user_flags(id) & VIP_LEVEL_ACCES)
                    get_user_name(id, adminnames[count++], charsmax(adminnames[ ]));
   
        len = format(message, 255, "^3[%s] ^1online ^4VIP ^1members:^3 " ,tag);
        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, " ");
                }
                }
            print_message(user, message);
            }
        else
        {
            ColorChat(0, GREEN, "^3[%s] ^1All the ^4VIP^1 members are ^3offline.", tag);
        }
    }
    return PLUGIN_CONTINUE;  
}
 
print_message(id, msg[])
{
    message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id);
    write_byte(id);
    write_string(msg);
    message_end();
}
 
public MessageScoreAttrib(iMsgID, iDest, iReceiver)
{
        new iPlayer = get_msg_arg_int(1);
        if(is_user_connected( iPlayer )
        && (get_user_flags( iPlayer ) & VIP_LEVEL_ACCES))
        {
                set_msg_arg_int(2, ARG_BYTE, is_user_alive(iPlayer) ? SCOREATTRIB_VIP : SCOREATTRIB_DEAD);
            }
}

Last edited by gfxchris; 12-01-2020 at 04:49. Reason: edited,natives in the jetpack were wrong
gfxchris is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-01-2020 , 22:31   Re: how to change this (add item into a menu)
Reply With Quote #17

If it's working, congrats on getting it working!
__________________
fysiks is offline
gfxchris
Member
Join Date: Feb 2016
Old 12-01-2020 , 23:38   Re: how to change this (add item into a menu)
Reply With Quote #18

fixed the initial post,edited

so now i have two jetpacks on the server,i wanna add a message that says "You already have a normal jetpack!" or "You already have a VIP jetpack!" in case of vip jetpack
how it's right now they just override eachother,and i think that if im buying the normal jetpack,and then the vip jetpack,or the vip jetpack first and then the normal one,it gives me the stats of the vip jp (which are higher)

so,if a player writes /buyjetpack (has a normal jetpack) and then uses /vmenu and he selects the vip jetpack,he'll receive a client_print [or a chat_color] that'll say something like "can't buy the vip jetpack! you already have a normal one!")

any tips on how to do this?

Last edited by gfxchris; 12-02-2020 at 16:58. Reason: fixed inital post
gfxchris is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-03-2020 , 00:29   Re: how to change this (add item into a menu)
Reply With Quote #19

Having them both in a single plugin would have made that very easy and would have intrinsically prevented a dual jetpack situation.

Not what I would do (and not the best option, IMO) but I guess it would be possible to use an xvar to communicate the jetpack state of a player. Set it to 1 for the normal jetpack and 2 for the VIP jetpack and check for that when in the purchase (normal plugin) and give native (VIP jetpack plugin or maybe your VIP menu). That is, if you are willing to modify the original plugin.

One really nice benefit of having the jetpacks in a single plugin is that you could easily have one supersede the other (e.g. if you have the normal jetpack and request the VIP one, you could get the VIP one as an upgrade).
__________________
fysiks is offline
gfxchris
Member
Join Date: Feb 2016
Old 12-03-2020 , 11:30   Re: how to change this (add item into a menu)
Reply With Quote #20

well,that wouldn't be bad but the original jetpack im using in a shop system,and therefore i have a native for it

here's the plugin edited (hopefully is right) to use the 2 jetpacks

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <engine>

#if defined client_disconnected
#define client_disconnect client_disconnected
#endif

native fcs_get_user_credits(index)
native fcs_set_user_credits(index, amount)

stock fcs_sub_user_credits(client, credits)
{
	return fcs_set_user_credits(client, fcs_get_user_credits(client) - credits);
}

new JETPACK_PMODEL[]     = "models/p_longjump.mdl"
new JETPACK_PMODEL_VIP[]     ="models/surfx_models/p_longjump_vip.mdl"
new JETPACK_GOTSOUND[]     = "items/ammopickup2.wav"

new cvar_cost
new cvar_thrust
new cvar_min_speed
new cvar_max_speed
new cvar_thrustvip
new cvar_minspeedvip
new cvar_maxspeedvip

new g_HasJetpack[33]
new g_JetpackEnt[33]

static const PLUGIN_NAME[]     = "SyN Surf Jetpack"
static const PLUGIN_AUTHOR[]     = "Cheap_Suit"
static const PLUGIN_VERSION[]    = "1.4"

public plugin_init()
{
    new mapName[33]
    get_mapname(mapName, 32)
    
    if(!equali(mapName, "surf_", 5))
    {
        new pluginName[33]
        format(pluginName, 32, "[Disabled] %s", PLUGIN_NAME)
        register_plugin(pluginName, PLUGIN_VERSION, PLUGIN_AUTHOR)
        pause("ade")
    }
    else
    {
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
        register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SPONLY|FCVAR_SERVER)
        
        register_clcmd("sjp_givesj" ,         "cmd_GiveSJ",         ADMIN_IMMUNITY, "<userid> - Gives free surf jetpack")
        register_clcmd("sjp_stripsj" ,         "cmd_StripSJ",         ADMIN_IMMUNITY, "<userid> - Strips users surf jetpack")
        
        register_clcmd("say /buyjp",     "cmd_BuySurfJetpack", 0, "Buys surf jetpack")
        register_clcmd("say /jp",     "cmd_BuySurfJetpack", 0, "Buys surf jetpack")
        register_concmd("buy_jetpack",         "cmd_BuySurfJetpack", 0, "Buys surf jetpack")
        register_concmd("buyjetpack",         "cmd_BuySurfJetpack", 0, "Buys surf jetpack")
        
        cvar_cost    = get_cvar_num("fcsshop_jetpack_price")
        cvar_thrust     = register_cvar("sjp_thrust", "5")
        cvar_min_speed     = register_cvar("sjp_min_speed", "600")
        cvar_max_speed     = register_cvar("sjp_max_speed", "900")
        cvar_thrustvip     = register_cvar("vip_thrust", "8")
        cvar_minspeedvip     = register_cvar("vip_minspeed", "700")
        cvar_maxspeedvip     = register_cvar("vip_maxspeed", "1100")
        
        register_event("DeathMsg",         "Event_DeathMsg", "a")
    }
}

public plugin_precache()
{
    precache_sound(JETPACK_GOTSOUND)
    precache_model(JETPACK_PMODEL)
    precache_model(JETPACK_PMODEL_VIP)
}

public plugin_natives()
{
	register_native("give_jetpack", "native_give_jetpack")
}

public client_connect(id)
{
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)
}
    
public client_disconnect(id)
{
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)
}

public Event_DeathMsg()
{
    new id = read_data(2)

    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)

    return PLUGIN_CONTINUE
}

public cmd_BuySurfJetpack(id)
{
    new iMoney = fcs_get_user_credits(id)
    new iCost = cvar_cost
    
    if(!is_user_alive(id)) 
        client_print(id, print_center, "You cant buy when your dead!")
    else if(g_HasJetpack[id])
        client_print(id, print_center, "You already own a surf jetpack.")
    else if(iMoney < iCost)
        client_print(id, print_center, "Insufficient funds! (%d Credits)", iCost)
    else
    {
        _give_Jetpack(id)
        fcs_sub_user_credits(id, iCost)
      }
    return PLUGIN_HANDLED
}

public cmd_GiveSJ(id , level , cid) 
{
    if(!cmd_access(id , level , cid , 2))
        return PLUGIN_HANDLED
        
    new arg1[33]
    read_argv(1 , arg1 , 32)

    new target = cmd_target(id , arg1 , 0)
    if(!is_user_connected(target))
    {
        console_print(id, "Player does not exist")
        return PLUGIN_HANDLED
    }

    if(g_HasJetpack[target])
    {
        console_print(id, "Player already has a surf jetpack")
        return PLUGIN_HANDLED
    }
    
    _give_Jetpack(target)

    new Name[33], Name2[33]
    get_user_name(id, Name, 32)
    get_user_name(target, Name2, 32)
    
    console_print(id, "You gave %s a surf jetpack", Name2)
    client_print(target, print_chat, "ADMIN: %s gave you a surf jetpack", Name)
    
    return PLUGIN_HANDLED
}

public cmd_StripSJ(id , level , cid) 
{
    if(!cmd_access(id , level , cid , 2))
        return PLUGIN_HANDLED
        
    new arg1[33]
    read_argv(1 , arg1 , 32)

    new target = cmd_target(id , arg1 , 0)
    if(!is_user_connected(target))
    {
        console_print(id, "Player does not exist")
        return PLUGIN_HANDLED
    }

    if(!g_HasJetpack[target])
    {
        console_print(id, "Player does not have a surf jetpack")
        return PLUGIN_HANDLED
    }
    
    g_HasJetpack[id] = 0
    _removeJetpackEnt(id)

    new Name[33], Name2[33]
    get_user_name(id, Name, 32)
    get_user_name(target, Name2, 32)
    
    console_print(id, "You stripped %s a surf jetpack", Name2)
    client_print(target, print_chat, "ADMIN: %s stripped your surf jetpack", Name)
    
    return PLUGIN_HANDLED
}

public _give_Jetpack(id)
{
    g_HasJetpack[id] = 2
    client_cmd(id, "spk %s", JETPACK_GOTSOUND)
    client_print(id, print_chat, "You've got a surf jetpack! :: HOW TO USE :: ~ Just Surf ~ ")
    
    if(g_JetpackEnt[id] < 1)
    {
        g_JetpackEnt[id] = create_entity("info_target")
        if(is_valid_ent(g_JetpackEnt[id]))
        {
            entity_set_model(g_JetpackEnt[id], g_HasJetpack[id] == 2 ? JETPACK_PMODEL_VIP : JETPACK_PMODEL) 
            entity_set_int(g_JetpackEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW)
            entity_set_edict(g_JetpackEnt[id], EV_ENT_aiment, id)
        }
    }
}

public _removeJetpackEnt(id)
{
    if(g_JetpackEnt[id] > 0)
        remove_entity(g_JetpackEnt[id])
    g_JetpackEnt[id] = 0
}

public client_PreThink(id)
{
    if(!is_user_alive(id) || !g_HasJetpack[id])
        return PLUGIN_CONTINUE
        
    if(get_user_speed(id) < get_pcvar_num(g_HasJetpack[id] == 2 ? cvar_minspeedvip : cvar_min_speed)) 
        return PLUGIN_CONTINUE    
        
    new Button = get_user_button(id)
    if(Button & IN_MOVELEFT || Button & IN_MOVERIGHT)
    {           
        _jetThrust(id)
    }
    return PLUGIN_CONTINUE
}

public _jetThrust(id)
{    
    new Float:fVelocity[3]
    entity_get_vector(id, EV_VEC_velocity, fVelocity)

    new Float:fAngle[3]
    entity_get_vector(id, EV_VEC_angles, fAngle)
    engfunc(EngFunc_MakeVectors, fAngle)
                
    new Float:fForward[3]
    get_global_vector(GL_v_forward, fForward)
                
    fVelocity[0] += fForward[0] * get_pcvar_num( g_HasJetpack[id] == 2 ? cvar_thrustvip : cvar_thrust ) 
    fVelocity[1] += fForward[1] * get_pcvar_num( g_HasJetpack[id] == 2 ? cvar_thrustvip : cvar_thrust ) 
            
    if(get_user_speed(id) < get_pcvar_num(g_HasJetpack[id] == 2 ? cvar_maxspeedvip : cvar_max_speed)) 
        entity_set_vector(id, EV_VEC_velocity, fVelocity)
        
    return PLUGIN_CONTINUE
}

stock get_user_speed(id)
{
    new Float:fVelocity[3]
    entity_get_vector(id, EV_VEC_velocity, fVelocity)
    
    new iVelocity[3]
    FVecIVec(fVelocity, iVelocity)
    
    new iVelocity0 = iVelocity[0] * iVelocity[0]
    new iVelocity1 = iVelocity[1] * iVelocity[1]
    
    return sqroot(iVelocity0 + iVelocity1)
}

public native_give_jetpack(iPluginID, iPluginParams)
{
	_give_Jetpack(get_param(1))
}
anyways i need to implement the other native for the vip jetpack,and i dont know how to do it,and also,this piece of code here

Code:
public _give_Jetpack(id)
{
    g_HasJetpack[id] = 2
    client_cmd(id, "spk %s", JETPACK_GOTSOUND)
    client_print(id, print_chat, "You've got a surf jetpack! :: HOW TO USE :: ~ Just Surf ~ ")
on this code,i need to write two codes,one with a g_hasjetpack = 1 and the other set with two?
gfxchris is offline
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 05:42.


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