ID:164702
 
Hey,

Does anone know a Prefix code ?
Ive searched for demos, And i have found one.. But it doesent really work as i want it to.

I want GM's to be able to Add prefix's to any player GM or non GM in the game, But only GM's can use the verb.
This is the code i had found.

mob
var/prefix
verb
Change_Prefix()
prefix = copytext(prefix,1,MaxLen+1)
var/pre = input("Please type in your prefix. The Prefix maker will cut it down so that it is only [MaxLen] characters long. Then it will add a \"-\".\nIE. SuP-[key]","PREFIX",prefix) as null|text
if(!pre) return
else
if(length(pre) >= MaxLen+1)
pre = copytext(pre,1,MaxLen+1)
scantext(pre)
pre += "-"
prefix = pre
Delete_Prefix()
prefix = null
Say(Text as text)
set hidden = 1
world<<"[prefix][key]: [scantext(Text)]"

proc
/*
Use. scantext(textstring)
Returns a filtered text string
This is a fairly standard way to do it, there are probably more efficient ways out there but this works for me
*/

scantext(m as text)
var/p
m = " " + copytext(m,1) + " "
// Profanity fixes
// Scan through each of the words found in the profanity list and replace them
// More checks can be added, see demo file for emoticons and slangs
if(profanity.len)
for(var/i=1,i<=profanity.len,i++)
p = findtext(m,profanity[i])
while(p)
m = copytext(m,1,p) + profanityfix[i] + copytext(m,p+length(profanity[i]))
p = findtext(m,profanity[i])
return m


Is there a way of modyfying this code so GM's can use it and change anyones prefix?

Thanks.

- Bevan.