Raised This Month: $ Target: $400
 0% 

make vaules global?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-20-2005 , 16:22   make vaules global?
Reply With Quote #1

I am trying make lottery thing in my rp plug in here is current code.

Code:
 ////////////////////////////////////////////////////////////////////  // Start Lottery  //////////////////////////////////////////////////////////////////  public cmd_startlotto(id,level,cid) {     if(!cmd_access(id,level,cid,2)) {         return PLUGIN_HANDLED;     }     // start lotto         new winningticket = random_num (0, 3)     new arg1[256];         new hudstring[256];             read_argv(1,arg1,255);                 new jackpot = str_to_num(arg1)         format(hudstring,255,"%s",lotterymsg);                 return PLUGIN_HANDLED;  }  ////////////////////////////////////////////////////////////////////  // Buy Lotto Ticket  //////////////////////////////////////////////////////////////////  public buyticket(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new ticket = random_num(0,3)         if(haveticket = 1) { // if exceeds our array         client_print(id,print_chat,"* [Lotto] You already have lotto ticket, gotta make it fair^n");         return PLUGIN_HANDLED;     }         client_print(id,print_chat,"* [Lotto] You bought a lotto ticket^n");         return PLUGIN_HANDLED;  }  ////////////////////////////////////////////////////////////////////  // check Lotto Ticket  ////////////////////////////////////////////////////////////////// public checkticket(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/             if(ticket != winningticket) { // if exceeds our array         client_print(id,print_chat,"* [Lotto] you did not win, try again next time!^n");         return PLUGIN_HANDLED;         }                 client_print(id,print_chat,"* [Lotto] YOU WON THE LOTTERY!!! CONGRATS!!!^n");         userwallet[id] += jackpot         return PLUGIN_HANDLED;  }

the thing is that like checkticket doesnt know bout jackpot which is in when u start loteery etc.. so is there was make variable global so that all commands and shit can use it.
__________________
the shirt covered her face, she screamed and clawed, so billy stomped on the bitch until he broke in her jaw.
Bone is offline
Send a message via MSN to Bone
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 04-20-2005 , 16:30  
Reply With Quote #2

Code:
new Global_variable new Global_variable2 // This is where you would put global variables etc, at the top of the file after the #include //////////////////////////////////////////////////////////////////// // Start Lottery ////////////////////////////////////////////////////////////////// public cmd_startlotto(id,level,cid) {     if(!cmd_access(id,level,cid,2)) {         return PLUGIN_HANDLED;     }     // start lotto         new winningticket = random_num (0, 3)     new arg1[256];         new hudstring[256];             read_argv(1,arg1,255);                 new jackpot = str_to_num(arg1)         format(hudstring,255,"%s",lotterymsg);                 return PLUGIN_HANDLED; } //////////////////////////////////////////////////////////////////// // Buy Lotto Ticket ////////////////////////////////////////////////////////////////// public buyticket(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new ticket = random_num(0,3)         if(haveticket = 1) { // if exceeds our array         client_print(id,print_chat,"* [Lotto] You already have lotto ticket, gotta make it fair^n");         return PLUGIN_HANDLED;     }         client_print(id,print_chat,"* [Lotto] You bought a lotto ticket^n");         return PLUGIN_HANDLED; } //////////////////////////////////////////////////////////////////// // check Lotto Ticket ////////////////////////////////////////////////////////////////// public checkticket(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/             if(ticket != winningticket) { // if exceeds our array         client_print(id,print_chat,"* [Lotto] you did not win, try again next time!^n");         return PLUGIN_HANDLED;         }                 client_print(id,print_chat,"* [Lotto] YOU WON THE LOTTERY!!! CONGRATS!!!^n");         userwallet[id] += jackpot         return PLUGIN_HANDLED; }
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-20-2005 , 16:32  
Reply With Quote #3

Can it also be g_* ? ;)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 04-20-2005 , 16:32  
Reply With Quote #4

Quote:
Originally Posted by v3x
Can it also be g_* ? ;)
It can be v3x_* if you want it lol.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-20-2005 , 16:33  
Reply With Quote #5

Quote:
Originally Posted by v3x
Can it also be g_* ? ;)
Yes, it can have any name, stop making useless posts!! :-)
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 09:54.


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