AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Read from file (https://forums.alliedmods.net/showthread.php?t=104181)

Horex 09-20-2009 15:11

Read from file
 
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" 
                                }; 


Dragonshadow 09-20-2009 15:30

Re: Read from file
 
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?

Horex 09-21-2009 05:13

Re: Read from file
 
So, can someone show me simple way and then i will do COPY/PASTE to my code?

naris 09-21-2009 09:22

Re: Read from file
 
Quote:

Originally Posted by Horex (Post 938800)
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.

V0gelz 09-21-2009 10:08

Re: Read from file
 
what naris said :P

Horex 09-21-2009 10:47

Re: Read from file
 
Yeah, i know but for me it works, don't ask why.

Dragonshadow 09-21-2009 10:52

Re: Read from file
 
Quote:

Originally Posted by naris (Post 939493)
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.


All times are GMT -4. The time now is 20:47.

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