Raised This Month: $89 Target: $400
 22% 

Money Refill - CS Bank


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff       
Duo
Junior Member
Join Date: Sep 2004
Old 09-18-2004 , 00:40   Money Refill - CS Bank
Reply With Quote #1

This is probably the billionth time this has been written, but i gave a spit shine, and wrote it up again with a few tweaks. Even though this is probably one small part of some huge package full of admin commands, i wrote this script for beginners like me, and commented the complicated sections. This script contains no copied code, i wrote it all myself, and only wrote what i understand, thats why there is some minimal error catching. However, this script compiles with out any errors or warnings.

A user can type /givemoney or /takemoney in the normal chat to give or take money to themselfs. However, an admin can do it though console, and make sure everyone knows it.

This script is basicaly for jacking around, and so basicaly you can kill the hosties and still be able to buy an AWP every round.

Code:
/*
Money Refill Script
Player just has to type amx_givemoney and the script should change their total to $16000
Script by Duo/[LLJK]Addict

COMMANDS:
amx_moneyrefill Toggles the script on and off
amx_givemoney (User)      <Gives the person $16000>
amx_takemoney (User)      <Strips user to $0>
/givemoney                <Console Use of Givemoney to Self Only>
/takemoney                <Console Use of Takemoney to Self Only>

Vesron 1.01
Indentation makes it alot more readable
Changed the user var to stop conflicting with other varibles 
32 array wrong, 31 array right

Verson 1.00
Now running on no one elses code, only mine
The new commands /givemoney and /takemoney work, but for the person typing them, no announce
Took everything out of console, and echoed into the user chat, and make the csay when the script is turned on or off
Compleatly bug and error free


Verson .5
Added an enable and disable option
No more errors

Verson 0.1
First verson, a few warnings but nothing that really effects the script
*/
Stuff i might add if wanted
*the ability to disable or enable the admin usage announce
*Cvars instead of if then if i can figure em out
* The ability to request an amount of money, and not just all or none
Attached Files
File Type: sma Get Plugin or Get Source (moneyrefill.sma - 1059 views - 3.5 KB)
Duo is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-18-2004 , 05:55  
Reply With Quote #2

Code:
new user[32]     public give_cash(id) {         read_argv(1,user,32)  // Reads ID out of give_cash (its the 1st argument) and assigns user to it, and sets max of 32 chars

You must work on your indentation. Your code is hard to read.
Also you are using a global variable name which collides (user), I suggest renaming it. I usually do something like g_myvar for globals.
Also you are doing "new user[32]" while you also do "read_argv(1, user, 32)", which is wrong. In a 32-sized array/string you can only fit 31 chars, so this would be right: "read_argv(1, user, 31)". You do that numerous time in script.
Johnny got his gun is offline
Duo
Junior Member
Join Date: Sep 2004
Old 09-18-2004 , 09:48  
Reply With Quote #3

Quote:
Originally Posted by Johnny got his gun
Code:
new user[32]     public give_cash(id) {         read_argv(1,user,32)  // Reads ID out of give_cash (its the 1st argument) and assigns user to it, and sets max of 32 chars

You must work on your indentation. Your code is hard to read.
Also you are using a global variable name which collides (user), I suggest renaming it. I usually do something like g_myvar for globals.
Also you are doing "new user[32]" while you also do "read_argv(1, user, 32)", which is wrong. In a 32-sized array/string you can only fit 31 chars, so this would be right: "read_argv(1, user, 31)". You do that numerous time in script.
Ill go fix some of that stuff, the indention is ultraedit, if i look at it in ultraedit it looks perfectly spaced, ill paste into notepad and fix the indentation by hand, as well as fix the variables. Thanks for the heads up and tips.
Duo is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-18-2004 , 11:29  
Reply With Quote #4

I suggest not mixing spaces and tabs while indenting. Stick to either.
Johnny got his gun is offline
Geesu
AMX Mod X Plugin Approver
Join Date: Mar 2004
Location: Cincinnati, OH
Old 12-13-2005 , 10:10  
Reply With Quote #5

Author PM me to have this plugin approved
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Reply


Thread Tools
Display Modes

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 23:30.


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