Author Topic: Creaing an INI with a script ->~~- SOLVED -~~<-  (Read 1413 times)

0 Members and 1 Guest are viewing this topic.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Creaing an INI with a script ->~~- SOLVED -~~<-
« on: February 14, 2009, 07:45:05 pm »
latly my players' accounts in my RPG server have been rolling back their skills even though they are supposed to be saved (has been working for quite a while). All the accounts are saved in one large INI but I think it being such a large INI may be causing some read problems. So I was thinking about just storeing every account in a seperate ini with the name being the account name. Even if this didnt solve the rollback problem it would be a much better system anyway. How can I create an INI ingame using the script?

Also is it possible to have 2 different draw texts onscreen at the same time?

Thank you.
« Last Edit: February 16, 2009, 10:11:50 pm by Hacktank »


Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Creaing an INI with a script
« Reply #1 on: February 14, 2009, 07:53:08 pm »
I dunno about the first part (pretty sure it ain't possible with the current script but a bit of changing could fix it).

Also is it possible to have 2 different draw texts onscreen at the same time?
No.

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Creaing an INI with a script
« Reply #2 on: February 15, 2009, 03:42:49 am »
Do not use ini file. Whole player's data can be saved in one line.

Quote
How can I create an INI ingame using the script?
function WriteFile(FileName, Data: string): boolean
function WriteLnFile(FileName, Data: string): boolean

If you are using those INI functions use iniSave and iniSetValue
« Last Edit: February 15, 2009, 03:47:34 am by tk »

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Creaing an INI with a script
« Reply #3 on: February 15, 2009, 04:48:06 am »
just write all data in on line separated with spaces or something else like tk said, and xsplit it when loading. Itll be much faster than ini files

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Creaing an INI with a script
« Reply #4 on: February 15, 2009, 05:00:04 am »
OK I have that working but how would i get them to write in a specific folder?
Code: [Select]
WriteFile(/accounts/name + '.ini','');maby?

And about doing it all on one line, I want it to be neat and organized and I think the problem with peoples account info getting erased was because 2 people were trying to save at the same time or maby the server closed or crashed while they were saveing and this should fix it or atleast make it happen less often.

ALSO How would i go about telling if a zombie is stuck in polys? I know it is going to take some raycast useage but when i tired it they were randomly killed just by walking near some oddly shaped polys.

And one more thing, somehow hackers keep manageing to get onto bravo team even though i have this in the onjointeam
Code: [Select]
if getplayerstat(ID,'team') = 2 then Command('/setteam1 ' + inttostr(ID));How do i stop them from being able to be on bravo?

Thanks guys.
« Last Edit: February 15, 2009, 06:12:10 am by Hacktank »


Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Creaing an INI with a script
« Reply #5 on: February 15, 2009, 07:23:38 am »
OK I have that working but how would i get them to write in a specific folder?
Code: [Select]
WriteFile(/accounts/name + '.ini','');maby?
Almost:
Code: [Select]
WriteFile('accounts/' + whateverThePlayerMightBeNamed + '.ini','');
As for your RayCast question, you'd probably need to check the immediate surrounding area of the gostek. A for loop and a bit of basic trigonometry would go a long way here.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Creaing an INI with a script
« Reply #6 on: February 15, 2009, 07:43:47 am »
Thanks Toumaz your the greatest! I dont really know any trig, im a freashman in a dumb school... But how many units tall is a gostek? does the x start in its middle or to the left or what? How many units wide is a gostek? Does the y start at the gostek's feet or head?


Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Creaing an INI with a script
« Reply #7 on: February 15, 2009, 01:04:02 pm »
the units are pixels, so if you want an exact number just take a screenshot in default resolution (800x600) and count them in paint. As for the gostek coordinates, i guess its the gun, but im not sure at all `:|
And where did you put that team restriction code? I just have a similar check in onjointeam and never had problems with it...

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: Creaing an INI with a script
« Reply #8 on: February 15, 2009, 01:13:20 pm »
Y starts at feet, gostek is about 22 units tall.
Quote
ALSO How would i go about telling if a zombie is stuck in polys? I know it is going to take some raycast useage but when i tired it they were randomly killed just by walking near some oddly shaped polys.

Quote
function player_raycast(id: byte): boolean;
var x,dist: single;
begin
  x := GetPlayerStat(id,'x') + iif(GetPlayerStat(id,'direction') = '>', 3, -3);
  result := raycast(x, GetPlayerStat(id,'y')-6, x, GetPlayerStat(id,'y')-6, dist, 1);
end;
Its not tested but should work. If your zombies are often killed by script use something like stuck points which increase in apponidle when bot is stuck. bot will be killed when it has for example 5 points.
« Last Edit: March 07, 2009, 04:06:22 am by tk »

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Creaing an INI with a script
« Reply #9 on: February 16, 2009, 06:34:55 pm »
Ok I have everything working that is related to accounts. I am makeing an stats system with top 5 and I need to know how to break a for loop. Is it exit or break or what, im thinking its break?


Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: Creaing an INI with a script
« Reply #10 on: February 16, 2009, 07:04:18 pm »
Ok I have everything working that is related to accounts. I am makeing an stats system with top 5 and I need to know how to break a for loop. Is it exit or break or what, im thinking its break?
If you need to break it then it's best to use a while loop.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Creaing an INI with a script
« Reply #11 on: February 16, 2009, 09:20:07 pm »
Ok i have placeing working correctly. Thanks iDante. Is it possible to change the built in nextmap variable? like with nextmap :=? I am making a map randomizer, and i dont like it saying nextmap x every time and then quickly saying nextmap -randomized map- every time.


Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Creaing an INI with a script
« Reply #12 on: February 16, 2009, 09:56:58 pm »
Changing that variable does nothing, it will just get reset on the next procedure call. You can't change the next map like that.

Offline Hacktank

  • Camper
  • ***
  • Posts: 462
  • Soldat Scripter
    • HTZRPG
Re: Creaing an INI with a script
« Reply #13 on: February 16, 2009, 10:11:24 pm »
Ok then Thanks. All questions I can think of rite now solved. :)