PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Vntalk on 04 August, 2004, 19:12:31

Title: Profile
Post by: Vntalk on 04 August, 2004, 19:12:31
In my script
there is something like this :

if victim.iProfile == 3 then

but i want from profile 2 to 4
how you guys write that ??
thanks
Title:
Post by: Herodes on 04 August, 2004, 20:19:48
an easy way is to make it something like
if victim.iProfile == 2 or victim.iProfile == 3 or victim.iProfile == 4  thenit is better to define the scope for the if conditions with parenthesis....
if ( (victim.iProfile == 2) or (victim.iProfile == 3) or (victim.iProfile == 4) ) thenI find it is nicer to read it this way ... and it is usefull for something else that I dont recall right now,...

but I think there has to be a nicer way to do it ... post the script or show us where from .. :)
Title:
Post by: plop on 05 August, 2004, 05:56:03
a better way of the thing mutor posted.
profiles = { 0, 1 , 2 }

for i=1, getn(profiles) do
   if user.iProfile == profiles[i] then
      user:SendData(bot, "you may acces this command!")
      local t =1
      break
   end
end
if t == nil then
   user:SendData(bot, "you may NOT acces this command!")
end
but a much nicer way is the next 1.
profiles = { [0]=1, [1]=1 , [2]=1 }

if profiles[user.iProfile] then
   user:SendData(bot, "you may acces this command!")
else
   user:SendData(bot, "you may NOT acces this command!")
end
plop
Title:
Post by: UwV on 15 August, 2004, 03:08:18
so would the same thing work in a bcdc script? (fresh stuff, to be exact ?)
Title:
Post by: Herodes on 15 August, 2004, 08:55:34
The method would work yes .. but the iProfile is a PtokaX thing ...so it wouldn't work
Title:
Post by: UwV on 15 August, 2004, 13:23:51
-----------------------------
.. so it wouldn't work  
-------------------------------
:0(

but thanks for the quick reply..
Title:
Post by: Herodes on 15 August, 2004, 13:38:38
you are welcome .. :)