Raised This Month: $ Target: $400
 0% 

Editing HWRP Plugins - Distributing Weapons, Deleting Stuff?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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:08.


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