Author Topic: help with achievements script  (Read 954 times)

0 Members and 1 Guest are viewing this topic.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
help with achievements script
« on: June 26, 2010, 11:50:32 pm »
ok im not quite sure how to attack this

is it possible to get my script to create folders on my host server?

if not are there any other good was to set up an achievements script?

players complete certain tasks and they are rewarded an achievement, specifically when a new player who hasnt been registered to the login system i have made, will have their name and IP logged to a file (no problem here, problem comes up shortly) and then a folder named as the players name will be made in the Players folder i have made (Players folder is in Root part of hosts folder)

then when they complete the certain achievement, a file named as the name of the achievement will be written

but i have noticed that simply trying to write a file to a folder that doesnt exist doesnt create the folder so how do i do it script wise?

how would i get the script to read the file into a var which is then split with : being the delimiter, left is the players name and right is the IP, i have already tried this:

Code: (pascal) [Select]
If FileExists('Players/'+idtoname+'.txt') then begin
  //if i put writeconsole messages here they show up fine
  PStat:= ReadFile('Players/'+idtoname(ID)+'.txt');  //should write something like <playername>:<IP> but without the <>s
  if PStat = IDtoname(ID)+':'+GetPlayerStat(ID,'IP') then begin //checks to make sure tht payer details are the same as when first registered
    // a few writeconsole messages here, but they wont show up
  end;
end;
so it must be that the second if statement isnt launching correctly, so i mustnt have written the player check correctly, what am i missing? currently dont need the string splitter yet but i will need it soon
« Last Edit: June 26, 2010, 11:53:41 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline iDante

  • Veteran
  • *****
  • Posts: 1967
Re: help with achievements script
« Reply #1 on: June 27, 2010, 12:06:10 am »
If you must there is always shell_exec. That shouldn't be necessary, why not just store the achievements in a file with the player's name? No need to make a new directory or anything.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: help with achievements script
« Reply #2 on: June 27, 2010, 12:20:44 am »
but then how would i read a certain line number? or write to a particular line not just the next empty line?

also why isnt the the if statement working? (see above)
« Last Edit: June 27, 2010, 12:29:56 am by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Serial K!ller

  • Camper
  • ***
  • Posts: 408
    • Soldat Mods Archive
Re: help with achievements script
« Reply #3 on: June 27, 2010, 03:20:58 am »
Maybe make a .ini file and use the readINI function.
You will have to replace characters from names that are not allowed in file names.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: help with achievements script
« Reply #4 on: June 27, 2010, 03:48:13 am »
thats easy, thanks guys :D

From: June 27, 2010, 07:00:17 pm
is it possible to add leaderboards? say certain stats are saved to a file but are dynamically updated to a website? can this be done Without PHP? my site host doesnt support PHP, i wont be on a host who does support PHP till November, anything i can do til then?
« Last Edit: June 27, 2010, 07:00:17 pm by frosty »
check out my server! click here

If at first you don't succeed, Improvise! :D

Offline Swompie

  • Camper
  • ***
  • Posts: 390
Re: help with achievements script
« Reply #5 on: June 28, 2010, 06:49:17 am »
Probably only PHP, just get a free webhost to make the stats there.

Offline frosty

  • Flagrunner
  • ****
  • Posts: 601
  • Uber Desert Eagle ^^
Re: help with achievements script
« Reply #6 on: June 28, 2010, 01:25:30 pm »
ill just have to wait til my current host expires, the leaderboards aint urgent :)
check out my server! click here

If at first you don't succeed, Improvise! :D