Function to crash people?

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Spiky
Newcomer
Posts: 5
Joined: July 2nd, 2007, 5:51 pm

Function to crash people?

Post by Spiky »

I was looking all over and I couldn't find it.

What is the JASS code to crashing players 1-12?
Bushido

Re: Function to crash people?

Post by Bushido »

try to post in the right section okay? ;)
[Moved]
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Function to crash people?

Post by Aero »

function CrashPlayer takes player p returns nothing
local integer i=0
if GetLocalPlayer()==p then
set i=-1
call ExecuteFunc("") //For good measure
endif
call Player(i)
endfunction

to use --> call CrashPlayer( <Player> ) (Player argument)

function CrashPlayer takes integer i returns nothing
local player p=Player(i-1)
local integer i=0
if GetLocalPlayer()==p then
set i=-1
call ExecuteFunc("")
endif
call Player(i)
set p=null
endfunction

to use --> call CrashPlayer( <#> ) (1-12)
Spiky
Newcomer
Posts: 5
Joined: July 2nd, 2007, 5:51 pm

Re: Function to crash people?

Post by Spiky »

what is "call player(i)" for?
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Function to crash people?

Post by Aero »

Don't worry about it; just accept that it works.

Though, if you think about it, it's easy to understand.
Spiky
Newcomer
Posts: 5
Joined: July 2nd, 2007, 5:51 pm

Re: Function to crash people?

Post by Spiky »

Aero wrote:Don't worry about it; just accept that it works.

Though, if you think about it, it's easy to understand.
Please do explain, I'd like to understand the JASS code I read. What's the point of calling that native? Also, why ExecuteFunc("")? Isn't that considered null and wastes space?
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Function to crash people?

Post by Aero »

1. Takes a player argument
function CrashPlayer takes player p returns nothing

2. Declares an integer into memory (0)
local integer i=0

3. A decision statement...If the player p (The one indicated by the argument) 's computer is the one who runs this piece of code, then do the following...else (There is no else so everyone besides the player's p computer will jump to the endif and the player p's computer will run the script inside it)
(GetLocalPlayer() refers to the computer executing the script (local). This will return a different player for each user (Themselves). So if 'p' is player 1 and player 2's computer runs this...the computer will go "GetLocalPlayer() --> That's me!", I am not equal to 'p' (Player 1) therefore skip to endif. Now if player 1 runs this... Player 1's computer goes "GetLocalPlayer() --> That's me!" and yep, I'm player 1! Lets do what's inside this 'if' statement.)
if GetLocalPlayer()==p then

4. Set i to -1 (Note: only player p's computer will be doing this)
set i=-1

5. Execute a non-existant function (This will crash wc3...but since ONLY player p's computer is running this code, only p will crash. Normally calling Player(-1) will suffice but there's counter measures one can take against this...)
call ExecuteFunc("") //For good measure

6. endif
endif

7. Calls the function Player. The integer 'i' allocated into memory by everyone's computer will be equal to 0, except for p, for which it will be -1.
Player(0) is ok to call.
Player(-1) will crash.

The result? Everyone is ok except for p (who will crash because 'i' for him is -1 and when his wc3 goes to run that...kaboom)
call Player(i)

8. Endfunction
endfunction
User avatar
weirdone2
Forum Staff
Posts: 926
Joined: June 3rd, 2007, 8:03 pm

Re: Function to crash people?

Post by weirdone2 »

They both don't exist and since their is nothing to handle that type of error in the game it says wtf major we gotta a problem here, this bombs pin is missing. (boom)
initialD
Some Honorary Title
Posts: 1713
Joined: June 8th, 2007, 5:08 am
Title: Angry Bird

Re: Function to crash people?

Post by initialD »

it will crash all players if the cheater insert an invalid player i, right?
if someidiot insert an i which is >12 , all will crash, right?

good job, campared to xantan's -crash which is extremely leaky.
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Function to crash people?

Post by Aero »

Player(>16) is invalid but I think it only returns null, not crashes.
I have yet to test this.
Maybe someone could verify for me?