AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Double Say Command (https://forums.alliedmods.net/showthread.php?t=228799)

wTf. 10-27-2013 07:12

[SOLVED] Double Say Command
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /light","OpenTheLight")
}
public 
OpenTheLight(id) {
    if(
get_user_team(id) == 2) {
        
set_pev(id,pev_effects,EF_BRIGHTLIGHT)
        
client_print(idprint_chat,"[Light]: Light ON")
    } else if(
get_user_team(id) == 2) {
        
set_pev(idpev_effectspev(idpev_effects) &~ EF_BRIGHTLIGHT)
        
client_print(idprint_chat,"[Light]: Light OFF")
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/ 

i want to double command ON/OFF

ex:

CT player in the game write say /light open the light again write say /light shut the light.

sorry for my very bad english :|

ConnorMcLeod 10-27-2013 07:29

Re: Double Say Command
 
PHP Code:

public OpenTheLight(id)

    if(
get_user_team(id) == 2)
    { 
        
set_pev(idpev_effectspev(idpev_effects) ^ EF_BRIGHTLIGHT
        
client_print(idprint_chat,"[Light]: Light Toggled"
    }



razermamba 10-27-2013 07:29

Re: Double Say Command
 
connors great :)

Balck 10-27-2013 07:39

Re: Double Say Command
 
Quote:

Originally Posted by wTf. (Post 2053416)
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>

new bool:makeonoff[33] = false;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /light","OpenTheLight")
}
public 
OpenTheLight(id) {
    if(
get_user_team(id) == 2) {
        
set_pev(id,pev_effects,EF_BRIGHTLIGHT)
        
client_print(idprint_chat,"[Light]: Light ON")
    } else if(
get_user_team(id) == 2) {
        
set_pev(idpev_effectspev(idpev_effects) &~ EF_BRIGHTLIGHT)
        
client_print(idprint_chat,"[Light]: Light OFF")
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/ 

i want to double command ON/OFF

ex:

CT player in the game write say /light open the light again write say /light shut the light.

sorry for my very bad english :|


Use this and tell me if it work :)

PHP Code:

#include <amxmodx>
#include <fakemeta>

new bool:makeonoff[33];

public 
plugin_init(){
    
register_plugin("PLUGIN""VERSION""AUTHOR")
    
register_clcmd("say /light","OpenTheLight")
}

public 
client_putinserver(id){
    
makeonoff[id] = true
}

public 
OpenTheLight(id) {
    if(
get_user_team(id) == 2) {
        if(
makeonoff[id] == true){
            
set_pev(id,pev_effects,EF_BRIGHTLIGHT)
            
client_print(idprint_chat,"[Light]: Light ON")
            
makeonoff[id] = false
        
}
        else
        if(
makeonoff[id] == false){
            
set_pev(idpev_effectspev(idpev_effects) &~ EF_BRIGHTLIGHT)
            
client_print(idprint_chat,"[Light]: Light OFF")
            
makeonoff[id] = true
        
}
    }


but connor method is better :)

wTf. 10-27-2013 07:41

Re: Double Say Command
 
perfect!! thank you so much connor :D

EDIT:

@balck

Ok, i try

EDIT2:

Thnx balck :) ur code perfect!


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

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