Raised This Month: $ Target: $400
 0% 

number not increasing correctly?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-18-2005 , 17:17   number not increasing correctly?
Reply With Quote #1

ok for my lockpick plug in i am making it so how many sucessfull lock picking you done makes you gain lock picking skills.. etc. problem is thou that its not doing it right. here is code.

Code:
  //////////////////////////////////////////////////////////////////////////////////////////  // Lockskill level one  //////////////////////////////////////////////////////////////////////////////////////////  public lockskillone(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new doorid, doorbody, isdoor;         new pick = random_num(0, 20)         new increase = 0;         new breakpick = random_num(0, 20)     get_user_aiming(id,doorid,doorbody,9999);     if(is_valid_ent(doorid)) { // if valid ent         isdoor = is_door(doorid);     }     else { // if invalid ent         client_print(id,print_chat,"* [DOOR] Door is invalid or non-existant^n");         return PLUGIN_HANDLED;     }     if(isdoor == 0) { // if not a door entity         if(is_button(doorid)) { // if really a button             buttonuse(id); // go to button use             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"* [LockPick] Must be near Door to lockpick^n");         return PLUGIN_HANDLED;     }     if(doorid > MAXDOORS-1) { // if exceeds our array         client_print(id,print_chat,"* [DOOR] ERROR: Too many entities^n");         return PLUGIN_HANDLED;     }     if(pick < 15) { // if lockpick doesnt work         client_print(id,print_chat,"* [LockPick] LockPick not successfull^n");         return PLUGIN_HANDLED;     }         if(breakpick == 3) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         if(increase == 5) { // Breakpick         client_print(id,print_chat,"* [LockPick] Your lockpicking skill has increased to level 2^n");                 lockskill = 2;                 set_task(0.1, "employmentstatus", id);         return PLUGIN_HANDLED;     }         if(breakpick == 10) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         if(breakpick == 19) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         // gotta wait to picklock foo'         if(canpick <= 0) {             client_print(id,print_chat,"* [LOCKPICK] You do not have a lockpick, buy one from admin.^n");             return PLUGIN_HANDLED;         }     force_use(id,doorid); // use the darn door         client_print(id,print_chat,"* [LockPick] Door has been LockPicked Sucessfully^n");         increase += 1;         set_task(0.1, "picklock", id);     return PLUGIN_HANDLED;  }  //////////////////////////////////////////////////////////////////////////////////////////  // Lockskill level two  //////////////////////////////////////////////////////////////////////////////////////////  public lockskilltwo(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new doorid, doorbody, isdoor;         new pick = random_num(0, 20)         new breakpick = random_num(0, 20)         new increase = 0;     get_user_aiming(id,doorid,doorbody,9999);     if(is_valid_ent(doorid)) { // if valid ent         isdoor = is_door(doorid);     }     else { // if invalid ent         client_print(id,print_chat,"* [DOOR] Door is invalid or non-existant^n");         return PLUGIN_HANDLED;     }     if(isdoor == 0) { // if not a door entity         if(is_button(doorid)) { // if really a button             buttonuse(id); // go to button use             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"* [LockPick] Must be near Door to lockpick^n");         return PLUGIN_HANDLED;     }     if(doorid > MAXDOORS-1) { // if exceeds our array         client_print(id,print_chat,"* [DOOR] ERROR: Too many entities^n");         return PLUGIN_HANDLED;     }     if(pick < 12) { // if lockpick doesnt work         client_print(id,print_chat,"* [LockPick] LockPick not successfull^n");         return PLUGIN_HANDLED;     }         if(breakpick == 3) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         if(increase == 30) { // Breakpick         client_print(id,print_chat,"* [LockPick] Your lockpicking skill has increased to level 3^n");                 lockskill = 3;                 set_task(0.1, "employmentstatus", id);         return PLUGIN_HANDLED;     }         if(breakpick == 19) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         // gotta wait to picklock foo'         if(canpick <= 0) {             client_print(id,print_chat,"* [LOCKPICK] You do not have a lockpick, buy one from admin.^n");             return PLUGIN_HANDLED;         }     force_use(id,doorid); // use the darn door         client_print(id,print_chat,"* [LockPick] Door has been LockPicked Sucessfully^n");         increase += 1;         set_task(0.1, "picklock", id);     return PLUGIN_HANDLED;  }  //////////////////////////////////////////////////////////////////////////////////////////  // Lockskill level three  //////////////////////////////////////////////////////////////////////////////////////////  public lockskillthree(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new doorid, doorbody, isdoor;         new pick = random_num(0, 20)         new breakpick = random_num(0, 20)         new increase = 0;     get_user_aiming(id,doorid,doorbody,9999);     if(is_valid_ent(doorid)) { // if valid ent         isdoor = is_door(doorid);     }     else { // if invalid ent         client_print(id,print_chat,"* [DOOR] Door is invalid or non-existant^n");         return PLUGIN_HANDLED;     }     if(isdoor == 0) { // if not a door entity         if(is_button(doorid)) { // if really a button             buttonuse(id); // go to button use             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"* [LockPick] Must be near Door to lockpick^n");         return PLUGIN_HANDLED;     }     if(doorid > MAXDOORS-1) { // if exceeds our array         client_print(id,print_chat,"* [DOOR] ERROR: Too many entities^n");         return PLUGIN_HANDLED;     }     if(pick < 10) { // if lockpick doesnt work         client_print(id,print_chat,"* [LockPick] LockPick not successfull^n");         return PLUGIN_HANDLED;     }         if(breakpick == 3) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         if(increase == 40) { // Breakpick         client_print(id,print_chat,"* [LockPick] Your lockpicking skill has increased to level 4 ^n");                 lockskill = 4;                 set_task(0.1, "employmentstatus", id);         return PLUGIN_HANDLED;     }         // gotta wait to picklock foo'         if(canpick <= 0) {             client_print(id,print_chat,"* [LOCKPICK] You do not have a lockpick, buy one from admin.^n");             return PLUGIN_HANDLED;         }     force_use(id,doorid); // use the darn door         client_print(id,print_chat,"* [LockPick] Door has been LockPicked Sucessfully^n");         increase += 1;         set_task(0.1, "picklock", id);     return PLUGIN_HANDLED;  }  //////////////////////////////////////////////////////////////////////////////////////////  // Lockskill level four  //////////////////////////////////////////////////////////////////////////////////////////  public lockskillfour(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new doorid, doorbody, isdoor;         new pick = random_num(0, 20)         new breakpick = random_num(0, 20)         new increase = 0;     get_user_aiming(id,doorid,doorbody,9999);     if(is_valid_ent(doorid)) { // if valid ent         isdoor = is_door(doorid);     }     else { // if invalid ent         client_print(id,print_chat,"* [DOOR] Door is invalid or non-existant^n");         return PLUGIN_HANDLED;     }     if(isdoor == 0) { // if not a door entity         if(is_button(doorid)) { // if really a button             buttonuse(id); // go to button use             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"* [LockPick] Must be near Door to lockpick^n");         return PLUGIN_HANDLED;     }     if(doorid > MAXDOORS-1) { // if exceeds our array         client_print(id,print_chat,"* [DOOR] ERROR: Too many entities^n");         return PLUGIN_HANDLED;     }     if(pick < 8) { // if lockpick doesnt work         client_print(id,print_chat,"* [LockPick] LockPick not successfull^n");         return PLUGIN_HANDLED;     }         if(breakpick == 1) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         if(increase == 50) { // Breakpick         client_print(id,print_chat,"* [LockPick] Your lockpicking skill has increased to level 5 ^n");                 lockskill = 5;                 set_task(0.1, "employmentstatus", id);         return PLUGIN_HANDLED;     }         // gotta wait to picklock foo'         if(canpick <= 0) {             client_print(id,print_chat,"* [LOCKPICK] You do not have a lockpick, buy one from admin.^n");             return PLUGIN_HANDLED;         }     force_use(id,doorid); // use the darn door         client_print(id,print_chat,"* [LockPick] Door has been LockPicked Sucessfully^n");         increase += 1;         set_task(0.1, "picklock", id);     return PLUGIN_HANDLED;  }  //////////////////////////////////////////////////////////////////////////////////////////  // Lockskill level five  //////////////////////////////////////////////////////////////////////////////////////////  public lockskillfive(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new doorid, doorbody, isdoor;         new breakpick = random_num(0, 20)     get_user_aiming(id,doorid,doorbody,9999);     if(is_valid_ent(doorid)) { // if valid ent         isdoor = is_door(doorid);     }     else { // if invalid ent         client_print(id,print_chat,"* [DOOR] Door is invalid or non-existant^n");         return PLUGIN_HANDLED;     }     if(isdoor == 0) { // if not a door entity         if(is_button(doorid)) { // if really a button             buttonuse(id); // go to button use             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"* [LockPick] Must be near Door to lockpick^n");         return PLUGIN_HANDLED;     }     if(doorid > MAXDOORS-1) { // if exceeds our array         client_print(id,print_chat,"* [DOOR] ERROR: Too many entities^n");         return PLUGIN_HANDLED;     }         if(breakpick == 15) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         // gotta wait to picklock foo'         if(canpick <= 0) {             client_print(id,print_chat,"* [LOCKPICK] You do not have a lockpick, buy one from admin.^n");             return PLUGIN_HANDLED;         }     force_use(id,doorid); // use the darn door         client_print(id,print_chat,"* [LockPick] Door has been LockPicked Sucessfully^n");         set_task(0.1, "picklock", id);     return PLUGIN_HANDLED;  }

