AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Command to execute commands on client (https://forums.alliedmods.net/showthread.php?t=17347)

[KTA] KeItO 08-30-2005 01:42

Command to execute commands on client
 
Okay, i just need the code to execute a command on a client.

XxAvalanchexX 08-30-2005 02:16

Code:
client_cmd(index,"command");

jeppelykke 08-30-2005 06:18

Sorry to butt in, but just a question regarding the same command :)

How would i set it up to preform the same command on all clients i done this:

Code:
client_cmd(0,"enable_menu")

But gives error L 08/30/2005 - 11:15:38: [AMXX] Invalid player id 0

I need it to preform that command on all clients connect to server.

Xanimos 08-30-2005 09:08

Code:
for(new i = 1; i <= get_maxplayers() ; i++) { //Here you usually put an if() | ( is_user_alive(i) ) or ( is_user_connected(i) )     client_cmd(i,"command"); }

jeppelykke 08-30-2005 09:14

Cool thanx, i try have a look at it.

Thank you once again...

XxAvalanchexX 08-30-2005 13:57

Ugh, I'm tired of people doing silly things like that.... it's just like going from get_maxplayers() to the max entity count to perform actions on an entity.

Code:
new players[32], num, i; get_players(players, num); for(i=0;i<num;i++) {    client_cmd(players[i],"command"); }

Johnny got his gun 08-30-2005 14:25

Quote:

Originally Posted by Suicid3
Code:
for(new i = 1; i <= get_maxplayers() ; i++) { //Here you usually put an if() | ( is_user_alive(i) ) or ( is_user_connected(i) )     client_cmd(i,"command"); }

Avoid function calls in loops. get_maxplayers() would be called up to 32 times here.

Code:
new const MAXPLAYERS = get_maxplayers() for (new i = 1; i <= MAXPLAYERS; i++)     client_cmd(i, "command")
Here only called one time.

Devin 03-19-2006 17:14

can someone just tell me the cmd to do in consle?

BAILOPAN 03-19-2006 17:16

locked, you just bumped a very old post. one more thing like this and you're banned.


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

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