AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HEY im new (https://forums.alliedmods.net/showthread.php?t=40153)

-[N3wb]- Sonic 06-24-2006 09:55

HEY im new
 
Hey! Im new at making scripts. Im trying to make(probebly allready exist) a amxx give speed plugin, but i cant get it to work, Ive been reading tuts all over and I still dont get it! :P can some1 help me in some way?

Nick 06-24-2006 12:46

Re: HEY im new
 
Use the functionwiki on the amxmodx home page, it really helped me out when I was beginning.

Code:
Float: set_user_maxspeed ( index, [ Float:speed = - 1.0 ] )

-[N3wb]- Sonic 06-24-2006 18:48

Re: HEY im new
 
ok Ill look at it, thx

-[N3wb]- Sonic 06-25-2006 10:10

Re: HEY im new
 
This is what i came up with :

/* Plugin Speedy, Sonic's first script */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "Speedy"
#define VERSION "1.0"
#define AUTHOR "Sonic"

public plugin_init() {
register_plugin("Speedy", "1.0", "Sonic")
register_concmd("amx_speedy","do_speed",ADMIN _BAN," user Speeds the specified user")
}

public do_speed(id) {
if (!(get_user_flags(id)&ADMIN_BAN)) {
console_print(id,"[AMXX] No access, buzz off!")
return PLUGIN_HANDLED
}
if (read_argc() == 0) {
console_print(id,"[AMXX] You must specify a user")
return PLUGIN_HANDLED
}
new user[32], uid
read_argv(1,user,32)
uid = find_player("bh",user)
if (uid == 0) {
console_print(id,"[AMXX] Invalid User Id")
return PLUGIN_HANDLED
}
client_cmd(uid,"echo player has got speedy!")
client_cmd(uid,"set_user_maxspeed(index, Float:speed = -1.0)")
console_print(id,"speeded player!")
return PLUGIN_HANDLED
}

i get 4 warnings; loose indentation on line 22, 26, 33 and 36. I use amxx-studio 1.4 to script it!!

what did i do wrong?

v3x 06-25-2006 10:50

Re: HEY im new
 
Loose indentation warnings simply means that you did not indent your code properly.

Here's an example of properly indented code using my techniques:
Code:
public MyFunction(id) {   // first level of indentation - two spaces or a single tab   new var = random_num(0, 3);   new v4r = random_num(0, 3);   if(var == 1)   {     // second level of indentation since we're going inside an {     client_print(id, print_chat, "The random number was 1");     if(v4r == 1)     {       // third level of indentation - second level       client_print(id, print_chat, "zomg you got a 1 again.. lucky ass");     }   } // now we start unindenting - first level } // until we get down to the final closing curly bracket
Hopefully that made sense. I'm tired.

-[N3wb]- Sonic 06-25-2006 12:03

Re: HEY im new
 
okey, thanks, Ive did it and Ive got no more warnings:D just have to see if it works:P

-[N3wb]- Sonic 06-25-2006 12:19

Re: HEY im new
 
1 Attachment(s)
oki, now theres 1 prob. or should I say two: I get unknown command:
get_user_maxspeed and set_user_maxspeed ??!?

Attachment 8468

what is the thing i didnt do now? uhm, Help

by the way, how do i set it code on this site?

Throstur 06-25-2006 12:56

Re: HEY im new
 
this looks a bit wrong:
PHP Code:

    client_cmd(uid,"get_user_maxspeed(index"); 

the quotes are... weirdly placed

-[N3wb]- Sonic 06-25-2006 13:31

Re: HEY im new
 
ok but that donesnt help me much im a big noob at this:stupid:

Throstur 06-25-2006 14:15

Re: HEY im new
 
I'd delete the quotes alltogether and put in another bracket before the semicolon, and I'm thinkin that instead of index you might have to put id, and I'm not sure what uid is doing.


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

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