AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to do say ? (https://forums.alliedmods.net/showthread.php?t=82561)

DaniDin 12-25-2008 17:36

how to do say ?
 
hi
i want to do command like this :
sayhi

and if admin do this so it's say to all "Hi , Have Fun In my Server"
how i do it ?

Starsailor 12-25-2008 18:36

Re: how to do say ?
 
1 Attachment(s)
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Hi"
#define VERSION "1.0"
#define AUTHOR "Starsailor"
#define ACCESS_LEVEL ADMIN_KICK


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say hi","showhi")
    
}

public 
showhi() {
    new 
maxplayers get_maxplayers()
    new 
j
    
for(<= maxplayers j++){
        if(
get_user_flags(j) & ACCESS_LEVEL){
           
client_cmd(j,"say Hi , Have Fun In my Server")

            
        }
    }



DaniDin 12-25-2008 19:20

Re: how to do say ?
 
10x dud
do you kbow how i do connect to sql in localhost and chaked in user table in userid if the id = 1 so the user will get kick ?

danielkza 12-25-2008 19:22

Re: how to do say ?
 
Quote:

Originally Posted by DaniDin (Post 733173)
10x dud
do you kbow how i do connect to sql in localhost and chaked in user table in userid if the id = 1 so the user will get kick ?

http://www.amxmodx.org/funcwiki.php?go=module&id=23

hleV 12-25-2008 19:28

Re: how to do say ?
 
Quote:

Originally Posted by Starsailor (Post 733150)
PHP Code:

#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN "Hi"
#define VERSION "1.0"
#define AUTHOR "Starsailor"
#define ACCESS_LEVEL ADMIN_KICK
 
 
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say hi","showhi")
 
}
 
public 
showhi() {
    new 
maxplayers get_maxplayers()
    new 
j
    
for(<= maxplayers j++){
        if(
get_user_flags(j) & ACCESS_LEVEL){
           
client_cmd(j,"say Hi , Have Fun In my Server")
 
 
        }
    }



WTF?
Code:
#include <amxmodx>   #define ADMIN ADMIN_IMMUNITY   public plugin_init()         register_clcmd("say hi", "cmdSayHi");   public cmdSayHi(id) {         if (is_user_connected(id) && (get_user_flags(id) & ADMIN))                 client_cmd(id, "say Hi , Have Fun In my Server");           return PLUGIN_HANDLED; }

danielkza 12-25-2008 19:37

Re: how to do say ?
 
Quote:

Originally Posted by hleV (Post 733176)
WTF?
Code:
#include <amxmodx> #define ADMIN ADMIN_IMMUNITY public plugin_init() register_clcmd("say hi", "cmdSayHi"); public cmdSayHi(id) { if (is_user_connected(id) && (get_user_flags(id) & ADMIN)) client_cmd(id, "say Hi , Have Fun In my Server"); return PLUGIN_HANDLED; }

WTF?

PHP Code:

#include <amxmodx>

#define ADMIN_SAYHI ADMIN_ADMIN

public plugin_init()
{
    
register_clcmd("say hi""SayHi")
}

public 
SayHi(id)
{
    if(
access(idADMIN_SAYHI))
    {
        static 
szName[32]
        
get_user_name(idszNamecharsmax(szName))

        
client_print(0print_chat"Have fun on my server! - %s"szName)
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE



DaniDin 12-25-2008 19:41

Re: how to do say ?
 
how i do that i can use the sayhi 1 times in the map ?

danielkza 12-25-2008 19:47

Re: how to do say ?
 
Quote:

Originally Posted by DaniDin (Post 733185)
how i do that i can use the sayhi 1 times in the map ?

I see you're just trying to experiment in scripting, and if you don't know how to do something, go RTFM and try yourself, we won't keep writing scripts for you, specially for useless purposes like this.

DaniDin 12-25-2008 19:49

Re: how to do say ?
 
i try to search in the wiki but i dont found nothing

Spunky 12-25-2008 20:02

Re: how to do say ?
 
Quote:

Originally Posted by Starsailor (Post 733150)
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Hi"
#define VERSION "1.0"
#define AUTHOR "Starsailor"
#define ACCESS_LEVEL ADMIN_KICK


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say hi","showhi")
    
}

public 
showhi() {
    new 
maxplayers get_maxplayers()
    new 
j
    
for(<= maxplayers j++){
        if(
get_user_flags(j) & ACCESS_LEVEL){
           
client_cmd(j,"say Hi , Have Fun In my Server")

            
        }
    }



That's a terrible way to do it. You could do something like this instead:

PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin("Player Greeting""1.0""Spunky")

    
register_clcmd("say hi""cmd_sayhi"ADMIN_KICK"Greets players.")
}

cmd_sayhi(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    client_print
(0print_chat"Hello, welcome to my server!")

    return 
PLUGIN_HANDLED


There's absolutely no need to loop through all of the players. You should note that nobody except you will be able to say hi like that though. They'd have to say hello or hey or something else.


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

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