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

[CS:S] No Spec Hop Cash


Post New Thread Reply   
 
Thread Tools Display Modes
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-14-2011 , 02:54   Re: [CS:S] No Spec Hop Cash
Reply With Quote #11

Okay... I'm pretty sure I fixed up the plugin to correctly use CreateArray, FindStringInArray, GetArrayCell, RemoveFromArray, PushArrayString, and PushArrayCell.

See OP for latest Version 1.4

This plugin is only for you if you "only" want to stop people from gaining money by spectate hopping. If you want to also save the scores of the players, see the plugin mentioned in the OP called SaveScores
TnTSCS is offline
sinblaster
Grim Reaper
Join Date: Feb 2010
Location: Australia
Old 09-14-2011 , 04:26   Re: [CS:S] No Spec Hop Cash
Reply With Quote #12

Awesome job TnT you're getting pretty good at this stuff

This is great for me because I sell homing missiles and people are spec hopping to by another.
__________________
Happy Happy Joy Joy


Last edited by sinblaster; 09-14-2011 at 04:29.
sinblaster is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-14-2011 , 04:31   Re: [CS:S] No Spec Hop Cash
Reply With Quote #13

I have never taken a class on programming - read a "Teach Yourself Visual Basic in 7 Days" book years and years ago...

If not for the extensive guides and examples, I would be having a really tough time.

I'm enjoying coding and learning. I really appreciate it when others show me different ways of handling things. There's usually more than one way to write a plugin and I appreciate the helpful criticism.
TnTSCS is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 09-17-2011 , 08:27   Re: [CS:S] No Spec Hop Cash
Reply With Quote #14

So I found a few errors that crept up on the logs. There are some translatable phrases in the plugin but there's no phrases file posted =/ Also, for the 0.1 second one-shot timer, unless you're worried they will repeat that same action within the 0.1 second window then you can get away with not storing the timer handle. I'll test later and post back but I think that's it.
__________________
databomb is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-17-2011 , 11:17   Re: [CS:S] No Spec Hop Cash
Reply With Quote #15

DOH... I forgot to post the translation files, added in OP... sorry

The thing with the timer is if I don't use that timer, then the cash isn't updated until the player spawns... I'll do a bit more testing w/o the timer just to double check.

I just re-read what you said... ya, I could probably get rid of the handle for the timer... no need for that

updated OP with new version 1.4a with handle for timer removed

Last edited by TnTSCS; 09-17-2011 at 11:55.
TnTSCS is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 09-20-2011 , 16:41   Re: [CS:S] No Spec Hop Cash
Reply With Quote #16

I believe the data structure you're looking for is a trie. You'd use an array like this if you're looking to compare values, or sequentially iterate through contents (Trie's lack this. However, you're searching by SteamID for their cash so a Trie would be better. Unless if I'm missing something entirely).
KyleS is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-20-2011 , 16:43   Re: [CS:S] No Spec Hop Cash
Reply With Quote #17

I'll have to go read up on Trie's... if that is something where I can store the players cash amount when they leave the server and then retrieve that cash amount if they return within the same map.
TnTSCS is offline
databomb
Veteran Member
Join Date: Jun 2009
Location: california
Old 09-20-2011 , 18:26   Re: [CS:S] No Spec Hop Cash
Reply With Quote #18

Quote:
Originally Posted by TnTSCS View Post
I'll have to go read up on Trie's... if that is something where I can store the players cash amount when they leave the server and then retrieve that cash amount if they return within the same map.
Yes, I may have led you astray. Although you're tracking it effectively, having two separate, sequential cells is not ideal. Also, some users have reported seeing negative cash trying to be restored, so there might still be another bug.
__________________
databomb is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-22-2011 , 18:38   Re: [CS:S] No Spec Hop Cash
Reply With Quote #19

Quote:
Originally Posted by KyleS View Post
I believe the data structure you're looking for is a trie. You'd use an array like this if you're looking to compare values, or sequentially iterate through contents (Trie's lack this. However, you're searching by SteamID for their cash so a Trie would be better. Unless if I'm missing something entirely).
I am having trouble with this for some reason.

Am I on the right track?

PHP Code:
new Handle:h_Trie;
new 
PlayersCashAmount[MAXPLAYERS+1];

public 
OnPluginStart()
{
    
h_Trie CreateTrie();
}

public 
OnClientDisconnect(client)
{
    if(
IsClientInGame(client) && !IsFakeClient(client))
    {
        
decl String:authString[20];
        
GetClientAuthString(clientauthString20);
        
        new 
playerCash GetPlayersCash(client);
        
SetTrieValue(h_TrieauthStringplayerCash);
    }
}

public 
OnClientAuthorized(client,const String:auth[])
{
    if(!
IsFakeClient(client))
    {
        new 
cash 1;
        if(
GetTrieValue(h_Trieauthcash))
        {
            
SetEntProp(clientProp_Send"m_iAccount"cash);
            
RemoveFromTrie(h_Trieauth);// So, on disconnect, a new value could be added
        
}
    }

I'm using #2 post as an example

...:: TnT Edit ::...
Oh, and will I have to add a ClearTrie(h_Trie): on map end or something or does the handle and/or trie get cleared when the map changes?

Last edited by TnTSCS; 09-22-2011 at 18:59.
TnTSCS is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-23-2011 , 15:57   Re: [CS:S] No Spec Hop Cash
Reply With Quote #20

Version 1.5
- Changed from using array's to using a Trie - thanks for the heads up on that KyleS - it's a better suited data structure

Download plugin and translation file from OP

KyleS - let me know if I did it wrong or writeright

Last edited by TnTSCS; 09-24-2011 at 01:01.
TnTSCS 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 19:31.


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