AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Adding a line to a file (https://forums.alliedmods.net/showthread.php?t=12521)

v3x 04-17-2005 09:03

Adding a line to a file
 
How would I go by adding a line to a file? =)

n0obie4life 04-17-2005 09:06

-- offtopic : --

v3x, i know u'd see this topic, so i wanna ask

WHAT ENTITY DO I USE FOR SHOTGUN AMMO :P . i just cannot seem to find it.

out of all this

ammo_338magnum
ammo_357sig
ammo_45acp
ammo_50ae
ammo_556nato
ammo_57mm
ammo_762nato
ammo_9mm
ammo_556natobox
ammo_flashbang

v3x 04-17-2005 09:11

..
Code:
cs_set_user_bpammo(id,"weapon_m3",24) // Not sure what it is, I think it's 24
Please don't respond to this, n0obie.

[EDIT]

So I found this code @ the AMX forums..
Code:
 new connectname[32] new connectid[32] get_user_name(id,connectname,31) get_user_authid(id,connectid,31) new gFileLocation[66] = "addons/amx/connectedid.txt" new FileMake[261] format(FileMake,260,"Name- %s   :::   SteamID- %s",connectname,connectid) write_file(gFileLocation,FileMake,-1)
Is there a better way of doing it?

v3x 04-17-2005 15:32

Is this right..
Code:
// ..     new cfgDir[64]                 new FileLocation[64]                                                                               get_configsdir(cfgDir,63)                                                                           format(FileLocation,63,"%s/users.ini",cfgDir)     write_file(FileLocation,"-- Blah --",-1)
:?:

twistedeuphoria 04-17-2005 16:29

Yea, that should be right. You don't need the -1, less typing.

v3x 04-17-2005 17:01

Alright, here's small part from my code:

Code:
// ..     if(equal(Flags,"1")) get_cvar_string("admin_level1",nFlags,23)           if(equal(Flags,"2")) get_cvar_string("admin_level2",nFlags,23)           if(equal(Flags,"3")) get_cvar_string("admin_level3",nFlags,23)                                                                                             format(cfgFile,83,"^"%s^" ^"%s^" ^"%s^" ^"ac^"",Pass,SteamID,nFlags)     format(cfgFile,83,"; %s - %s",Player,CurrentTime)                                                                                                           write_file(FileLocation,cfgFile,-1)
Is there anything strange about that, that would make it not write correctly?

twistedeuphoria 04-17-2005 17:32

You're format() - ing to the same string, it doesn't concatenate automatically.

v3x 04-17-2005 17:41

Yea, while I was AFK I realised that.. LOL. I make the dumbest mistakes sometimes. Two more questions..

1) Is nFlags even returning a value?

2) How can I tell if the same Steam ID is used in the same line?

twistedeuphoria 04-17-2005 17:45

Whaa??
You're going to need to show more of the code or explain yourself better.


All times are GMT -4. The time now is 10:03.

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