AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Allowing a command one a map for each player (https://forums.alliedmods.net/showthread.php?t=54373)

sskillz 04-23-2007 22:48

Allowing a command one a map for each player
 
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.

Styles 04-23-2007 23:08

Re: Allowing a command one a map for each player
 
Okay Explain more please. What type of command ect.. Like FullUpdate? Or what? Hashes meaning MD5?

scrtxxcaz 04-23-2007 23:54

Re: Allowing a command one a map for each player
 
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
          }
}
/


sskillz 04-24-2007 00:50

Re: Allowing a command one a map for each player
 
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.

YamiKaitou 04-24-2007 00:58

Re: Allowing a command one a map for each player
 
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.

sskillz 04-24-2007 20:13

Re: Allowing a command one a map for each player
 
10x, But that code won't work for me, I don't want them to override the limit if they rejoin the server...

pRED* 04-24-2007 20:53

Re: Allowing a command one a map for each player
 
Lol gonna be hard then dude.

Read up on vault saving by steam id and reseting the vault on map change..

sskillz 05-06-2007 01:14

Re: Allowing a command one a map for each player
 
Ill try to find something without the vault :|
Maybe save Uid ina string or something..

scrtxxcaz 05-06-2007 02:11

Re: Allowing a command one a map for each player
 
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
      }


pRED* 05-06-2007 21:32

Re: Allowing a command one a map for each player
 
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...


All times are GMT -4. The time now is 06:42.

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