AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   warning 217: loose indentation & say commands (https://forums.alliedmods.net/showthread.php?t=5826)

Duo 09-13-2004 22:00

warning 217: loose indentation & say commands
 
Just finished writing another a moneyscript (Im very original) and got it compiling with out errors. However, i have like 7 of these warnings.

warning 217: loose indentation

I moved things togeather and apart yet no avil.

if(read_argc() == 0) { // Reads arguments

or

cs_set_user_money (id , 16000,1 )

There is an example of 2 i have, if you can point me in the right direction im sure i can find out the rest.

Also, while my script picks thing up out of the console, i like to be lazy, and so do other people who play where i do, so i want my script to pick up out of console.

register_concmd("say /givemoney","give_cash",-1,"Gives $16000 to the person")

I was hoping it would pick up on it in the console, so i could type

/givemoney Addict

for example, when i type /givemoney with out a name my debug kicks in and says that it wants a user, but if i add a name it just sort if ignores it and uses it as say. however, if i use it through the console it works like a charm. Thanks, i want to make sure my scripts dont suck before posting them for public consumption.

FeuerSturm 09-14-2004 03:21

loose identation just weans that the code isn't tabbed correctly,
show your plugin and i'll help you with that and your other problem.

Duo 09-14-2004 10:58

Quote:

Originally Posted by FireStorm
loose identation just weans that the code isn't tabbed correctly,
show your plugin and i'll help you with that and your other problem.

Sweet, ill post it up as soon as i get home.

Duo 09-14-2004 16:04

The Code
 
Here is the code

Code:

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

Verson 0.1
First verson, a few warnings but nothing that really effects the script
*/

#include <amxmodx>
#include <cstrike>


new user[32]
new personid
new bool:MoneyEnabled = true




public plugin_init() { // This will start the plugin
       
        register_plugin("Givemoney", ".01", "Duo/Addict")  // Tells server the command exists
        register_concmd("amx_givemoney","give_cash",-1,"Gives $16000 to the person") // Registers the command with AMX
        register_concmd("amx_takemoney","take_cash",ADMIN_KICK,"Gives this person $800")
        register_concmd("amx_moneyrefill","money_toggle",ADMIN_KICK,"Turns money on and off")
register_concmd("say /givemoney","give_cash",-1,"Gives $16000 to the person") // Registers the command with and
register_concmd("say /takemoney","take_cash",-1,"Gives this person $800")    // Makes it work with say
  register_concmd("amx_moneyrefill", "money_toggle",ADMIN_KICK,"Enables Script")
 
}

public money_toggle(id) {
        if (MoneyEnabled == true) {
                MoneyEnabled = false
                console_print(id,"Money Refill has been turned off")
                client_cmd(id,"echo The Bank is Closed, no more money free money :( ")
                return PLUGIN_HANDLED
        }
        if (MoneyEnabled == false) {
                MoneyEnabled = true
                console_print(id,"The bank is open, money for all")
                return PLUGIN_HANDLED
                client_cmd(id,"echo The Bank is Open for Biz, type amx_givemoney (name) in console to get $16000")
        }
}
       
       
public give_cash(id) { //Decalre public function
       
 if (MoneyEnabled == false) {
        console_print(id, "The Money Refill isnt turned on, type amx_moneyrefill to toggle on and off")
        return PLUGIN_HANDLED
 }
 
       
        if(read_argc() == 0) { // Reads arguments
                console_print(id,"You must give me a user to give money to")
                return PLUGIN_HANDLED
               
        }
       

        read_argv(1,user,32) // First argument, insert to variable, max length
        personid = find_player("bh",user)
       
       
if (personid == 0) {
        console_print(id,"Person dosnt exist ")
  return PLUGIN_HANDLED
  }


               
        cs_set_user_money (id , 16000,1 )
        console_print(id,"You now have more money, you owe me dude")
        client_cmd(personid, "say I just got $16000 so i could by another AWP!")
        return PLUGIN_HANDLED
       
}

// This part takes the cash down to $0
public take_cash(id) {
       
        if (MoneyEnabled == false) {
                console_print(id, "The Money Refill isnt turned on, type amx_moneyrefill to toggle on and off")
        return PLUGIN_HANDLED
 }
 
       
        if(read_argc() == 0) {
                console_print(id,"You must give me a user to give money to")
                return PLUGIN_HANDLED
               
        }
       

        read_argv(1,user,32)
        personid = find_player("bh",user)
       
       
if (personid == 0) {
        console_print(id,"Person dosnt exist ")
  return PLUGIN_HANDLED
  }


               
        cs_set_user_money (id , 0,1 )
        console_print(id,"Some one haxored your bank account and took your money")
        client_cmd(personid, "say I just donated all my money to Jesus!")
        return PLUGIN_HANDLED
       
}


mahnsawce 09-14-2004 16:14

The simplest fix for "loose indentation" warnings is to add this line right before your first #include:

Code:

#pragma tabsize 0
Technically this doesn't fix the problem, it just tells the compiler to shut up about that specific warning. But, the warning is absolutely retarded to begin with, so it's not like it matters =/

Da Bishop 09-14-2004 16:16

aww mahnsawce thats mean.. poor compiler... its not its fault people use spaces instead of tabs :cry:

Twilight Suzuka 09-14-2004 17:07

Quote:

Originally Posted by Da Bishop
aww mahnsawce thats mean.. poor compiler... its not its fault people use spaces instead of tabs :cry:

Yes. It is.

Duo 09-14-2004 17:29

Quote:

Originally Posted by mahnsawce
The simplest fix for "loose indentation" warnings is to add this line right before your first #include:

Code:

#pragma tabsize 0
Technically this doesn't fix the problem, it just tells the compiler to shut up about that specific warning. But, the warning is absolutely retarded to begin with, so it's not like it matters =/

That shut it up, awesome!

Still, any tips to why the say /commands wont work?


All times are GMT -4. The time now is 17:14.

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