AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to check if a player's name (https://forums.alliedmods.net/showthread.php?t=190076)

DJHD! 07-14-2012 14:45

How to check if a player's name
 
Well I have this code that reads what is written the .ini file now my question is how I can get to what is written is a player name.

PHP Code:

#include <amxmodx> 

new szVersion[] = "1.0"

public 
plugin_init() 

    
register_plugin("Read"szVersion"Asd'")
    
    
register_clcmd("say /result""Command_ReadFile")


public 
Command_ReadFile(id

    new 
szFileData[160]
    new 
szFilePath[60]
    new 
szFileConfig[60]
    
    
get_localinfo("amxx_configsdir"szFileConfig59)
    
formatex(szFilePath59"%s/Test.ini"szFileConfig)
    
    new 
iFile fopen(szFilePath"r")
    
    while(!
feof(iFile))
    { 
        
fgets(iFileszFileData459)

        
client_print(idprint_chat"Testing: %s"szFileData)
    } 
    
fclose(iFile)


Thank you very much hope to get help early.

Napoleon_be 07-14-2012 18:40

Re: How to check if a player's name
 
new szName[32]; get_user_name(id, szName, charsmax(szName))

meTaLiCroSS 07-14-2012 22:41

Re: How to check if a player's name
 
Quote:

Originally Posted by Napoleon_be (Post 1750482)
new szName[32]; get_user_name(id, szName, charsmax(szName))

Read it again please.

PLEASE.

Bugsy 07-14-2012 22:56

Re: How to check if a player's name
 
What is the format of the ini file?

DJHD! 07-14-2012 23:25

Re: How to check if a player's name
 
Quote:

Originally Posted by Bugsy (Post 1750581)
What is the format of the ini file?

String Ejm: "DJHD!"

Bugsy 07-15-2012 00:15

Re: How to check if a player's name
 
This will parse "String Ejm" .. you could also do szFileData[ iPos ] = EOS then just use szFileData.
PHP Code:

new szName32 ] , iPos strfindszFileData ":" );
    
if ( 
iPos > -1  )
{
    
copyszName iPos <= charsmaxszName ) ? iPos charsmaxszName ) , szFileData );
    
client_print(idprint_chat"Testing: %s"szName )



DJHD! 07-15-2012 06:27

Re: How to check if a player's name
 
Quote:

Originally Posted by Bugsy (Post 1750602)
This will parse "String Ejm" .. you could also do szFileData[ iPos ] = EOS then just use szFileData.
PHP Code:

new szName32 ] , iPos strfindszFileData ":" );
    
if ( 
iPos > -1  )
{
    
copyszName iPos <= charsmaxszName ) ? iPos charsmaxszName ) , szFileData );
    
client_print(idprint_chat"Testing: %s"szName )



oh thanks :) I will test


All times are GMT -4. The time now is 15:04.

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