Raised This Month: $ Target: $400
 0% 

command not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-19-2013 , 09:26   command not working
Reply With Quote #1

Hi
I tried made command for one thing but istn working...
amx_testcmd "Steam Id"

Then it should add steam id in one file, it just add ^n

code:
PHP Code:
public cmd_add_costum_ban(idlevelcid
{
    if(
cmd_access(idlevelcid2))
    {
        new 
new_steam_id[35]
        
read_argv(1new_steam_id34)
        
formatex(new_steam_id34"^n%s"new_steam_id)
        
        new 
File fopen(path"wt")
    
        
fprintf(Filenew_steam_id)
        
fclose(File)
        
        new 
players[32], num
        get_players
(playersnum)
        
        if(
num)
        {
            new 
user players[num]
            new 
steamid[35]
            
get_user_authid(usersteamid34)
            
            if(
equal(new_steam_idsteamid))
                
// code
        
}
    }

__________________
Jhob94 is online now
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-19-2013 , 09:32   Re: command not working
Reply With Quote #2

Use format
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-19-2013 , 09:32   Re: command not working
Reply With Quote #3

ok i gonna try
thanks

EDIT:
now just shows "STEAM_0" xD
__________________

Last edited by Jhob94; 07-19-2013 at 09:44.
Jhob94 is online now
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-20-2013 , 03:53   Re: command not working
Reply With Quote #4

Quote:
Originally Posted by Jhob94 View Post
now just shows "STEAM_0" xD
That happens when you don't use quotes.
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-20-2013 , 05:43   Re: command not working
Reply With Quote #5

If you input "^n" in steamid string, then you can't try to compare to connected players steamids, won't work.
Also fprintf allow formatting, use it.
Your get_players usage is not correct, you have to loop the array.
Also you could add to get_players flags c and h so you don't collect bots and you don't collect hltvs

PHP Code:
public cmd_add_costum_ban(idlevelcid
{
    if(
cmd_access(idlevelcid2))
    {
        new 
new_steam_id[32]
        
read_argv(1new_steam_idcharsmax(new_steam_id))

        new 
File fopen(path"wt")

        
fprintf(Filenew_steam_id)
        
fprintf(File"^n^"%s^""new_steam_id);
        
fclose(File)

        new 
players[32], numsteamid[32], user
        get_players
(playersnum"ch")
        for(--
numnum>=0num--)
        {
            
user players[num]
            
get_user_authid(usersteamidcharsmax(steamid))

            if(
equal(new_steam_idsteamid))
            {
                
// code



                
break // we have a match, don't continue the loop for nothing
            
}
        }
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-20-2013 , 08:17   Re: command not working
Reply With Quote #6

Thanks, works like a charm
__________________
Jhob94 is online now
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 06:31.


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