View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-28-2020 , 06:05   Re: how to change this (add item into a menu)
Reply With Quote #9

Quote:
Originally Posted by gfxchris View Post
i wanna ask something,i know how to edit and add minor things,im not an experienced scripter

new g_HasJetpack[33]
new g_JetpackEnt[33]

if i change those with

new g_VipHasJetpack[33]
new_g_VipJetpackEnt[33]
would it work ? and changing the entire script with the new vip line in front
I don't think that that would be the best way to approach this. When giving a VIP jetpack, I would simply set g_HasJetpack to 2 (instead of the normal 1) to indicate that it's the VIP version of the jetpack. This basically wouldn't require changing any current uses of the g_hasJetpack variable which makes thing so much simpler.

Then for g_JetpackEnt, you would simply use a different model in entity_set_model() when you create the entity if g_hasJetpack is 2. For example:

PHP Code:
entity_set_model(g_JetpackEnt[id], g_HasJetpack[id] == JETPACK_PMODEL_VIP JETPACK_PMODEL
where you define JETPACK_PMODEL_VIP as the VIP model (make sure to precache this too).

Quote:
Originally Posted by gfxchris View Post
also changing the sjp_givejp and sjp_stripjp with sjp_givejpvip and sjp_stripjpvip
and also the cvars with a vip in front,would that work ?
If you want the VIP jetpack to have their own cvars, that is certainly possible and actually would be quite simple to implement. Wherever the cvars are used in the original plugin, you would use the VIP versions of the cvars if g_HasJetpack is 2. For example:

PHP Code:
get_pcvar_num(cvar_max_speed
would change to:
PHP Code:
get_pcvar_numg_HasJetpack[id] == cvar_maxspeed_vip cvar_max_speed 
assuming cvar_maxspeed_vip is the cvar pointer for the VIP version of that cvar.


I think that if you have a little experience and want to learn more, this is something that you can do. To test it, you can simply copy the _give_Jetpack() function and name this new function something else and set the g_HasJetpack variable to 2 and then have it called via a new client command with register_clcmd() (just for testing). Then, once you have the new jetpack working, you can add in the ability to invoke it from another plugin.
__________________
fysiks is offline