Raised This Month: $ Target: $400
 0% 

Allowing a command one a map for each player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sskillz
Member
Join Date: Apr 2005
Old 04-23-2007 , 22:48   Allowing a command one a map for each player
Reply With Quote #1

Hello, Is there a way to count how many times a user used a command in the current map so I can limit how many times he can use it?

The problam is that I don't see pawn using hashs, and I don't really want to use the vault.
sskillz is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 04-23-2007 , 23:08   Re: Allowing a command one a map for each player
Reply With Quote #2

Okay Explain more please. What type of command ect.. Like FullUpdate? Or what? Hashes meaning MD5?
Styles is offline
Send a message via AIM to Styles
scrtxxcaz
Senior Member
Join Date: Feb 2007
Location: a place u cant find
Old 04-23-2007 , 23:54   Re: Allowing a command one a map for each player
Reply With Quote #3

you can do somin like this... but i dont know what command you want it for so i cant help on that part but this will be a counter and if the counter reaches the limit the code will no longer execute
Code:
new count[32] = 0
new limit = 5 //whatever u want to be
public plugin_int() {
         register_plugin("","","")
}
public counter(id) { 
         if(count[id] <= limit)
         {
                 count[id]++
                 //command here
          }
}
/
__________________
Please leave your name when giving me any karma

Counter Strike Freeze Tag
Status: Testing.... (bugs)

Revised Registration
Status: In Progress

Last edited by scrtxxcaz; 04-23-2007 at 23:58.
scrtxxcaz is offline
Send a message via AIM to scrtxxcaz
sskillz
Member
Join Date: Apr 2005
Old 04-24-2007 , 00:50   Re: Allowing a command one a map for each player
Reply With Quote #4

10x, But thats what I already did, How can it work if its based on a index of a player? which can be from 1 to 32.
Now lets say 32 people in the server will use the command <limit> times
and leave the server, each item (1-32) in the array will be equal to <limit> denying the command from that id.
Then another 32 people diffrent people (could also be 1..) will join the server, they wouldnt be able to use the command.

Maybe I miss understood how the id value is generated,
10x ahead.

Last edited by sskillz; 04-24-2007 at 00:53.
sskillz is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 04-24-2007 , 00:58   Re: Allowing a command one a map for each player
Reply With Quote #5

id is based on the player index, not their #userid. But, try adding this into that code

PHP Code:
public client_disconnect(id)
{
    
count[id] = 0;
}

public 
client_connect(id)
{
    
count[id] = 0;

Also, the count array has to be index to 33, not 32. The array gets numbered 0 through (length - 1). So, if you set it to 32, then the positions are 0 through 31. id has a value of 1 through 32.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
sskillz
Member
Join Date: Apr 2005
Old 04-24-2007 , 20:13   Re: Allowing a command one a map for each player
Reply With Quote #6

10x, But that code won't work for me, I don't want them to override the limit if they rejoin the server...
sskillz is offline
pRED*
Join Date: Dec 2006
Old 04-24-2007 , 20:53   Re: Allowing a command one a map for each player
Reply With Quote #7

Lol gonna be hard then dude.

Read up on vault saving by steam id and reseting the vault on map change..
pRED* is offline
sskillz
Member
Join Date: Apr 2005
Old 05-06-2007 , 01:14   Re: Allowing a command one a map for each player
Reply With Quote #8

Ill try to find something without the vault
Maybe save Uid ina string or something..
sskillz is offline
scrtxxcaz
Senior Member
Join Date: Feb 2007
Location: a place u cant find
Old 05-06-2007 , 02:11   Re: Allowing a command one a map for each player
Reply With Quote #9

i havent tested this but maybe this would work


Code:
new leavecount,leaveid[32]
public client_disconnect(id) 
{ 
     leavecount = count[id]
     count[id] = 0; 
     new steamid[32]
     get_user_authid(id,leaveid,31)
} 
 
public client_connect(id) 
{ 
      new steamid[32]
      get_user_authid(id,steamid,31)
      if(!leaveid == steamid)
      {
             count[id] = 0; 
      }
      else{
             count[id] = leavecount
      }
}  
__________________
Please leave your name when giving me any karma

Counter Strike Freeze Tag
Status: Testing.... (bugs)

Revised Registration
Status: In Progress
scrtxxcaz is offline
Send a message via AIM to scrtxxcaz
pRED*
Join Date: Dec 2006
Old 05-06-2007 , 21:32   Re: Allowing a command one a map for each player
Reply With Quote #10

That would only work If a player retryed straight away.

If they were to disconnect and then come back later it wouldn't work.

You could do the exact same thing but using an array of saved steam id (not sure how many you'd need.. 20..)
When they leave overwrite a blank spot in the array or the oldest steam id.
On connect search to see if the steam id is in the array...
pRED* 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 06:42.


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