Raised This Month: $ Target: $400
 0% 

Count


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 05-30-2004 , 17:04   Count
Reply With Quote #1

How would you make a count, so that it knows how many times you have used a command on the player.
__________________
Nick is offline
Send a message via MSN to Nick
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 05-30-2004 , 19:50  
Reply With Quote #2

a global variable.. increment it each time you run the command..

(global variables are any variables declared at the top of the code (usually) )
xeroblood is offline
Send a message via MSN to xeroblood
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 05-30-2004 , 20:07  
Reply With Quote #3

Can you post an example
__________________
Nick is offline
Send a message via MSN to Nick
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 05-30-2004 , 20:56  
Reply With Quote #4

Code:
new noob public NotNoob(id) {      noob+=1      client_cmd(id,"say I'm not a noob")      server_cmd("say YES U ARE!!!!!!!!!!") } public plugin_init() {     register_plugin("NOOB","1337","Lamer")     register_clcmd("notanoob","NotNoob",0,"NOOB!!!") }
__________________
My Plugins

Got ??
AssKicR is offline
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 05-30-2004 , 21:53  
Reply With Quote #5

Thanks alot
__________________
Nick is offline
Send a message via MSN to Nick
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 05-30-2004 , 22:06  
Reply With Quote #6

ok how about something like this:
1st time command used on player - slap
2nd time command use don player - slay
3rd command on player - kick
__________________
Nick is offline
Send a message via MSN to Nick
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 05-31-2004 , 06:20  
Reply With Quote #7

Code:
new g_CmdCounter[32];   // 32 - every player has a separate counter public client_connect(id) {      g_CmdCounter[id] = 0;    // Reset counter for this client } public cmd(id) {      switch (++g_CmdCounter[id])      {      case 1:           // first time command used      case 2:           // second time      case 3:           // third time      }      return PLUGIN_HANDLED; } public plugin_init() {     register_plugin("NOOB","1337","Lamer")     register_clcmd("cmd", "cmd"); }

That could work
__________________
hello, i am pm
PM is offline
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 05-31-2004 , 19:43  
Reply With Quote #8

Hey thanks alot that helps a bunch
__________________
Nick is offline
Send a message via MSN to Nick
Nick
Senior Member
Join Date: Apr 2004
Location: Canada, Alberta, Cal
Old 05-31-2004 , 20:31  
Reply With Quote #9

Alright I got this error but Im not sure what it means.

Code:
error 002: only a single statement (or expression) can follow each "case"
__________________
Nick is offline
Send a message via MSN to Nick
Burnzy
Veteran Member
Join Date: Apr 2004
Old 05-31-2004 , 20:51  
Reply With Quote #10

show us ur script that gives the error
__________________
Burnzy is offline
Send a message via AIM to Burnzy
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 07:02.


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