the problem is its that it doesnt seem to increase or something i tried setting it to if increase is 2 then it levels up but no matter how many times i am sucessfull ti never levels up
__________________
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
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-18-2005 , 21:32  
Reply With Quote #2

Code:
increase = 0

Code:
if(increase == 50)

What did you expect?

P.S. Why do you have 5 functions for the same thing?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-19-2005 , 09:04  
Reply With Quote #3

damn i forgot i set it to 0 each time, thanks tons.

and reason is cause each funtion is different like your odds of opening lock etc greatly increases
__________________
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
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-19-2005 , 16:25  
Reply With Quote #4

its still not working, i just got home and tried it. here is my code


Code:
 //////////////////////////////////////////////////////////////////////////////////////////  // Picklock  //////////////////////////////////////////////////////////////////////////////////////////  public picklocktwo(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new doorid, doorbody, isdoor;     get_user_aiming(id,doorid,doorbody,9999);     if(is_valid_ent(doorid)) { // if valid ent         isdoor = is_door(doorid);     }     else { // if invalid ent         client_print(id,print_chat,"* [DOOR] Door is invalid or non-existant^n");         return PLUGIN_HANDLED;     }     if(isdoor == 0) { // if not a door entity         if(is_button(doorid)) { // if really a button             buttonuse(id); // go to button use             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"* [LockPick] Must be near Door to lockpick^n");         return PLUGIN_HANDLED;     }     if(doorid > MAXDOORS-1) { // if exceeds our array         client_print(id,print_chat,"* [DOOR] ERROR: Too many entities^n");         return PLUGIN_HANDLED;     }         if(lockskill == 1) { // if lockpick doesnt work         set_task(0.1, "lockskillone", id);         return PLUGIN_HANDLED;     }         if(lockskill == 2) { // Breakpick                 set_task(0.1, "lockskilltwo", id);         return PLUGIN_HANDLED;     }         if(lockskill == 3) { // Breakpick                 set_task(0.1, "lockskillthree", id);         return PLUGIN_HANDLED;     }         if(lockskill == 4) { // Breakpick                 set_task(0.1, "lockskillfour", id);         return PLUGIN_HANDLED;     }         if(lockskill == 5) { // Breakpick                 set_task(0.1, "lockskillfive", id);         return PLUGIN_HANDLED;     }
