Raised This Month: $82 Target: $400
 20% 

Problem on Writing file line


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SpirT
Member
Join Date: Sep 2018
Location: OnMyGirlFriendBed()
Old 04-15-2019 , 13:14   Problem on Writing file line
Reply With Quote #1

Hey guys.
I developed a plugin with writes steamid, flags and immunity and the name of client as this way
"my_steam_id" "immunity:flags" //player_name

But the problem is that when I select the player name, it adds the flags, etc but does to other players with the steamid of the player i choosed. How can i solve this?

PHP Code:
...

            if(
StrEqual(choice"vip"))
            {
                
char path[512];
                
BuildPath(Path_SMpathsizeof(path), "configs/admins_simple.ini");
                if(
FileExists(path))
                {
                    
char steamid[32];
                    for (
int i 1<= MaxClientsi++)
                    {
                        
GetClientAuthId(iAuthId_Steam2steamidsizeof(steamid));
                        
char sDisplay[50];
                        
Format(sDisplaysizeof(sDisplay), " %N"i);
                        
Handle file OpenFile(path"a");
                        
WriteFileLine(file"");
                        
WriteFileLine(file"\n\"%s\" \"20:ao\" //%N"steamidi); 
                        
CloseHandle(file);
                        
PrintToChat(client"%s Concluido!"PLUGIN_TAG);
                    }
                }
            }

...

public 
int clients_handler(Menu cmenuMenuAction actionint clientint item

    
char sDisplay[50], sIdx[5];
    for (
int i 1<= MaxClientsi++) 
    { 
        if (
IsClientInGame(i) && !IsFakeClient(i)) 
        { 
            
IntToString(isIdxsizeof(sIdx)); 
            
Format(sDisplaysizeof(sDisplay), " %N"i); 
            
cmenu.AddItem(sIdxsDisplay);
            if(
action == MenuAction_Select)
            {
                
delete cmenu;
                
CreatePermsMenu().Display(clientMENU_TIME_FOREVER);
            }            
        } 
    } 

How can i solve this??
__________________
SpirT is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-16-2019 , 07:21   Re: Problem on Writing file line
Reply With Quote #2

Quote:
Originally Posted by SpirT View Post
Hey guys.
I developed a plugin with writes steamid, flags and immunity and the name of client as this way
"my_steam_id" "immunity:flags" //player_name

But the problem is that when I select the player name, it adds the flags, etc but does to other players with the steamid of the player i choosed. How can i solve this?

PHP Code:
...

            if(
StrEqual(choice"vip"))
            {
                
char path[512];
                
BuildPath(Path_SMpathsizeof(path), "configs/admins_simple.ini");
                if(
FileExists(path))
                {
                    
char steamid[32];
                    for (
int i 1<= MaxClientsi++)
                    {
                        
GetClientAuthId(iAuthId_Steam2steamidsizeof(steamid));
                        
char sDisplay[50];
                        
Format(sDisplaysizeof(sDisplay), " %N"i);
                        
Handle file OpenFile(path"a");
                        
WriteFileLine(file"");
                        
WriteFileLine(file"\n\"%s\" \"20:ao\" //%N"steamidi); 
                        
CloseHandle(file);
                        
PrintToChat(client"%s Concluido!"PLUGIN_TAG);
                    }
                }
            }

...

public 
int clients_handler(Menu cmenuMenuAction actionint clientint item

    
char sDisplay[50], sIdx[5];
    for (
int i 1<= MaxClientsi++) 
    { 
        if (
IsClientInGame(i) && !IsFakeClient(i)) 
        { 
            
IntToString(isIdxsizeof(sIdx)); 
            
Format(sDisplaysizeof(sDisplay), " %N"i); 
            
cmenu.AddItem(sIdxsDisplay);
            if(
action == MenuAction_Select)
            {
                
delete cmenu;
                
CreatePermsMenu().Display(clientMENU_TIME_FOREVER);
            }            
        } 
    } 

How can i solve this??
did you check your error logs?
i'm pretty sure there will be errors since you didn't check if client is in game like in your other for loop
__________________
8guawong is online now
SpirT
Member
Join Date: Sep 2018
Location: OnMyGirlFriendBed()
Old 04-16-2019 , 13:51   Re: Problem on Writing file line
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
did you check your error logs?
i'm pretty sure there will be errors since you didn't check if client is in game like in your other for loop
No there aren't errors. But is spams like this the admin_simple.ini

Example: my steam id is "123", immunity 99 and flags "z" and name //name of the player. It spams like this:

Code:
"123" "99:z" //name of player1
"123" "99:z" //name of player2
"123" "99:z" //name of player3
"123" "99:z" //name of player4
"123" "99:z" //name of player5
Is there any way to fix this??
__________________
SpirT is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-16-2019 , 13:56   Re: Problem on Writing file line
Reply With Quote #4

Quote:
Originally Posted by SpirT View Post
No there aren't errors. But is spams like this the admin_simple.ini

Example: my steam id is "123", immunity 99 and flags "z" and name //name of the player. It spams like this:

Code:
"123" "99:z" //name of player1
"123" "99:z" //name of player2
"123" "99:z" //name of player3
"123" "99:z" //name of player4
"123" "99:z" //name of player5
Is there any way to fix this??
what is the result you want?
__________________
8guawong is online now
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-16-2019 , 14:05   Re: Problem on Writing file line
Reply With Quote #5

plz show the full code cuz your snippet just looks wrong
__________________
8guawong is online now
farawayf
Member
Join Date: Jan 2019
Old 04-16-2019 , 16:32   Re: Problem on Writing file line
Reply With Quote #6

remove int loop, replace "i" to "target" in GetClientAuthId

Last edited by farawayf; 04-17-2019 at 01:19.
farawayf is offline
SpirT
Member
Join Date: Sep 2018
Location: OnMyGirlFriendBed()
Old 04-17-2019 , 06:16   Re: Problem on Writing file line
Reply With Quote #7

Quote:
Originally Posted by farawayf View Post
remove int loop, replace "i" to "target" in GetClientAuthId
How do you want me do define target??

int target = <code here>??
__________________
SpirT is offline
farawayf
Member
Join Date: Jan 2019
Old 04-17-2019 , 07:59   Re: Problem on Writing file line
Reply With Quote #8

Spamming lines because function are inside of a player loop, which means functions will be performed for the number of players.

the code is not full.
i do not know the first function is client action or..

if client action

PHP Code:
    new target;
    
decl String:args[128];
    
GetCmdArgString(argssizeof(args));
    
target FindTarget(clientargstruefalse); 
if menu handle - "new target;"

Last edited by farawayf; 04-17-2019 at 08:01.
farawayf is offline
Reply


Thread Tools
Display Modes

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 05:10.


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