AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Multi Argument cmds (https://forums.alliedmods.net/showthread.php?t=22432)

DarlD 12-26-2005 17:21

Multi Argument cmds
 
im trying to create a cmd that will allow the player to define multiple options.
ex.: amx_slap <target> <damage> <times>

I dont really have any idea on how to approche this.

i though maybe a read_argv would do it.[/small]

v3x 12-26-2005 17:27

Code:
new arg1[33], arg2[33], arg3[33]; read_argv(1, arg1, 32); read_argv(2, arg2, 32); read_argv(3, arg3, 32); new target = cmd_target(id, arg1, 0); new damage = str_to_num(arg2); new times = str_to_num(arg3);

teame06 12-26-2005 17:28

Blah... v3x beat me.

Wolle 12-26-2005 18:07

I though these";" aren't necessary when scripting in PAWN?

teame06 12-26-2005 18:22

No, it not needed.

Brad 12-26-2005 19:05

Not needed but I would argue that it's a good habit to get into. Especially so if you plan on expanding on your programming skills.

Wolle 12-27-2005 06:06

Quote:

Originally Posted by Brad
Not needed but I would argue that it's a good habit to get into. Especially so if you plan on expanding on your programming skills.

Good point, as long this behaviour doesn't cause the code to behave funny at some point.

Twilight Suzuka 12-27-2005 11:47

They are needed, if you don't want to end up with fifty billion errors if you make a stupid mistake.

Wolle 12-27-2005 11:51

Quote:

Originally Posted by Twilight Suzuka
They are needed, if you don't want to end up with fifty billion errors if you make a stupid mistake.

Do you have an example?
Just so I know what to look for.


All times are GMT -4. The time now is 15:55.

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