Raised This Month: $ Target: $400
 0% 

Problem with my CS Pick up manager


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 08-02-2016 , 14:41   Problem with my CS Pick up manager
Reply With Quote #1

I'm trying to make an plugin cs pick up manager, blocking weapons from nvault.


The problem is that i stay with loot of guys in my house, always noise and i can think properly of what i'm doing + working only night so i'm realy fuck up, and i missing a lot of detail when i'm trying to make a new plugin.

If somebody can help my with plugin and tell me what's wrong thank you very much.


The problem is that i don't know how to hork properly with New vault so if somebody have time to check that's all.

Code

Last edited by Craxor; 08-28-2016 at 04:08.
Craxor is offline
Send a message via ICQ to Craxor
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 08-02-2016 , 15:32   Re: Problem with my CS Pick up manager
Reply With Quote #2

You're wondering on how you should save those blocked weapons or?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 08-03-2016 , 01:47   Re: Problem with my CS Pick up manager
Reply With Quote #3

I'm wrong on some things and i don't know how to do them.


1 ) I don't know how to check if my vault contain a string ( model of the weapon ) , this part:

Code:
    new szWeaponModel[40];     pev( ent, pev_model, szWeaponModel, charsmax( szWeaponModel ) )     new iCvarValue = get_pcvar_num( giTypeCvar );     if( nvault_get( gNewVault, szWeaponModel ) )     {


2 ) I have no idea if it's realy saved or not in the vault

Code:
new Arg1[16];     read_argv( 1, Arg1, charsmax( Arg1 ) );     new adder[64];     formatex( adder, charsmax( adder ), "models/w_%s.mdl", Arg1 );     nvault_set( gNewVault, adder , PLUGIN );


Anyway, i will make more research, but if somebody have knowledge in this and have a minute free, he can answer, thanks.
__________________
Project: Among Us

Last edited by Craxor; 08-03-2016 at 01:48.
Craxor is offline
Send a message via ICQ to Craxor
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 08-03-2016 , 04:09   Re: Problem with my CS Pick up manager
Reply With Quote #4

this could be usefull https://forums.alliedmods.net/showthread.php?t=91503
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 08-03-2016 , 13:29   Re: Problem with my CS Pick up manager
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
NO no no no, i read the thread, but my mind is to fuck-up and i can concentrare to it.

Anyway don't worry, i will solve by myself on future when wil be quiet on my home don't worry.

Edit: ok, so i tested a little and the event works weell, the problem is the way i'm doing with nvault, i will come back
__________________
Project: Among Us

Last edited by Craxor; 08-03-2016 at 13:55.
Craxor is offline
Send a message via ICQ to Craxor
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 08-28-2016 , 03:48   Re: Problem with my CS Pick up manager
Reply With Quote #6

bump.

Last edited by Craxor; 08-28-2016 at 04:07.
Craxor is offline
Send a message via ICQ to Craxor
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-28-2016 , 12:00   Re: Problem with my CS Pick up manager
Reply With Quote #7

Your problem is you are using the same nvault key for all models that you are trying to block. nVault keys are unique so you can only have a particular key once in a vault file. If you do multiple nvault_set()'s with the same key, it just overwrites the previous data with the new data. If you want to allow multiple weapon blocks, you need a unique key for each weapon.

Your way:
Code:
KEY="CS Pick up manager"
DATA="models/w_%s.mdl"
Every time you 'add' a new weapon, it overwrites that record so you essentially can only have one at a time. Each add simply overwrites whatever model is under that "CS Pick up manager" key.

Fixed way:
Code:
KEY="models/w_%s.mdl"
DATA="1" ; This "1" value doesn't matter, if you want to store any information here you can. This can be the player who added it to the block list or the time/date it was blocked, etc.
Doing it this way, each time you do an add, it adds a record to the vault. If you accidentally added the same weapon twice you would not get duplicates since each key is unique.

I didn't check to see if the rest of your code is correct, I only fixed the nVault stuff. If it were me, I would add an array of all valid weapons and scan through that to confirm the weapon name being specified by the 'add' command is a valid weapon. Otherwise you will end up with users adding a block to the block list, and the block will not actually work due to a possible misspelling in the name. You should download the nVault Editor tool (see sig). It would have helped you to discover this issue on your own.


