AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Someone teach me SMALL (https://forums.alliedmods.net/showthread.php?t=1757)

kingpin 05-09-2004 16:31

well here's my question, do u have a grand idea ur trying to translate into a plugin? if not and u are supposedly the guy who rides the short bus to school then why waste your time? either apply urslef or dont... its upto u

Girthesniper 05-09-2004 16:39

at least I can spell things right. I am trying damnit, its not easy. It might be for you, but its not for me.

kingpin 05-09-2004 16:45

yeah your right about the spelling u spell pretty good when ur whining for attention, heres something for u to read either way : http://www.compuphase.com/small.htm

Ingram 05-09-2004 16:50

ok a simple plugin AMX_FF by JustinHoMi might be a good exmaple (If u don't want me to use your plugin as an example, say so and i'll remove it)

First thing u want to know what the plugin does, so run it, next look at the init
Code:

public plugin_init(){
        register_plugin("Admin FF","0.21","JustinHoMi")
        register_concmd("amx_ff","admin_ff",ADMIN_CVAR,"< 0/1 >")
        register_clcmd("say /ff","check_ff")
        return PLUGIN_CONTINUE
}

register_plugin("Admin FF","0.21","JustinHoMi") is the author's info to put in, register_concmd is a command that the server or a client can run (this is important), register_clcmd is a command that only clients can run (also important). return PLUGIN_CONTINUE means u dont want the plugin to end. PLUGIN_HANDLED means u want it to stop.(You don't need to put a return in the init, so my recommendation is dont)

I'll start easier, the client command(commands are what u would type in console, but pressing a key u also run the command in your console) say /ff, runs check_ff
Code:

public check_ff(id) {
        new ff = get_cvar_num("mp_friendlyfire")
        if(ff == 1)
                client_print(id,print_chat,"[AMXX] Friendly fire is on")
        else if(ff == 0)
                client_print(id,print_chat,"[AMXX] Friendly fire is off")
        return PLUGIN_HANDLED
}

first thing this does is it gets the value of mp_friendlyfire and puts it in the value ff, if ff is 1, friendly fire is on and it tells the client that, if not it tells the client its not on

now the harder one, amx_ff, when u type it in console it runs admin_ff
Code:

public admin_ff(id,level,cid){
        if (!cmd_access(id,level,cid,2))  // I changed this part
                      return PLUGIN_HANDLED

        new ff_s[2]
        read_argv(1,ff_s,2)
        new ff = str_to_num(ff_s)

        if(ff == 1) {
                server_cmd("mp_friendlyfire 1")
                console_print(id,"[AMXX] Friendly fire is now on")
        }
        else if(ff == 0) {
                server_cmd("mp_friendlyfire 0")
                console_print(id,"[AMXX] Friendly fire is now off")
        }

        return PLUGIN_HANDLED
}

if (!cmd_access(id,level,cid,2)) is used to check if they have access and the correct # of arguments has been entered, if not it kicks them outta the plugin (if they have access, but an incorrect # of arguments. it'll give them the help for the command, but that isn't in this plugin (anymore)) new ff_s[2] is creating a array for input, each character that the admin enter, if they entered 12, takes a place in the array, so that would take 2 spaces. read_argv(1,ff_s,2) is reading in the 1st (notice the 1) argument after the command that the admin has entered, ff_s is where it is being read into, and 2 is the maximum length it can be. new ff = str_to_num(ff_s) changes the array u just read in into a #. The rest u should need help with by now.


Now that i have told u the basics of a plugin, u should be able to understand many of them, any natives (commands sorta) in the plugins u don't understand, look in the includes first, then ask questions on them. Sorry if this didn't help, but i can only try.
Edit: Wow i really coulda wrote a new plugin in that time!

Peli 05-09-2004 16:56

Sorry but I'm going to have to throw some links at you , this isn't hard to learn but it isn't something where you sit for three seconds and learn. :

Bail's Scripting Tutorial ( Beta )
Scarzzurs Scripting Tutorial
Small Scripting Tutorial
Google Scripting Tutorial

smartsl 05-12-2004 23:15

http://www.compuphase.com/small.htm
here i find 404 error.

could some one plz tell me where can i get these files:
"The Small toolkit for Microsoft Windows" smallkit.exe
"The Small booklet 1. The Language" smalldoc.pdf
"The Small booklet 2. Implementor's Guide" smallguide.pdf

i can only found some of the files by google, but very old version. i need the latest ver. is there any one can help me?

kingpin 05-13-2004 07:33

the link works fine.

smartsl 05-13-2004 11:25

Quote:

Originally Posted by kingpin
the link works fine.

:lol: Just as u say, it's ok now. :lol:


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

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