Raised This Month: $51 Target: $400
 12% 

sm_allinfo code help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 01-07-2009 , 17:02   sm_allinfo code help
Reply With Quote #1

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);
}
__________________

Last edited by {7~11} TROLL; 01-07-2009 at 17:11.
{7~11} TROLL is offline
zerak
Senior Member
Join Date: Feb 2008
Old 01-07-2009 , 17:08   Re: code help
Reply With Quote #2

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
zerak is offline
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 01-07-2009 , 17:12   Re: sm_allinfo code help
Reply With Quote #3

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
__________________

Last edited by {7~11} TROLL; 01-07-2009 at 17:17.
{7~11} TROLL is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 01-07-2009 , 17:17   Re: sm_allinfo code help
Reply With Quote #4

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?
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 01-07-2009 , 17:19   Re: sm_allinfo code help
Reply With Quote #5

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
__________________
{7~11} TROLL is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 01-07-2009 , 17:30   Re: sm_allinfo code help
Reply With Quote #6

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 =)
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)

Last edited by Lebson506th; 01-07-2009 at 17:34.
Lebson506th is offline
zerak
Senior Member
Join Date: Feb 2008
Old 01-07-2009 , 17:32   Re: sm_allinfo code help
Reply With Quote #7

think you should have a semicolon after you plugin info
zerak is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 01-07-2009 , 17:33   Re: sm_allinfo code help
Reply With Quote #8

Not necessary. It compiles without it.


...i'll add it in there anyway.
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 01-07-2009 , 17:36   Re: sm_allinfo code help
Reply With Quote #9

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);
__________________
{7~11} TROLL is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 01-07-2009 , 17:38   Re: sm_allinfo code help
Reply With Quote #10

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.

__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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