PtokaX forum

Development Section => Your Developing Problems => Topic started by: Madman on 23 September, 2004, 17:28:21

Title: Get profile - Help
Post by: Madman on 23 September, 2004, 17:28:21
Hi, is it posibole to get the profilename?

I use this code..
function OpConnected(User)
if table[User.sName] then
SendToAll(Bot, table[User.sName] )
elseif (User.iProfile == 0) then
SendToAll(Bot,"The Master "..User.sName.." has entered the Hub, Welcome Home.")
elseif (User.iProfile == 1) then
SendToAll(Bot,"The Operator "..User.sName.." has entered the Hub, Welcome Home.")
elseif (User.iProfile == 4) then
SendToAll(Bot,"The Moderator "..User.sName.." has entered the Hub, Welcome Home.")
elseif (User.iProfile == 5) then
SendToAll(Bot,"The Netfounder "..User.sName.." has entered the Hub, Welcome Home.")
end
end

 but i want to use something like

function OpConnected(User)
if table[User.sName] then
SendToAll(Bot, table[User.sName] )
else
SendToAll(Bot,"The"..Profile.." "..User.sName.." has entered the Hub, Welcome Home.")
end
end
Title:
Post by: Herodes on 23 September, 2004, 17:35:32
sure u can ... from Ptokax's docs/Scripting.txt ....

Quotefrom Ptokax's docs/Scripting.txt

 - - AddProfile(profile_name, profile_data) ... adds new profile
 - - RemoveProfile(profile_name) ... removes profile
 - - GetProfileIdx(profile_name) ... gets profile index by profile name
 - - GetProfileName(profile_idx) ... gets profile name by profile index
 - - GetProfiles() ... returns profile names in a table
 - - GetUsersByProfile(profile_name) ... returns table of all users with given profile
be sure to checkout the rest of the scripting.txt because u'll find treasures in there .. :)
Title:
Post by: Madman on 23 September, 2004, 19:39:29
Yes i know... but i did not get it to work....
If i use  GetProfileName(profile_idx)
ex  GetProfileName(0)
Then All ops will get The Master bla bla...

What i want is that the scripts checks the users profile..
then depending on what profile is replace ..Profile.. with the profile name...

if user profile is operator it shows
The Operator nick is here...
but if user is master it shows
The Master nick is here..

And i only want to use this line..
SendToAll(Bot,"The"..Profile.." "..User.sName.." has entered the Hub, Welcome Home.")

Not all thoose in the first post ;)
Title:
Post by: Typhoon on 23 September, 2004, 20:21:17
function OpConnected()
local Profile =  GetProfileName(user.iProfile)
SendToAll(Bot,"The"..Profile.." "..User.sName.." has entered the Hub, Welcome Home.")
end
Title:
Post by: Madman on 23 September, 2004, 20:33:04
Thanks =)

Need some help again..

Got this table..
table = {
["Madman"]= "My Text",
}

But i want it to be
["Madman"]= "My Text" "Some More Text",

What Should i write instead of ? i have Tired ..User.sName.. But that did't work...
Title:
Post by: Typhoon on 24 September, 2004, 11:07:23
try this out , should work


table = {
["Madman"]= "hello [nick] and welcome to the hub",
}


function OpConnected(user)
      if table[user.sName] then
         local msg = gsub(table[user.sName], "%[nick%]", user.sName)
         SendToAll(BotName,msg)
      end
end


Typhoon?
Title:
Post by: Madman on 24 September, 2004, 18:36:51
Thanx, It worked.. =)
Title:
Post by: Typhoon on 24 September, 2004, 19:21:52
your welcome, gonna post a standalone script including commands when i have the time to rip it from Sentinel

Typp?hoon?
Title:
Post by: Typhoon on 24 September, 2004, 20:04:35
just had some free moments so here you go

Push Here (http://board.univ-angers.fr/action.php?action=getlastboard&threadid=2816&boardid=15)


Typhoon?
Title:
Post by: BoJlk on 24 September, 2004, 20:06:13
madman

I didn't understand the scripts fumction?

U wanted that every user enters the HUB
Everyone Connected will be notified...

*** Username entered the HUB ?
Title:
Post by: Madman on 24 September, 2004, 20:27:14
Yes BoJlk..
Thats is What i Wanted, and thanks to Typhoon i got it =)
If u want i can post the script...
Title:
Post by: BoJlk on 24 September, 2004, 20:31:02
That would be Great! 10x

doesn't it presents a problem with the RC messages
like "the oprator USER just entered, welcome home"
Title:
Post by: Madman on 24 September, 2004, 21:43:44
That's true so disable that message.. let only users and vips messages be displayed by RC
i got that mesage covered ;)
for op and higher that is...

--//Custom Log in Script Made By Madman
--//Thanks Typhoon for the help with ..Profile..
--//And Also 4 The Local msg thing

Bot = "LoginBot"

--//User enters the hub text
--//[nick] will be replaced with the users name..
--//["Madman"]= "The [nick] has entred", Will show
--// The Madman has entred
table = {

["[DN]Madman"]= "The Dragon lord [nick] rided in on his breath of flame",
["[OP]Scruffy"]= "The looser [nick] has falled in bakis",
["[DN]Didde"]= "The man, The myth, The concept [nick] flies in to the hub",
["-=FakeKiller=-"]= "[nick] is a killing machine, he is always busy killing people, so don't PM him",
["Dragonmac?"]= "The Network God [nick] Has Come To Open Up The Heavens",
--//4 Madhouse
["Madman"]= "The Dragon lord [nick] rided in on his breath of flame",
-- [""]= "[nick]",
}

--//User Disconnect Text
table2 = {

["[DN]Madman"]= "[nick] burns down some fakers on his way out",
["[OP]Scruffy"]= "[nick] has *gone*",
["[DN]Didde"]= "[nick] disconnects down to flames",
["-=FakeKiller=-"]= "[nick] has gone to the real world, to kill people",
["Dragonmac?"]= "The Network God [nick] Has Left The Hub To Go Back To The Heavens",
--//4 Madhouse
["Madman"]= "[nick] burns down some fakers on his way out",
-- [""]= "[nick]",
}

--//Ops Enters The Hub
function OpConnected(curUser)
      if table[curUser.sName] then
         local msg = gsub(table[curUser.sName], "%[nick%]", curUser.sName)
         SendToAll(Bot,msg)
        --//If not in table
else
local Profile = GetProfileName(curUser.iProfile)
SendToAll(Bot,"The "..Profile.." "..curUser.sName.." has entered the Hub, Welcome Home.")
      end
end

--//Ops Leaves The Hub
function OpDisconnected(curUser)
if table2[curUser.sName] then
local msg = gsub(table2[curUser.sName], "%[nick%]", curUser.sName)
         SendToAll(Bot,msg)
    --//If not in table2
else
local Profile = GetProfileName(curUser.iProfile)
SendToAll(Bot,"The "..Profile.." "..curUser.sName.." has left the Hub, See you Soon.")
end
end
Title:
Post by: Typhoon on 24 September, 2004, 23:25:34
nice one madman :) ,, keep it up , have you looked at the above link i postet some ideas for you in that one :)

Typhoon?
Title:
Post by: Madman on 25 September, 2004, 00:17:02
Yeah... But i desided to not add any options to let my op add there own texts.. they probarly change it every week.. They have trouble makeing up there minds ;p