Jump to content

Manuel1948

Members
  • Posts

    10
  • Joined

  • Last visited

Manuel1948's Achievements

Member

Member (5/54)

0

Reputation

  1. Dont you read my answers or dont you understand them? This solved my problem, and it were only the brackets, maybe this is lua default way to process: lua reads "if v==0 and check==false then" as "if v== (0 and check==false) then" @kenix: its working right now, but if I have problems again, I will read through your solution, because now i don't want to.
  2. you touched the script with a ( and a ) in the if-Statement in for-loop
  3. Thx, the mistake was in the loop " if v==0 and check==false then" is false, "if ( v==0 and check==false ) then" is true, but what does lua do without the () Code is done from left to right, does it eman lua reads "if v==0 and check==false then" as "if v== (0 and check==false) then" which is always false?
  4. #idtable is not a function or something idtable is an self defined array and #idtable returns the count of elements in array I have an array: idtable[1] idtable[2] idtable[3] and so on, and the value of every array is default 0, if a player joins, the array should take the value of it number like: idtable[1]=1 idtable[2]=2 but with this script, it doesn't work: for i,v in ipairs(idtable) do if v==0 and check==false then id=i check=true end end idtable[id]=id -- Problem Row the problem row is the code which isn't executed, maybe the syntax is false?
  5. I could, but I want SAMP-like IDs and not changing IDs... Why you can't tell me, why my script does not write the id in the id table
  6. ok an this is the mistake look: 1. Player gets ID1 | #idtable=1 2. Player gets ID2 | #idtable=2 3. Player gets ID3 | #idtable=3 --And now e.g 2.Player left the server and #idtable=2 --and the next joining player gets ID3 too because the IDs are not shifting understand?
  7. ok the say me what does #idtable stands for
  8. alright but look at your script for givePlayerID: function givePlayerID(player) local id = #idtable +1 -- this row adds +1 to the size of idtable better to the used fields its not right table.insert(idtable, id) setElementData(player,"player.id",id) end
  9. i don't want another script code, i rather want to know why my script isn't working, btw. your script is nonesense, because if they are 5 players online and the 3rd for example leaves the server, the next joining player get the id 6 and not 3
  10. Hey People! I wanted to make an ID system for my script, and everytime a player joines he should get the less id, which is possible. On top at the script I define idtable as an array and above i start writing 0 in the first 200 fields. idtable = {} for x=1,200,1 do idtable[x]=0 end And in the PlayerJoinHandler, I have the giveplayerID(player) function, but the problem is, that the function didn't write the id in the idtable, the whole table stays at 0. Why? function givePlayerID(player) local id = 1 local count = 0 local check=false for i,v in ipairs(idtable) do if v==0 and check==false then id=i check=true end end idtable[id]=id -- Problem Row setElementData(player,"player.id",id) end
×
×
  • Create New...