AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Replacing %s on file with player name (https://forums.alliedmods.net/showthread.php?t=308749)

thEsp 07-02-2018 06:23

Replacing %s on file with player name
 
Hi every1
I have an problem I hope you will help me with it


Code:

show_hudmessage(id, "%s" ,szText,player) //(%s reads the file so dont mess with it :D)//
What I need is to replace %s (ON FILE) with name of player in game

Thanx,sorry for short code... :oops:

instinctpt1 07-02-2018 06:43

Re: Replacing %s on file with player name
 
WTF is this ?
PHP Code:

show_hudmessage(id"%s" szText,player// Where is ( , ) bro ? 

Just use fgets and get data from the file and assign szText to the data and then use it here

thEsp 07-02-2018 06:57

Re: Replacing %s on file with player name
 
I edited post so I acidentally removed it . LOL
(sry)

maqi 07-02-2018 07:12

Re: Replacing %s on file with player name
 
You are passing 2 variables for formating but only one %s

maqi 07-02-2018 07:42

Re: Replacing %s on file with player name
 
And i just told you why

Ghosted 07-02-2018 07:54

Re: Replacing %s on file with player name
 
Quote:

Originally Posted by maqi (Post 2600506)
You are passing 2 variables for formating but only one %s


But if szText also contains %s then it will work (or not?)
anyway what are types of those variables ? szText, player.

maqi 07-02-2018 07:59

Re: Replacing %s on file with player name
 
Are we supposed to read minds ? :D

He showed us one line of code without any context

instinctpt1 07-02-2018 08:01

Re: Replacing %s on file with player name
 
Quote:

Originally Posted by thEsp (Post 2600512)
Doesnt work at all bro :|

Show us full code
Or just show this function and the file you are trying to read

thEsp 07-02-2018 08:12

Re: Replacing %s on file with player name
 
Quote:

Originally Posted by instinctpt1 (Post 2600519)
Show us full code
Or just show this function and the file you are trying to read

szText is file text and player gets name of player

I fixed this but I just need to get lens of text file,would you help me on that

thEsp 07-02-2018 08:12

Re: Replacing %s on file with player name
 
Quote:

Originally Posted by maqi (Post 2600518)
Are we supposed to read minds ? :D

He showed us one line of code without any context

new szText[64], len
format(szText, 63, dir)
read_file(dir,0,szText,63,len)

new player[32]
get_user_name(id,player,32)


All times are GMT -4. The time now is 12:43.

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