Search and replace string
#1

Hi everyone,

I made something a few mins ago, that changes your name, but the problem is, that the Vehicle system i have, looks to your name and check if it's the same as in the vehiclefile.(system uses fread)

What i want to do here, is create a function that loops trough the folder, searches for the name the person has, and replaces it with the given name.

Like this:

pawn Код:
GetPlayerName(playerid)//in my case Jari_Johnson
newname//and replaces it with this
I hope someone knows how to do this

Thanks in advance
((I've searched very good, but i couldn't find anything that explained it very good..))
Reply
#2

you need to tell your file system,

raw files? INI? ect.
then someone can help.
Reply
#3

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
you need to tell your file system,

raw files? INI? ect.
then someone can help.
i did, look to this sentence, at the total end
Quote:
Originally Posted by Jari_Johnson
looks to your name and check if it's the same as in the vehiclefile.(system uses fread)
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
There's more to a file system than a single function - file formats, naming schemes etc. Looping through files is basically ALWAYS the worst option because it is VERY slow. I'd suggest maintaining some form of index for players and their vehicles, or using a file system which doesn't rely on names (which are entirely variable).
So, maybe something that the players have to register their vehicle, or that it registers itself, and use one single file or something?

And, isn't it easier to use MYSQL? I heard that with mysql much things are easier/faster.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)