AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Not clear on [index] (https://forums.alliedmods.net/showthread.php?t=17829)

pdoubleopdawg 09-09-2005 23:31

Not clear on [index]
 
I havn't used this much before but:
I want to make a boolean for checking one of my plugins.

I want to turn it off for only the selected player. Would it be

Boolean[target]=false
?
Would that turn it off for that specific player only?

XxAvalanchexX 09-09-2005 23:45

Code:
new bool:variable[33] = { true, ... }; // zomg turn it off! variable[id] = false;

pdoubleopdawg 09-10-2005 01:15

as_undisco_all only turns off the glow for the person performing the command. Why?
amx_undisco doesn't do jack.

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "Admin System" #define VERSION "0.1" #define AUTHOR "DahVid" new players[32],num,i //use these one too many time! :) new bool:is_disco[33] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("as_disco","disco",ADMIN_BAN,"as_disco <user>")     register_clcmd("as_undisco","undisco",ADMIN_BAN,"as_undisco <user>")     register_clcmd("as_disco_all","disco_allstart",ADMIN_BAN,"as_discoall (disco's all users!")     register_clcmd("as_undisco_all","undisco_all",ADMIN_BAN,"as_undiscoall (Undiscos everyone!") } public disco(id) {     if(!is_user_admin(id)) {         console_print(id,"[ASMod]Sorry, this command is for administrators ONLY!")         return PLUGIN_HANDLED     }     new player[33]     read_argv(1,player,32)     new target=cmd_target(id,player,9)     if(!is_user_connected(target)) {         console_print(id,"[ASMod]The player you have entered has not been found in the server or he has immunity.")     }     is_disco[target]=true     //Thanks to GHW_Chronic for the idea!     set_task(0.3,"disco_start",target,_,_,"b")         return PLUGIN_CONTINUE } public disco_start(target) {     if(is_disco[target]==false) {         return PLUGIN_HANDLED     }     if(!is_user_connected(target)) {         return PLUGIN_HANDLED     }     new red,green,blue,alpha     red=random_num(0,255)     green=random_num(0,255)     blue=random_num(0,255)     alpha=random_num(30,220)         message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},target)     write_short(~0)     write_short(~0)     write_short(1<<12)     write_byte(red)     write_byte(green)     write_byte(blue)     write_byte(alpha)     message_end()         set_user_rendering(target,kRenderFxGlowShell,red,green,blue,kRenderTransAlpha,alpha)         return PLUGIN_CONTINUE } public disco_allstart() {     get_players(players,num)     for(i=0;i<=num;i++) {         new player = players[i]         is_disco[player]=true         set_task(0.3,"disco_all",player,_,_,"b")     } } public disco_all() {     get_players(players,num)     for(i=0;i<=num;i++) {         new player = players[i]         if(is_disco[player]==false) {             return PLUGIN_HANDLED         }         if(!is_user_connected(player)) {             return PLUGIN_HANDLED         }         new red,green,blue,alpha         red=random_num(0,255)         green=random_num(0,255)         blue=random_num(0,255)         alpha=random_num(30,220)                 message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},player)         write_short(~0)         write_short(~0)         write_short(1<<12)         write_byte(red)         write_byte(green)         write_byte(blue)         write_byte(alpha)         message_end()                 set_user_rendering(player,kRenderFxGlowShell,red,green,blue,kRenderTransAlpha,alpha)     }     return PLUGIN_HANDLED } public undisco(target) {     is_disco[target]=false     set_user_rendering(target,kRenderFxGlowShell,0,0,0,kRenderNormal,25) } public undisco_all(player) {     is_disco[player]=false     set_user_rendering(player,kRenderFxGlowShell,0,0,0,kRenderNormal,25) }

XxAvalanchexX 09-10-2005 01:28

Well, there is no amx_undisco, so that's probably why it doesn't do anything.

As for as_undisco_all, let's look at the function that is called:
Code:
public undisco_all(player) {     is_disco[player]=false     set_user_rendering(player,kRenderFxGlowShell,0,0,0,kRenderNormal,25) }
Right there you're just setting is_disco for only the player who called it, which is why it is only turning it off for one person.

pdoubleopdawg 09-10-2005 01:30

Ohhh. I think I get it. I'll give it a go.

pdoubleopdawg 09-10-2005 01:37

That was a typo. I tried as_undisco. It does only does it for me. I fixed the as_undisco_all.

So, how to catch the first argument of function disco?

Zenith77 09-10-2005 11:24

Quote:

Code:
new player[33]     read_argv(1,player,32)     new target=cmd_target(id,player,9)


its already done :/

pdoubleopdawg 09-10-2005 15:41

I mean... How to get who was targetted into the undisco function!!

XxAvalanchexX 09-10-2005 15:44

Just like that...


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

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