edited 2×, last 03.08.14 10:38:18 am
Forum
CS2D Scripts couldnt find delete topic button, sorrycouldnt find delete topic button, sorry
26 replies1
file = assert(io.open("allsavedatas/arraysaves/"..player(id,"usgn")..".txt","w+"))
To this:
1
file = io.open("allsavedatas/arraysaves/"..player(id,"usgn")..".txt","w+")
1
file = io.open("allsavedatas/arraysaves/"..player(id,"usgn")..".txt","w+")
dafuq is that
You could use this function to make it 1 or 0 depending of it's boolean value.
1
2
3
4
5
6
2
3
4
5
6
function booltoint(bool) 	if bool then 		return 1 	end 	return 0 end
1
2
3
4
5
6
2
3
4
5
6
function inttobool(int) 	if int == 1 then 		return true 	end 	return false end
if x then
io.write(file,"true")
end
file:write("false")
end
Just answer whether you understood / resolved it or not.
edited 1×, last 15.08.12 03:00:52 am
@ VADemon: There's tostring for that.
1
money[id]=tonumber(player_dat[id][2])
just check to see if id>0 and player(id,"usgn")~=0. if the id isnt between 1 and 32, trying to get a value from the id will return false, as far as i know
?
.
here's error LUA ERROR: sys/lua/savenload.lua:3: attempt to concatenate a boolean value
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function saves(id) 	if player(id,"usgn")~=0 and id>0 and id<33 then file = io.open("allsavedatas/arraysaves/"..player(id,"usgn")..".txt","w+") --HERE THIRD LINE file:write(tostring(career[id].." "..money[id].." "..aclik[id].." "..referer[id].." "..jail[id].." "..saycolor[id].." "..mute[id].." "..locked[id].." "..commandcooldown[id].." "..shootingrange[id])) file:close() msg2(id,'©107142035Save Game Successfull!@C') end end 	 player_dat={} function loads(id) if player(id,"usgn")~=0 and id>0 and id<33 then for line in io.lines("allsavedatas/arraysaves/"..player(id,"usgn")..".txt") do player_dat[id]={line:match("(.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*)")} 			 career[id]=tonumber(player_dat[id][1]) 			 money[id]=tonumber(player_dat[id][2]) 			 aclik[id]=tonumber(player_dat[id][3]) 			 referer[id]=tonumber(player_dat[id][4]) 			 jail[id]=tonumber(player_dat[id][5]) 			 saycolor[id]=tonumber(player_dat[id][6]) 			 mute[id]=tonumber(player_dat[id][7]) 			 locked[id]=tonumber(player_dat[id][8]) 			 commandcooldown[id]=tonumber(player_dat[id][9]) 			 shootingrange[id]=tonumber(player_dat[id][10]) end end end
edited 1×, last 15.08.12 05:59:01 pm
done,it doesnt work.
btw can some one add if file exists then code? to load code? (usgn.txt)
edited 3×, last 15.08.12 06:15:28 pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function loads(id) if player(id,"usgn")~=0 and id>0 and id<33 then for line in io.lines("allsavedatas/arraysaves/"..player(id,"usgn")..".txt") do player_dat[id]={line:match("(.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*) (.*)")} career[id]=tobool(player_dat[id][1]) money[id]=tonumber(player_dat[id][2]) aclik[id]=tobool(player_dat[id][3]) referer[id]=tobool(player_dat[id][4]) jail[id]=tobool(player_dat[id][5]) saycolor[id]=tobool(player_dat[id][6]) mute[id]=tobool(player_dat[id][7]) locked[id]=tobool(player_dat[id][8]) commandcooldown[id]=tobool(player_dat[id][9]) shootingrange[id]=tobool(player_dat[id][10]) end end end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function Array(p) local array = {} for i = 1, p do array[i]=0 end return array end money=Array(32) career=Array(32) kredi=Array(32) aclik=Array(32) ..... ... .. .
every varible is that array,and everthing has to be numbers
Why don't you just create table with all data for each player!!
DAMN
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Player = {} addhook('join', 'joinhook') function joinhook(id) 	Player[id] = { 		money = 0; 		credits = 0; 		timescrapped = 0; 		sexappeal = 13; 		fapped = 13; 	} end
EP has written
Lol what? @ Infinite Rain: He stills using the array function because his Player[id] didn't fap yet. Not even 13 times.
file too.