AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   sm_allinfo code help (https://forums.alliedmods.net/showthread.php?t=83312)

{7~11} TROLL 01-07-2009 17:02

sm_allinfo code help
 
im creating a sm_allinfo plugin for sourcemod and ive got some coded but it want compile i cant figure out whats wrong and why it want taget a person when i type sm_allinfo player

here the code any help would be greatly appreciated

Code:

/* Plugin Template generated by Pawn Studio */
#include <sourcemod>
public Plugin:myinfo =
{
 name = "sm_allinfo",
 author = "{7~11} TROLL",
 description = "gets single clients steam id,name,and ip base on the amx version",
 version = "1.0",
 url = "www.711clan.net"
}
public OnPluginStart()
{
 RegAdminCmd("sm_allinfo","command_users" ADMFLAG_BAN, "sm_allinfo - .::[Name  ::STEAM ID  ::IP  ]::.");
}
public Action:Command_Users(client,args)
{
 if (args < 2)
 {
  ReplyToCommand(client, "sm_allinfo");
  return Plugin_Handled;
 }
 
 new String:target[64];
 GetCmdArg(1, target, sizeof(target));
 
 new String:name[64];
 GetCmdArg(2, name, sizeof(name));
 
 new clients[2];
 SearchForClients(target, clients, 2);
 
 if (!FindTarget(client, target))
  decl String:t_name[16], String:t_ip[16], String:t_steamid[16];
  Format(t_name, sizeof(t_name), "Nick");
  Format(t_ip, sizeof(t_ip), "IP");
  Format(t_steamid, sizeof(t_steamid), "SteamID");
  PrintToConsole(client, "#  %-25s %-20.5s %s", t_name, t_ip, t_steamid);
}


zerak 01-07-2009 17:08

Re: code help
 
What compile errors do you get?
you got an s in the "clients" in the SearchForClients call is an example
make sure you have a unique player id is a suggestion or make it handle several matches :)

{7~11} TROLL 01-07-2009 17:12

Re: sm_allinfo code help
 
its showing
Code:

/home/groups/sourcemod/upload_tmp/textips7pg.sp(16) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textips7pg.sp(16) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textips7pg.sp(16) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textips7pg.sp(16) : error 001: expected token: ";", but found ")"
/home/groups/sourcemod/upload_tmp/textips7pg.sp(16) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textips7pg.sp(16) : fatal error 127: too many error messages on one line

ive went over it and change stuff but still keep getting those

Lebson506th 01-07-2009 17:17

Re: sm_allinfo code help
 
What do you want to command to look like? sm_allinfo that gives the info of ALL players, or sm_allinfo "name" that gives the information about the named player?

{7~11} TROLL 01-07-2009 17:19

Re: sm_allinfo code help
 
i want to make it like the amx version

amx_allinfo <player name> then it shows the admin the players name,steam id, and ip

Lebson506th 01-07-2009 17:30

Re: sm_allinfo code help
 
PHP Code:

#include <sourcemod>

public Plugin:myinfo 
{
    
name "sm_allinfo",
    
author "{7~11} TROLL",
    
description "gets single clients steam id,name,and ip base on the amx version",
    
version "1.0",
    
url "www.711clan.net"
};

public 
OnPluginStart()
{
    
RegAdminCmd("sm_allinfo"Command_UsersADMFLAG_BAN"sm_allinfo - .::[Name  ::STEAM ID  ::IP  ]::.");
}

public 
Action:Command_Users(clientargs)
{
    new 
target;

    if (
args == 1)
    {
        
decl String:arg[MAX_NAME_LENGTH];
        
GetCmdArg(1argsizeof(arg));

        
target FindTarget(clientargfalsefalse);

        if (!
target)
        {
            
ReplyToCommand(client"Could not find %s"arg);
            return 
Plugin_Handled;
        }
    }
    else
    {
        
ReplyToCommand(client"Correct syntax: sm_allinfo playername");
        return 
Plugin_Handled;
    }

    
decl String:t_name[MAX_NAME_LENGTH], String:t_ip[16], String:t_steamid[16];

    
GetClientName(targett_namesizeof(t_name));
    
GetClientIP(targett_ipsizeof(t_ip));
    
GetClientAuthString(targett_steamidsizeof(t_steamid));

    
PrintToConsole(client"#  %s %s %s"t_namet_ipt_steamid);

    return 
Plugin_Handled;


Try that out. It was easier to show you than to do it line by line.

If you have any questions about the code and things I changed, feel free to ask me =)

zerak 01-07-2009 17:32

Re: sm_allinfo code help
 
think you should have a semicolon after you plugin info

Lebson506th 01-07-2009 17:33

Re: sm_allinfo code help
 
Not necessary. It compiles without it.


...i'll add it in there anyway.

{7~11} TROLL 01-07-2009 17:36

Re: sm_allinfo code help
 
for the print to console if i want it to print like..

.:[Name: |Steam ID: |IP: ]:.

would i make it..
Code:

PrintToConsole(client, ".:[Name:#  %s|Steam ID: %s|IP: %s]:.", t_name, t_ip, t_steamid);

Lebson506th 01-07-2009 17:38

Re: sm_allinfo code help
 
PHP Code:

PrintToConsole(client".:[Name: %s | Steam ID: %s | IP: %s]:."t_namet_steamidt_ip); 

The # was not needed and the steamid and ip were reversed.



All times are GMT -4. The time now is 21:43.

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