AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   money problem (https://forums.alliedmods.net/showthread.php?t=93976)

sb123 06-05-2009 03:26

money problem
 
hi,Who can add in this plug-in bonus money 2-5 people

PHP Code:

/* Rewarding
   ver 0.1 By Zhao on 2004.12.4
*/
#include <amxmodx>
#include <cstrike>
#define BIG_MONEY_INDEX 16
new rewards[20]={50,100,300,500,1000,3000,5000,8000,10000,15000,20000,25000,40000,50000,80000,100000,150000,200000,500000,900000}//Rewarding Ramdon
new g_firstblood
new g_random
new rewardedbig
public ramdon_money(params[]){
 new 
killer=params[0]
 new 
oldamount=params[1]
 new 
amount
 
new killername[32]
 new 
random_range,randomvalue
 random_range
=(rewardedbig)?BIG_MONEY_INDEX:20
 
for(;;){
  
randomvalue=random(random_range)
  
amount=rewards[randomvalue]
  if (
amount!=oldamount) break;
 }
 
get_user_name(killer,killername,31)
 if (
g_random>0){
  
g_random--
  
set_hudmessage(0,255,0,0.05,0.25,00.020.40.010.12)
  
show_hudmessage(0,"%s Kills enemy bravely !! And be award %6d Dollars by Server",killername,amount)
  new 
param[2]
  
param[0]=killer 
  param
[1]=amount
  set_task
(0.3,"ramdon_money",0,param,1)
 } 
 else {
  if(
randomvalue>=BIG_MONEY_INDEXrewardedbig=1
  set_hudmessage
(0,255,0,0.050.2500.026.00.010.12)
  
show_hudmessage(0,"%s Kills enemy bravely !! And be award %6d Dollars by Server",killername,amount)
  
cs_set_user_money(killer,cs_get_user_money(killer)+amount)
 }
}
public 
eDeathMsg(){
 new 
killer,victim,TK
 killer
=read_data(1)
 if(!
killer) return PLUGIN_CONTINUE
 victim
=read_data(2)
 
TK=(get_user_team(killer)==get_user_team(victim))?1:0
 
new wpnname[4]
 
read_data(4,wpnname,3)
 if(
equal(wpnname,"c4")||TK) return PLUGIN_CONTINUE
 
new selfkill = ( killer==victim ) ? 1:0
 
if (selfkill) return PLUGIN_CONTINUE
 
if (g_firstblood){
  
g_firstblood=0
  g_random
=6
  
new param[2]
  
param[0]=killer
  param
[1]=0;
  
ramdon_money(param)
 }
 return 
PLUGIN_CONTINUE 
}
public 
new_round(){
 
g_firstblood=1
}
public 
eRestart(){
 
g_firstblood 0
 rewardedbig 
0
}
public 
plugin_init(){
 
register_plugin("First Killer Reward","0.1","Zhao")
 
register_event("DeathMsg","eDeathMsg","a"
 
g_firstblood=1
 rewardedbig 
0



TitANious 06-05-2009 03:33

Re: money problem
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>

#define PLUGIN "Money bonus"
#define VERSION "1.0"
#define AUTHOR "TitANious"

new pCvarMoney

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
pCvarMoney register_cvar("sv_money""30")
}
public 
client_putinserver(id)
{
    new 
iMoney cs_get_user_money(id)
    new 
iPcvar get_pcvar_num(pCvarMoney)
    
cs_set_user_money(idiMoney iPcvar);


Would this work? It compiles fine :D
I dont understand what you are meaning, so i hope this is that :)

sb123 06-05-2009 05:46

Re: money problem
 
What I mean is to increase the 2 3 4 5 award
I add 2 3 4 5 award
But the plugins can not be compiled
Who can help me

if(randomvalue>=BIG_MONEY_INDEX) rewardedbig=2
set_hudmessage(225,133,115,-1.0, 0.21, 0, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0,"%s got the 2st kill! %6d money",killername,amount)
cs_set_user_money(killer, cs_get_user_money(killer)+amount)

if(randomvalue>=BIG_MONEY_INDEX) rewardedbig=3
set_hudmessage(225,133,115,-1.0, 0.21, 0, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0,"%s got the 3nd kill! %6d money",killername,amount)
cs_set_user_money(killer, cs_get_user_money(killer)+amount)

if(randomvalue>=BIG_MONEY_INDEX) rewardedbig=4
set_hudmessage(225,133,115,-1.0, 0.21, 0, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0,"%s got the 4rd kill! %6d money",killername,amount)
cs_set_user_money(killer, cs_get_user_money(killer)+amount)

if(randomvalue>=BIG_MONEY_INDEX) rewardedbig=5
set_hudmessage(225,133,115,-1.0, 0.21, 0, 0.02, 10.0, 0.01, 0.1, 2)
show_hudmessage(0,"%s got the 5th kill! %6d money",killername,amount)
cs_set_user_money(killer, cs_get_user_money(killer)+amount)

TitANious 06-05-2009 06:15

Re: money problem
 
I please you to intend your code better, it's look better

sb123 06-05-2009 07:04

Re: money problem
 
What do you mean? I do not understand

TitANious 06-05-2009 07:32

Re: money problem
 
Like indent
Like here

By using the tab, instead of spaces

[X]-RayCat 06-05-2009 07:33

Re: money problem
 
Quote:

Originally Posted by TitANious (Post 842092)
Like indent
Like here

By using the tab, instead of spaces

That must be the best explanation ever. :lol:

sb123 06-05-2009 08:20

Re: money problem
 
1 Attachment(s)
Code have been indented
Please help me amend the code. Unable to compile

xPaw 06-05-2009 08:39

Re: money problem
 
you have too much else

[X]-RayCat 06-05-2009 09:01

Re: money problem
 
Quote:

Originally Posted by sb123 (Post 842114)
Code have been indented
Please help me amend the code. Unable to compile

WOW :shock:.. Its better to rewrite it.. :)


All times are GMT -4. The time now is 13:57.

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