AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Resolved] Random client_cmd help please! (https://forums.alliedmods.net/showthread.php?t=25350)

hlstriker 03-12-2006 10:57

[Resolved] Random client_cmd help please!
 
Hi, I need to run a random client_cmd on a client, I have no clue how to randomize it though.

Here is what needs to be randomly chosen...
client_cmd(id,"+jump")
client_cmd(id,"+duck")
client_cmd(id,"+attack")

Can anyone help me please?

VEN 03-12-2006 11:11

Code:
#define CMDS 3 new CMD[CMDS][] = {     "+jump",     "+duck",     "+attack" }
Code:
client_cmd(id, CMD[random(CMDS)])

hlstriker 03-12-2006 11:45

Ok thanks alot, it works :D

almaro 09-06-2012 03:19

Re: [Resolved] Random client_cmd help please!
 
how about random "wait" in client_cmd(wait;wait;wait;wait;snapshot) ? anyone?

jimaway 09-06-2012 05:11

Re: [Resolved] Random client_cmd help please!
 
Code:
new i, ipos, cmd[128], random random = random_num(0,5) for (i = 0; i <= random, i++) {     ipos += formatex(cmd[ipos], charsmax(cmd) - ipos, "wait;") } formatex(cmd[ipos], charsmax(cmd) - ipos, "snapshot") client_cmd(id, cmd)

almaro 09-06-2012 23:34

Re: [Resolved] Random client_cmd help please!
 
Excellent work jim !
Now I can make every user take screenshot in random time (not simultaneous) by waiting n times / waiting x times. I would like to experiment using player id to make wait x times.

typo:
for (i = 0; i <= random, i++) { // must not use , but ;
for (i = 0; i <= random; i++) { // correct


All times are GMT -4. The time now is 20:23.

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