Code:
 //////////////////////////////////////////////////////////////////////////////////////////  // Lockskill level one  //////////////////////////////////////////////////////////////////////////////////////////  public lockskillone(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new doorid, doorbody, isdoor;         new pick = random_num(0, 20)         new increase         new breakpick = random_num(0, 20)     get_user_aiming(id,doorid,doorbody,9999);     if(is_valid_ent(doorid)) { // if valid ent         isdoor = is_door(doorid);     }     else { // if invalid ent         client_print(id,print_chat,"* [DOOR] Door is invalid or non-existant^n");         return PLUGIN_HANDLED;     }     if(isdoor == 0) { // if not a door entity         if(is_button(doorid)) { // if really a button             buttonuse(id); // go to button use             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"* [LockPick] Must be near Door to lockpick^n");         return PLUGIN_HANDLED;     }     if(doorid > MAXDOORS-1) { // if exceeds our array         client_print(id,print_chat,"* [DOOR] ERROR: Too many entities^n");         return PLUGIN_HANDLED;     }     if(pick < 15) { // if lockpick doesnt work         client_print(id,print_chat,"* [LockPick] LockPick not successfull^n");         return PLUGIN_HANDLED;     }         if(breakpick == 3) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         if(increase == 2) { // Breakpick         client_print(id,print_chat,"* [LockPick] Your lockpicking skill has increased to level 2^n");                 lockskill = 2;                 set_task(0.1, "employmentstatus", id);         return PLUGIN_HANDLED;     }         if(breakpick == 10) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         if(breakpick == 19) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;         }         // gotta wait to picklock foo'         if(canpick <= 0) {             client_print(id,print_chat,"* [LOCKPICK] You do not have a lockpick, buy one from admin.^n");             return PLUGIN_HANDLED;         }     force_use(id,doorid); // use the darn door         client_print(id,print_chat,"* [LockPick] Door has been LockPicked Sucessfully^n");         increase += 1;         set_task(0.1, "picklock", id);     return PLUGIN_HANDLED;  }  //////////////////////////////////////////////////////////////////////////////////////////  // Lockskill level two  //////////////////////////////////////////////////////////////////////////////////////////  public lockskilltwo(id) {     /*if(!cmd_access(id,level,cid,1)) {     return PLUGIN_HANDLED;     }*/     new doorid, doorbody, isdoor;         new pick = random_num(0, 20)         new breakpick = random_num(0, 20)         new increase     get_user_aiming(id,doorid,doorbody,9999);     if(is_valid_ent(doorid)) { // if valid ent         isdoor = is_door(doorid);     }     else { // if invalid ent         client_print(id,print_chat,"* [DOOR] Door is invalid or non-existant^n");         return PLUGIN_HANDLED;     }     if(isdoor == 0) { // if not a door entity         if(is_button(doorid)) { // if really a button             buttonuse(id); // go to button use             return PLUGIN_HANDLED;         }         client_print(id,print_chat,"* [LockPick] Must be near Door to lockpick^n");         return PLUGIN_HANDLED;     }     if(doorid > MAXDOORS-1) { // if exceeds our array         client_print(id,print_chat,"* [DOOR] ERROR: Too many entities^n");         return PLUGIN_HANDLED;     }     if(pick < 12) { // if lockpick doesnt work         client_print(id,print_chat,"* [LockPick] LockPick not successfull^n");         return PLUGIN_HANDLED;     }         if(breakpick == 3) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         if(increase == 2) { // Breakpick         client_print(id,print_chat,"* [LockPick] Your lockpicking skill has increased to level 3^n");                 lockskill = 3;                 set_task(0.1, "employmentstatus", id);         return PLUGIN_HANDLED;     }         if(breakpick == 19) { // Breakpick         client_print(id,print_chat,"* [LockPick] You broke your lockpick^n");                 canpick = 0;         return PLUGIN_HANDLED;     }         // gotta wait to picklock foo'         if(canpick <= 0) {             client_print(id,print_chat,"* [LOCKPICK] You do not have a lockpick, buy one from admin.^n");             return PLUGIN_HANDLED;         }     force_use(id,doorid); // use the darn door         client_print(id,print_chat,"* [LockPick] Door has been LockPicked Sucessfully^n");         increase += 1;         set_task(0.1, "picklock", id);     return PLUGIN_HANDLED;  }
