AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help in scripting (basic stuff) (https://forums.alliedmods.net/showthread.php?t=82158)

limeassist 12-18-2008 06:40

Need help in scripting (basic stuff)
 
First of all, hello there to everyone. This my first post here on AM.


I've decided to make a custom plugin for my servers, so that my admins could make people record demos and take screenshots.

I am a total newbie to scripting for amx, but have knowledge in C+ & Java.


Plugin itself is working just some coding problems, I need your help in :

1. Instead of sending this message to public chat, I want to be printed for admins only

(ADMINS).........

Code:

        client_print(0, print_chat, "** Screenshot taken on player ^"%s^" by admin ^"%s^" (%s) **", name, adminname, timestamp)
2. And second procedure I am asking you to help with is how to register a chat command:

Code:

  register_clcmd("say .record", "recordplayer", ADMIN_ADMIN, "<player>")
to do
Quote:

say .record #2345
and the user with this authid will start to record a P:shock:V demo.

anakin_cstrike 12-18-2008 11:47

Re: Need help in scripting (basic stuff)
 
1. Printing a message just to admins:
PHP Code:

public func()
{
    for(new 
1<= g_playersi++)
    {
        if( !
is_user_connected) )
            continue;
        
// method 1 - not very efficient
        /*if( !is_user_admin( i ) )
            continue;*/
            
        // method 2 - i prefer this one
        
if( ! ( get_user_flags) & ADMIN_KICK ) )
            continue;
            
        
client_printiprint_chat"Message" );
    }


- create a global variable 'g_players'
- add this in plugin_init()
PHP Code:

g_players get_maxplayers(); 

2. cmd_target, and if you have more than 1 arg. you must split the text, using parse() for instance.


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

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