ID:141780
 
what i have to do to fix my demote verb,i coded right my demote verb but when i premote player and after that i demote him he still stay as gm what i have to do to fix it plzzz answear me.

here is my msn and my Email : [email protected]
It helps to post your code and type in english.
In response to Mizukouken Ketsu
Demote_Admin(mob/M in world)
set category="Admin"
if(GMLockCheck())
usr<<"<font color=red>Your Admin Powers Are Locked."
return
if(M.GMLevel==0)
usr<<"<font color=red>They have no admin powers."
return
switch(alert("Are you sure you want to demote [M]'s admin powers?","Demote Admin [M]","Yes","No"))
if("Yes")
goto Yes
if("No")
return
return
Yes
var/GLevel=input("What level of admin do you want to demote [M] to?")as num
var/GRank
if(GLevel<=-1||GLevel>=6)
usr<<alert("Enter a valid number between 0 and 5!")
goto Yes
switch(GLevel)
if(0) GRank="Basic Player"
if(1) GRank="Game Monitor"
if(2) GRank="High Monitor"
if(3) GRank="Game Admin"
if(4) GRank="High Admin"
if(5) GRank="Master Admin"
switch(alert({"Is This Correct?
Target:
[M] ([M.key])
Selected Rank:
[GLevel], [GRank]"},"Demoting Admin","Yes","No"))
if("Yes")
goto Next
if("No")
alert("Canceled.")
return
Next
if(M.GMLevel>=usr.GMLevel)
alert("You can only Demote Admins of a rank lower than your own.")
AdminBadLog("Remove Admin","Number Level: [GLevel]","Rank: [GRank]",M)
return
if(GLevel>=M.GMLevel)
usr<<"They are already below or equal to that rank."
return
AdminLog("Demote Admin","Number Level: [GLevel]","Rank: [GRank]",M)
AdminMessage("[usr] ([usr.key]) has demoted [M] ([M.key]) to GRank]. [M] old level: [M.GMLevel]")
switch(M.GMLevel)
if(6) A_GML6-=M.key
if(1) A_GML1-=M.key
if(2) A_GML2-=M.key
if(3) A_GML3-=M.key
if(4) A_GML4-=M.key
if(5) A_GML5-=M.key
switch(GLevel)
if(1) A_GML1+=M.key
if(2) A_GML2+=M.key
if(3) A_GML3+=M.key
if(4) A_GML4+=M.key
if(5) A_GML5+=M.key

spawn(1)M.RemoveGM()
spawn(15)M.AdminLoad(GLevel)
return


Game_Admin/verb
In response to Shayvguy1222
Put it inside the tags <"dm">(to start) - <"/dm">(to end).

//this is how a code would look inside of those tags


In response to Shayvguy1222
NEVER use goto. This is a fairly simple code and goto has NO place here. "Yes" appears very many times in this code. You are confusing the compiler by using goto. Instead of using goto you could just continue your code inside of the if statement.
In response to Bobomaster
I've found the goto() proc to be quite useful when I can't find a way to do a loop using spawn(), for(), or while().
In response to Mizukouken Ketsu
[link] and others. You should almost always be able to get by without using goto.
In response to Jon88
Error - "Unable to find message."
In response to Jon88
Jon88 wrote:
ID:66034

Is that so? >.>
But yeah, goto should be avoided in favor of the much cleaner looping constructs that don't create spaghetti code that keeps jumping all over the place, is fugly and hard to get around in.
In response to Mizukouken Ketsu
Mizukouken Ketsu wrote:
Error - "Unable to find message."

Sorry. My copy & paste missed the last digit off of the post ID number. It's fixed now. There's lots of posts in the forums on the subject, some explain the idea better than others too.
In response to Jon88
Someone plzzz tell me the right code so i can fix my game.
i want to run my game and cuz the demote dont work i cant run my game.

plzz tell me the code so i can start to run my game.