__________________
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
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-19-2005 , 16:56  
Reply With Quote #5

Code:
new increase
and
Code:
new increase = 0
do the same thing. You have to give increase some value, maybe using random_num?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-19-2005 , 17:11  
Reply With Quote #6

that would cause a problem wouldnt it... cause it would make a new random number everytime... and then i would have same prob of when it was set to 1 everytime :-/ anyone have a solution?
__________________
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
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-19-2005 , 17:24  
Reply With Quote #7

How are you storing a user's points to determine level? Is it for that map only or is it stored for a long time using sql/vault? This is not hard to make work either way, just need to know which way you want.
slurpycof is offline
Bone
Member
Join Date: Mar 2005
Location: Under your bed
Old 04-19-2005 , 17:38  
Reply With Quote #8

i would like it to be stores in vault and when he gains level it saves it in vault

so it saves his lockskill level as well as how many points he has.
__________________
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
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-19-2005 , 20:14  
Reply With Quote #9

give this a shot
Code:
#include <vault> new lockskill[33] public plugin_init()[     register_cvar("amx_picklvl","5")//points required for each level }   public client_authorized(id){     new authid[32]     get_user_authid(id,authid,31)     if (is_user_hltv(id) ) {  //Do not do anything         return PLUGIN_CONTINUE     }     if ( is_user_bot(id) ) {  //Do not do anything         return PLUGIN_CONTINUE     }     if(vaultdata_exists(authid)){         new vault_lockskill[32]         get_vaultdata(authid,vault_lockskill,31)         lockskill[id] = str_to_num(vault_lockskill)     }else{//No data exists         lockskill[id] = 0     }     return PLUGIN_CONTINUE } public lockskillone(id) {     //BLAH BLAH BLAH     force_use(id,doorid); // use the darn door     client_print(id,print_chat,"* [LockPick] Door has been LockPicked Sucessfully^n");     lockskill[id]++     set_task(0.1, "picklock", id)     return PLUGIN_HANDLED }     public client_disconnect (id){     if ( is_user_bot(id) ) {  //Do not add to database         return PLUGIN_CONTINUE     }     if (is_user_hltv(id) ) {  //Do not add to database         return PLUGIN_CONTINUE     }     new authid[32]     get_user_authid(id,authid,31)     new vault_lockskill[32]     num_to_str(lockskill[id],vault_lockskill,31)     set_vaultdata(authid,vault_lockskill)     return PLUGIN_HANDLED }      public query_picklevel(id, level, cid){     new message [192]     read_args(message, 190)     remove_quotes(message)     if (containi(message,"/picklevel")!=-1) {         if (lockskill[id]== 0) {             client_print(id,print_chat,"You are still a level one lockpicker")         }else{             new picklevel             picklevel = (lockskill[id] / get_cvar_num("amx_picklvl")) //not sure if this works or if you need to assign cvar to a new variable             client_print(id,print_chat,"You are a level %i lockpicker",picklevel)         }         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE  }
slurpycof is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-19-2005 , 20:23  
Reply With Quote #10

Quote:
Code:
public plugin_init()[
__________________
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
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:51.


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