cheats disabled if "player x" is playing???

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

User avatar
Vegas
Shopping Maul USA Creator
Posts: 1797
Joined: January 18th, 2007, 11:07 am
Title: No Comment
Location: Calgary Canada
Has thanked: 88 times
Been thanked: 8 times

cheats disabled if "player x" is playing???

Post by Vegas »

Hey all. I was thinking of implementing a cheat or 2 into some maps, but i dont like to use them myself (the cheats). What line can I slap into the jass to say, If player "X" is playing, then disable all the cheats?

This way, the peeps can enjoy all the cheats they want, but when I play, I get to enjoy the fairness.
User avatar
JJ2197
Legendary Genius
Posts: 1311
Joined: August 8th, 2007, 8:10 am
Title: Legendary Genius²
Location: St. George Utah

Re: cheats disabled if "player x" is playing???

Post by JJ2197 »

Hmm not sure how to do that (probably have to do with GetPlayerName)
But I know how to make it so if you say "-disable" cheats don't work... =/

For instances in areo's/Dekar's/mine
it would go like:
if SubString(s,0,8)=="-disable"then
call DisableTrigger(CHEATS)
Computer Specs:
Motherboard: GA-990FXA-UD3
CPU: FX-8350 @ 4.0GHz
PSU: Corsair CX500
RAM: G.Skill Ripjaws X 8GB @ 1866
GPU: Radeon HD 4870 1GB
HDD: OCZ Vertex series 30GB SSD
Case: Antec 900
Monitor: Toshiba 32"
OS: Windows 7 Ultimate
HINDYhat
Senior Member
Posts: 101
Joined: June 1st, 2007, 9:05 pm

Re: cheats disabled if "player x" is playing???

Post by HINDYhat »

Something like this.

Code: Select all

function AreYouInTheGamelawl takes nothing returns boolean
    local integer i=0
    loop
        exitwhen i>12
        if GetPlayerName(Player(i))=="Vegas" then
            return true
        endif
        set i=i+1
    endloop
    return false
endfunction
And you could run that function, if it retruns true, then you disable the cheat triggers.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: cheats disabled if "player x" is playing???

Post by Aero »

Should be...

exitwhen i>11 (Who is Player(12) ? )

And, it's better like this imo

Code: Select all

function AreYouInTheGamelawl takes nothing returns nothing
    local integer i=0
    loop
        exitwhen i>11
        if GetPlayerName(Player(i))=="Vegas" then
            call DisableTrigger(....CheatTriggerHere)
            return
        endif
        set i=i+1
    endloop
endfunction
To use, simply do

'call AreYouInTheGamelawl()' in Map Initialization or whenever it's to be checked.
User avatar
Vegas
Shopping Maul USA Creator
Posts: 1797
Joined: January 18th, 2007, 11:07 am
Title: No Comment
Location: Calgary Canada
Has thanked: 88 times
Been thanked: 8 times

Re: cheats disabled if "player x" is playing???

Post by Vegas »

Ah, thanks guys. will give it a try then for one of my upcoming maps.