Spoiler
__________________

Last edited by Bugsy; 08-28-2016 at 12:10.
Bugsy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 08-28-2016 , 12:32   Re: Problem with my CS Pick up manager
Reply With Quote #8

Thank you so much bugsy, you are a life saver <3
Craxor is offline
Send a message via ICQ to Craxor
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 09-12-2016 , 02:49   Re: Problem with my CS Pick up manager
Reply With Quote #9

Ok, so nvault works very fine right now but i have one more problem and it's ready.

So let's say i already one weapon in the vault and the plugin suppose to block it when i try to pick up the weapon ( when cvar cspum_type is 2 ) ... ok ,... the problem is:

First time when i touch the weapon i CAN take it i can pick up it and after i drop it i no more can take it, it behave normal after whan pickup + manual drop. And that's happen only to a single weapon, if i found another ak47(example) on the map is the same, i can pick up it, after i drop it i no more can pick up it ... is like when i touch it saves the entity index is very weird, here's the new code, if someone have a minute to check it: https://github.com/CraxorAMXX/CSPick...ster/CSPum.sma
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-13-2016 , 22:00   Re: Problem with my CS Pick up manager
Reply With Quote #10

I am not having an issue, it seems to work normally for me but I only gave it a quick test. You aren't doing any reference to entity index so I don't think it is because of that. There may be other things that are wrong in your code but the below are the things that I quickly noticed.
Code:
public addkey( id, level, cid ) {     if( !cmd_access( id, level, cid, 2 ) )         return PLUGIN_HANDLED;     new Arg1[16];     read_argv( 1 , Arg1, charsmax( Arg1 ) );     new adder[64];     formatex( adder, charsmax( adder ), "models/w_%s.mdl", Arg1 );     new szVaultData[ 60 ] , iTS;         if( nvault_lookup( gNewVault, adder , szVaultData, charsmax( szVaultData ) , iTS ) )     {         client_print( id, 2, "This key is already saved in the pick up manager list." );         return PLUGIN_HANDLED;     }     //This loop should begin at 1 since item 0 is "========== All weapons-key avaible to add to add in list ========== ",     for( new i = 0; i < sizeof ( gKeyList ) ; i++ )     {         //You should search the entire list before deciding whether or not the key exists in the list. In your code, the loop is going to         //exit after the first iteration.                 //contain/containi/strfind all return the position of the found substring. In some cases, this can be at the beginning of the         //string which is position 0 so doing a !containi() condition is wrong, it should be if ( containi() == -1 ) then string not found.         if ( !containi( gKeyList[i], Arg1 ) )         {             client_print( id , 2, "Unnable to found this key, type amx_cspum_keylist for all keys avaible to insert." );             return PLUGIN_HANDLED;         }         else         {               client_print( id , 2, "You succesfully added %s in list!", Arg1 );             nvault_set( gNewVault, adder , "1" );             return PLUGIN_HANDLED;         }     }         return PLUGIN_HANDLED; } public OnPlayerTouchWeaponBox( ent , id ) {     if( !ent || !id )         return -1;     new szWeaponModel[40];     pev( ent, pev_model, szWeaponModel, charsmax( szWeaponModel ) )     new iCvarValue = get_pcvar_num( giTypeCvar );     new szVaultData[ 60 ] , iTS;         //I would not call nvault_lookup() in a touch forward. This is called way too much and the nvault module is getting     //spammed with lookup calls. You should store each of your weapons status in an array, maybe refresh it each round.     if( nvault_lookup( gNewVault, szWeaponModel , szVaultData, charsmax( szVaultData ) , iTS ) )     {         switch( iCvarValue )         {             case 1: engfunc( EngFunc_RemoveEntity, ent );             case 2: return PLUGIN_HANDLED;             default: return PLUGIN_CONTINUE;         }     }     return PLUGIN_CONTINUE; }
__________________

Last edited by Bugsy; 09-13-2016 at 22:11.
Bugsy 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 00:47.


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