• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Script Not Working

Status
Not open for further replies.
Level 1
Joined
Feb 7, 2006
Messages
4
JASS:
function checkname takes nothing returns boolean
  if StringCase(GetPlayerName(GetTriggerPlayer()), true) == "doubledota" then
    return true
  endif
    return false
endfunction

function chatcheckone takes nothing returns boolean
  if StringCase(GetPlayerName(GetTriggerPlayer()), true) == "doubledota" then
    return true
  endif
  if StringCase(GetPlayerName(GetTriggerPlayer()), true) == "cody8d" then
    return true
  endif
  if StringCase(GetPlayerName(GetTriggerPlayer()), true) == "bunkwithme" then
    return true
  endif
  if StringCase(GetPlayerName(GetTriggerPlayer()), true) == "worldedit" then
    return true
  endif
  call DisplayTextToForce(GetPlayersAll(), "This is the error")
    return false
endfunction

function chatchecktwo takes nothing returns boolean
  if SubString(GetEventPlayerChatString(),1,5) == "-game" then
    return true
  endif
  call DisplayTextToForce(GetPlayersAll(), "This is the error")
    return false
endfunction

function chatcheck takes nothing returns boolean
  return GetBooleanAnd(chatcheckone(),chatchecktwo())
endfunction

function gamechat takes nothing returns nothing
local string msg = SubString(GetEventPlayerChatString(), 7, StringLength(GetEventPlayerChatString()))
  call DisplayTextToForce(GetPlayersAll(), "|cFFFF8000"+GetPlayerName(GetTriggerPlayer())+" says:|r "+msg) 
endfunction
   

function Trig_Admins_Actions takes nothing returns nothing
  call SetPlayerColor(GetTriggerPlayer(), PLAYER_COLOR_AQUA)  
endfunction

//===========================================================================
function InitTrig_Admins takes nothing returns nothing
local trigger chat
local integer i
    set chat = CreateTrigger()
    set i=0
    set gg_trg_Admins = CreateTrigger(  )
    loop
      exitwhen i>12
      call TriggerRegisterPlayerChatEvent(gg_trg_Admins, Player(i), "-color", true)
      call TriggerRegisterPlayerChatEvent(chat, Player(i), "-game", false)
      set i=i+1
    endloop
    call TriggerAddCondition(gg_trg_Admins, Condition(function checkname))
    call TriggerAddAction( gg_trg_Admins, function Trig_Admins_Actions )
    call TriggerAddCondition(chat, Condition(function chatcheck))
    call TriggerAddAction(chat, function gamechat)
endfunction

My friends weren't able to use the command and when I set the name to "Worldedit", it still didn't work. I tried to see what was happening and it was the booleans. I didn't know where to go from there so please assist. Thanks.

~Spiky
 
Level 2
Joined
May 31, 2007
Messages
20
I think the problem lies here:
JASS:
SubString(GetEventPlayerChatString(),1,5) == "-game"
I think you converted it from GUI to JASS, because the BJ function use SubString(string,Starting-1,Ending).
Change the 1,5 to 0,5 then the command should be recognized correct.
 
Last edited:
Status
Not open for further replies.
Top