Raised This Month: $ Target: $400
 0% 

Editing HWRP Plugins - Distributing Weapons, Deleting Stuff?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BetaX
Member
Join Date: Nov 2005
Old 06-13-2006 , 03:38   Editing HWRP Plugins - Distributing Weapons, Deleting Stuff?
Reply With Quote #1

Here is the problem: This plugin is either A) stuck in a loop, and/or B) deleting random things from the server it runs on. Why?

What it should do: It should give a weapon to anyone with the JobID of 100, or the Weapons Dealer. This should only be done if they have less than 2 weapons on them, and if it is time for a payment.

Pay Salary Code:

Code:
 // Pay Salary Code  public salary(id)       {       new num, players[32]       get_players(players,num,"ac")       for( new i = 0;  i < num; i++ )            {            if( timer_salary[players[i]] > 0)                 {                 // Is Player in Jail??!?!?                 new origin[3]                 get_user_origin(players[i],origin)                 if(get_distance(origin,jailone) <= 100.0 || get_distance(origin,jailtwo) <= 100.0 || get_distance(origin,jailthree) <= 100.0 || get_distance(origin,jailfour) <= 100.0)                      {                 }                 else                 {                      timer_salary[players[i]] -= 1                 }            }            else if ( timer_salary[players[i]] <= 0 )                 {                 new query[256], authid[32], JobID                 get_user_authid(players[i],authid,31)                 format(query,255,"SELECT JobID FROM money WHERE steamid='%s'",authid[i])                 result = dbi_query( dbc, query)                 distrib_weapons(players[i]);                         if( dbi_nextrow( result ) > 0 )                      {                      JobID = dbi_field(result,1)                      dbi_free_result(result)                 }                 dbi_free_result(result)            format( query, 255, "SELECT Salary FROM jobs WHERE JobID=%i", JobID)                 result = dbi_query( dbc, query)                 if( dbi_nextrow( result ) > 0 )                      {                      new salaryf                      salaryf = dbi_field(result,1)                      dbi_free_result(result)                      if(get_cvar_num("rp_salary_to_wallet") == 0)                           {                           format( query, 255, "UPDATE money SET balance=balance+%i WHERE steamid='%s'",salaryf,authid)                                                }                      if(get_cvar_num("rp_salary_to_wallet") == 1)                           {                           format( query, 255, "UPDATE money SET wallet=wallet+%i WHERE steamid='%s'",salaryf,authid)                                      }                      timer_salary[players[i]] = 60                      dbi_query(dbc,query)                 }                 dbi_free_result(result)                              }       }       dbi_free_result(result)       return PLUGIN_CONTINUE  }

Code I added: (distrib_weapons)

Code:
 public distrib_weapons(distrib_id) {       client_print(distrib_id, print_chat, "[DW] distrib_weapons")       new query[256], Job, distrib_authid2[32];       get_user_authid(distrib_id,distrib_authid2,31);       format(query,255,"SELECT JobID FROM money WHERE steamid='%s'",distrib_authid2);       result = dbi_query( dbc, query);       Job = dbi_field(result,1)       dbi_free_result(result)             if (!Job == 100)       {             client_print(distrib_id, print_chat, "[DW] You are not a weapons dealer.");            return PLUGIN_HANDLED;                     } else {            client_print(distrib_id, print_chat, "[DW] Getting your weapons...");            new weapons[32], weaponNum;            get_user_weapons(distrib_id, weapons, weaponNum);                   if (weaponNum < 2) {                                         client_print(distrib_id, print_chat, "[DW] Giving you a weapon.");                            ts_giveweapon(distrib_id,9,100,0);                     }             }                 return PLUGIN_HANDLED;             }

And yes, my indenting is horrid.
BetaX is offline
Spanky McNutnut
AMX Mod X Beta Tester
Join Date: Feb 2006
Old 06-13-2006 , 03:43  
Reply With Quote #2

I'm not that good a scripting, but should there be a ; after that last,
Code:
PLUGIN_HANDLED

??
Spanky McNutnut is offline
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 06-13-2006 , 04:13  
Reply With Quote #3

;s in pawn don't do anything.
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-13-2006 , 04:17  
Reply With Quote #4

unless..
Code:
#pragma semicolon 1
;-)
__________________
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
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 06-13-2006 , 04:19  
Reply With Quote #5

I still don't understand that.

Quote:
Originally Posted by Stupid people
Let me add a line to my code to make it have less of a chance to compile
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
Spanky McNutnut
AMX Mod X Beta Tester
Join Date: Feb 2006
Old 06-13-2006 , 04:42  
Reply With Quote #6

Quote:
Originally Posted by GHW_Chronic
;s in pawn don't do anything.
kk

Quote:
Originally Posted by v3x
unless..
Code:
#pragma semicolon 1
;-)
O_o
Spanky McNutnut is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 06-13-2006 , 04:51  
Reply With Quote #7

Enough spamming, thanks.

continue.
__________________
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
Des12
Senior Member
Join Date: Jan 2005
Old 06-13-2006 , 15:57   Re: Editing HWRP Plugins - Distributing Weapons, Deleting St
Reply With Quote #8

Code:
 // Pay Salary Code  public salary(id)       {       new num, players[32]       get_players(players,num,"ac")       for( new i = 0;  i < num; i++ )            {            if( timer_salary[players[i]] > 0)                 {                 // Is Player in Jail??!?!?                 new origin[3]                 get_user_origin(players[i],origin)                 if(get_distance(origin,jailone) <= 100.0 || get_distance(origin,jailtwo) <= 100.0 || get_distance(origin,jailthree) <= 100.0 || get_distance(origin,jailfour) <= 100.0)                      {                 }                 else                 {                      timer_salary[players[i]] -= 1                 }            }            else if ( timer_salary[players[i]] <= 0 )                 {                 new query[256], authid[32], JobID                 get_user_authid(players[i],authid,31)                 format(query,255,"SELECT JobID FROM money WHERE steamid='%s'",authid)                 result = dbi_query( dbc, query)                 distrib_weapons(players[i]);                         if( dbi_nextrow( result ) > 0 )                      {                      JobID = dbi_field(result,1)                      dbi_free_result(result)                 }                 dbi_free_result(result)            format( query, 255, "SELECT Salary FROM jobs WHERE JobID=%i", JobID)                 result = dbi_query( dbc, query)                 if( dbi_nextrow( result ) > 0 )                      {                      new salaryf                      salaryf = dbi_field(result,1)                      dbi_free_result(result)                      if(get_cvar_num("rp_salary_to_wallet") == 0)                           {                           format( query, 255, "UPDATE money SET balance=balance+%i WHERE steamid='%s'",salaryf,authid)                                                }                      if(get_cvar_num("rp_salary_to_wallet") == 1)                           {                           format( query, 255, "UPDATE money SET wallet=wallet+%i WHERE steamid='%s'",salaryf,authid)                                      }                      timer_salary[players[i]] = 60                      dbi_query(dbc,query)                 }                 dbi_free_result(result)                              }       }       dbi_free_result(result)       return PLUGIN_CONTINUE  }

Try that (authid had an [i] behind it)
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 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 08:09.


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