AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do I do a command on all people? (https://forums.alliedmods.net/showthread.php?t=46416)

Zamma 10-26-2006 07:03

How do I do a command on all people?
 
Ive only just started amxx coding again and am a little rusty.

In a plugin I have a concmd which when Runs I want ALL players on ONE team to have their weapons removed.


How do I get it to effect all players?

Zamma 10-26-2006 07:12

Re: How do I do a command on all people?
 
help anyone?

Zamma 10-26-2006 07:15

Re: How do I do a command on all people?
 
Like - I need to filter through all the players - find which are marines - and then remove all weapons - then pick one by random and give him a weapon.

Rolnaaba 10-26-2006 08:24

Re: How do I do a command on all people?
 
to effect all on server:
Code:
 strip_user_weapons(0) //drop all weapons to everyone  give_item(0, CSW_KNIFE) //give everyone a knife

schnitzelmaker 10-26-2006 08:59

Re: How do I do a command on all people?
 
Or more team specific
Code:
for(new i=0;i<=get_maxplayers();i++) {     if(is_user_connected(i))     {         if(pev(i,pev_team) == 1)//The number was only as example as team 1             client_print(i,print_chat,"you are in team 1")         else             client_print(i,print_chat,"you are in team %d",pev(i,pev_team))     } } client_print(0,print_chat,"This is a message for all")

Zenith77 10-26-2006 09:19

Re: How do I do a command on all people?
 
Quote:

Originally Posted by Rolnaaba (Post 395389)
to effect all on server:
Code:
 strip_user_weapons(0) //drop all weapons to everyone  give_item(0, CSW_KNIFE) //give everyone a knife

You sir have a misunderstanding. While it is true a good bit of default natives allow you to pass zero to go through the whole server, you must remember that not all of them do. I say this to prevent 50 billion people coming back here and going "z 0 m g it does not work I R DON'T UNDERSTAND!"

Zamma 10-26-2006 09:39

Re: How do I do a command on all people?
 
Thanks ALOT guys this has really helped

can someone please explain

"for(new i=0;i<=get_maxplayers();i++)"

please

Rolnaaba 10-26-2006 09:41

Re: How do I do a command on all people?
 
Quote:

Originally Posted by Zenith77 (Post 395404)
You sir have a misunderstanding. While it is true a good bit of default natives allow you to pass zero to go through the whole server, you must remember that not all of them do. I say this to prevent 50 billion people coming back here and going "z 0 m g it does not work I R DON'T UNDERSTAND!"

my mistake I thought that strip_user_weapons and give_item were one of those that do allow it if I am wrong I apologize :oops:

Zamma 10-26-2006 10:32

Re: How do I do a command on all people?
 
Now i need to set it so it randomly picks a player from team 1.

how cud i accomplish this?

Zamma 10-26-2006 10:40

Re: How do I do a command on all people?
 
I get an error saying my function should return a value :x

help anyone :x


All times are GMT -4. The time now is 04:48.

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