I was fooling around with JJ's cheat pack, and I changed the activator in end globals and not in locals, and...well, it made a problem, but I tested something and...well, look for yourself.
function CheatUse takes nothing returns nothing
local player p2p=GetTriggerPlayer()
if SubString(GetEventPlayerChatString(),0,4)=="-Sahasralah"then
call TriggerRegisterPlayerChatEvent(CHEATS,p2p,"-",false)
call DisplayTimedTextToPlayer(p2p,0,0,10,"|cff00BFFFJJ|r |cff00BFBARules!")
endif
set p2p=null
endfunction
There's the activator. Here's the locals.
local player p
local unit u
local integer JS
local integer aBd
local version v
local integer k7
local integer i
local integer zzz=0
loop
exitwhen zzz>11
call TriggerRegisterPlayerChatEvent(ICHEAT,Player(zzz),"-Bartimaeus",false)
set zzz=zzz+1
endloop
call TriggerAddAction(ICHEAT,function CheatUse)
call TriggerAddAction(CHEATS,function DirectCheat)
And I tested it, only for it not to work, and than I looked at my jass pack, to see the
"call TriggerRegisterPlayerChatEvent(ICHEAT,Player(zzz),"Bartimaeus",false)
and since they both required to be typed in the same message, I typed -Bartimaeus -Sahasralah, only to smack myself on the head because I remembered that the activator has to be typed first, so I typed -Sahasralah -Bartimaeus, and for some reason, it said "JJ Rules!", and somehow I seriously doubted the cheats would work, but I typed in -gold 500000 and my gold went up. I just found it odd - and I saw that instead of making the activator have the full message, you can make the local have the full activator, and it'll work the same - I tested this right after and it worked. It also works if contain the other half of the message, such as -lol for the activator and 111 for the local, and it'll work if you put them together. It can throw people off who are looking through the jass file and are looking for PlayerChatEvent instead of at the locals. I just thought I would mention this, because it struck me odd. So now my activator is -JJ(space) and my local is 1337, and it works - but if you don't type the 1337 after it, it doesn't. Did anyone else know about this..? lol, because I didn't. If I'm a dummy, please say so. lol XD
Look at this, O.o
Moderator: Cheaters
-
- Tyrannical Drama Queen
- Posts: 4445
- Joined: November 19th, 2007, 5:05 am
- Been thanked: 2 times
-
- Forum Staff
- Posts: 829
- Joined: January 28th, 2007, 8:10 pm
- Title: JASS Programmer
- Location: Canada
Re: Look at this, O.o
Lol...my cheatpack with a few cheats added =PJJ's cheat pack
Euhm..just a few comments on this.
Code: Select all
if SubString(GetEventPlayerChatString(),0,4)=="-Sahasralah"then
The reason is that the longest string that SubString("Any String",0,4) can return is a string with a length of 4.
A string with length 4 can never be "-Sahasralah".
Now, if I assume that the 4 there is an error and is really an 11, I can explain why this works...
Code: Select all
call TriggerRegisterPlayerChatEvent(ICHEAT,Player(zzz),"-Bartimaeus",false)
Therefore, the cheats will activate as long as the first 11 letters of the string are "-Sahasralah" and the string contains "-Bartimaeus".
Nothing special here--don't know what you're trying to get at.
-
- Tyrannical Drama Queen
- Posts: 4445
- Joined: November 19th, 2007, 5:05 am
- Been thanked: 2 times
Re: Look at this, O.o
Yes, it's suppose to be an eleven, I probably messed that up after I was editing it.Aero wrote:Lol...my cheatpack with a few cheats added =PJJ's cheat pack
Euhm..just a few comments on this.This if statement will ALWAYS return false.Code: Select all
if SubString(GetEventPlayerChatString(),0,4)=="-Sahasralah"then
The reason is that the longest string that SubString("Any String",0,4) can return is a string with a length of 4.
A string with length 4 can never be "-Sahasralah".
Now, if I assume that the 4 there is an error and is really an 11, I can explain why this works...
All this means is that the player has to type "-Bartimaeus" anywhere in a chat string.Code: Select all
call TriggerRegisterPlayerChatEvent(ICHEAT,Player(zzz),"-Bartimaeus",false)
Therefore, the cheats will activate as long as the first 11 letters of the string are "-Sahasralah" and the string contains "-Bartimaeus".
Nothing special here--don't know what you're trying to get at.
I was trying to get at that if you simply have -Sahasralah, and they type it, but the local is an entirely different thing, it won't activate, meaning a simple "PlayerChatEvent" search in JASSCraft for noobies (such as I) won't reveal the actual activator, which is what people tend to do.
-
- Forum Staff
- Posts: 829
- Joined: January 28th, 2007, 8:10 pm
- Title: JASS Programmer
- Location: Canada
Re: Look at this, O.o
Oh, I see what you mean.
I always check the action though the minute I see this:
I always check the action though the minute I see this:
But for everyday joe, it's probably useful.call TriggerRegisterPlayerChatEvent(ICHEAT,Player(zzz),"-Bartimaeus",false)