AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Stepping into the world of CS mods... (https://forums.alliedmods.net/showthread.php?t=12447)

BioHazardousWaste 04-16-2005 01:39

Stepping into the world of CS mods...
 
Hey all :)

How's it going? First of all, thanx to everyone who's actually doing usefull stuff, such as making AMXMod. So here's my story.... i'm a gr 12 student, computer programming god to be, and casual CS player. So, I got bored and decided well, it's time to start modding CS. So I dug some stuff up, started a dedicated server, downloaded AMX Mod, installed, tested, works fine. Next thing I did, read the Scripting Tutorial. Language is Small, damn, never used that one before. Well it looks close to C++, can't be too hard. So I pulled up the WC3 code and cried. I hate include files with a passion, they make it soo friggin hard to learn a new language. (Functions in different files etc.)

So, this is my long term plan. Have a server running (currently on home pc for testing purposes 24.150.172.213:27015). Write a mod for it, get a good player base, form a clan, and buy an actual server. Let's start at the beginning.. got the test server, now I need to write the code.

If someone will please be my hero and give me a hand, here's what i'm looking for:
a) Any tutorial on the small language, i don't think this is too important because it looks VERY close to C++ so I should be ok
b) A list of things I can do, built in functions, whatever e.x. Change_Player_Health. There's gotta be hundreds of them.
c) Any nicely written and short source code I can study to learn how things work.
d) Any hints, tips, words of advice, things to look out for etc.

As for the type of mod I want to make, i'm not too sure, i've heard lots of ideas; but i'm looking for one that's unique. Just for the hell of it, i'm thinking of having a Martial Arts type of mod to begin with. I probably won't keep this unless people really like it, it will be an exp based mod. Sorta like WC3, but everything changed. Any suggestions, ideas, comments etc. would be appreciated. And thanks in adance.

********************************
You've been hit by a Smooth Criminal!
********************************

v3x 04-16-2005 02:19

B) http://amxmodx.org/funcwiki.php ;)

XxAvalanchexX 04-16-2005 03:06

a) http://www.compuphase.com/small.htm (there is a PDF manual)
b) See the post above you
c) Just look at the source for existing plugins in the Plugins forum
d) Don't die

n0obie4life 04-16-2005 03:08

e) don't give up

BioHazardousWaste 04-16-2005 11:06

Ok, thanks guys... getting to work now. Wish me luck.

xeroblood 04-16-2005 12:00

:arrow: Plugin Return Types: http://forums.alliedmods.net/showthread.php?t=10493 :!:

BioHazardousWaste 04-16-2005 12:58

The first of many nub questions...

OK, So I decided i'd write a simple script that would tell me (in console) who is playing on my server... This is what I wrote:

Code:

//Include Files
#include <amxmodx>

//Initializing Function (main)
public plugin_init()
{
        register_plugin("FindPlayer", "1.00", "Steve0")
    register_concmd("17_Players", "show_players", ADMIN_CHAT, "{NO ARGS}")
}

public show_players()
{       
        new Players[32]
        new playerCount, i, player
        new strPlayer[32]

        get_players(Players, playerCount)
        for (i=0; i<playerCount; i++)
        {
                  player = Players[i]
                  num_to_str(player, strPlayer[31], 31)
                  client_print (0, print_console, "The following 1337 players are playing now:")
                  client_print (0, print_console, strPlayer)
        }
        PLUGIN_HANDLED       
}

And the results are really weird. In console it says:


] 17_Players
The following 1337 players are playing now:

The following 1337 players are playing now:

The following 1337 players are playing now:

The following 1337 players are playing now:

Unknown command: 17_Players

So, can someone give me a hand? I know there is a function for this already, but I want to write my own to learn the language... thought this would be nice and easy to start with, but apparently not. I want the output to look like this:

The following 1337 players are playing now:
id name steam_id
id name steam_id
id name steam_id
id name steam_id
id name steam_id

(The following 1337 players are playing now: inside the loop was put in for debug purposes, i know it shouldn't be there)

Also, I was wondering how anyone could call this command, i tried removing ADMIN_CHAT but i got errors. Thanx

XxAvalanchexX 04-16-2005 13:00

Code:
//Include Files #include <amxmodx> //Initializing Function (main) public plugin_init() {    register_plugin("FindPlayer", "1.00", "Steve0")     register_concmd("17_Players", "show_players") // now everyone can use it! } public show_players() {        new Players[32]    new playerCount, i, player    new strPlayer[32], strAuthid[32]    client_print (0, print_console, "The following 1337 players are playing now:")    get_players(Players, playerCount)    for (i=0; i<playerCount; i++)    {          player = Players[i]          get_user_name(player,strPlayer,31)          get_user_authid(player,strAuthid,31)          client_print (id, print_console, "#%i - %s - %s",player,strPlayer,strAuthid)    }    PLUGIN_HANDLED     }

BioHazardousWaste 04-16-2005 13:16

Thaks for the help... and I hate to sound like an asshole, but have you even tried that code? I copy and pasted it directly and got four errors :( It's really hard trying to learn something when example code doesn't work!

But a few questions about what you have.
Code:

get_user_name(player,strPlayer,31)
get_user_authid(player,strAuthid,31)

I'm going to assume these are built in functions. I tried to find them, but didnt' really know what I was looking for :(. Isn't there like an excel spreadheet or soemthing of functions? If not i'll make one eventually :) (DAMN, I hate being nub)

Code:

client_print (0, print_console, "The following 1337 players are playing now:")

client_print (id, print_console, "#%i - %s - %s",player,strPlayer,strAuthid)

Shouldn't they both be id, so it only shows the person who asked? I read this in wc3 code, but I can't get it to work, I always get a compile error. undefined expression id.

Also, what are the % things? I found this:
%s - String
%f - Floating point number
%d - Integer

but what is %i? Thanx again

BioHazardousWaste 04-16-2005 14:22

Ok, so nub error on both of our parts. The variable id hadn't been declared :roll: Although, that slightly confuses me, because it should be declared wherever it is assigned a value.


All times are GMT -4. The time now is 09:51.

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