Raised This Month: $32 Target: $400
 8% 

Read from file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Horex
Member
Join Date: Sep 2009
Old 09-20-2009 , 15:11   Read from file
Reply With Quote #1

PHP Code:
public OnPluginStart ()
{
    
HookEvent("player_connect_full"Event_PConnect);
}

public 
Event_PConnect(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
String:szCommand[][80]= {     "bind 6 slot6" 
                                    
"bind 7 slot7" 
                                    
"bind 8 slot8" 
                                    
"bind 9 slot9" 
                                    
"bind 0 slot0" 
                                    
"bind 6 slot6" 
                                }; 
    static 
iClient = -1iMaxClients 0;

    
iMaxClients GetMaxClients ();

    for (
iClient 1iClient <= iMaxClientsiClient++)
    {
        if (
IsClientConnected (iClient) && IsClientInGame (iClient))
        {
            if (!
IsFakeClient (iClient))
            {
                for (new 
026i++)
                {
                
ClientCommand (iClientszCommand[i]);
                }    
            }    
        }
    }


How to make this part of plugin configurable from file.


PHP Code:
    new String:szCommand[][80]= {     "bind 6 slot6" 
                                    
"bind 7 slot7" 
                                    
"bind 8 slot8" 
                                    
"bind 9 slot9" 
                                    
"bind 0 slot0" 
                                    
"bind 6 slot6" 
                                }; 
Horex is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 09-20-2009 , 15:30   Re: Read from file
Reply With Quote #2

Heh I'm basically asking the same thing here:

http://forums.alliedmods.net/showthread.php?t=104062

We both need to be able to take several strings from a file and put them into an array.

Also, why don't you just use OnClientPostAdminCheck?
Dragonshadow is offline
Horex
Member
Join Date: Sep 2009
Old 09-21-2009 , 05:13   Re: Read from file
Reply With Quote #3

So, can someone show me simple way and then i will do COPY/PASTE to my code?
Horex is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 09-21-2009 , 09:22   Re: Read from file
Reply With Quote #4

Quote:
Originally Posted by Horex View Post
PHP Code:
{
    new 
String:szCommand[][80]= {     "bind 6 slot6" 
                                    
"bind 7 slot7" 
                                    
"bind 8 slot8" 
                                    
"bind 9 slot9" 
                                    
"bind 0 slot0" 
                                    
"bind 6 slot6" 
                                }; 
                
ClientCommand (iClientszCommand[i]); 
You can't change client's bindings from plugins, the ClientCommand() won't work for that. That kinda makes your whole plugin moot.
naris is offline
V0gelz
Senior Member
Join Date: Jun 2004
Old 09-21-2009 , 10:08   Re: Read from file
Reply With Quote #5

what naris said
__________________
V0gelz is offline
Horex
Member
Join Date: Sep 2009
Old 09-21-2009 , 10:47   Re: Read from file
Reply With Quote #6

Yeah, i know but for me it works, don't ask why.
Horex is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 09-21-2009 , 10:52   Re: Read from file
Reply With Quote #7

Quote:
Originally Posted by naris View Post
You can't change client's bindings from plugins, the ClientCommand() won't work for that. That kinda makes your whole plugin moot.
You can in left4dead.
Dragonshadow 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 19:28.


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