Help from some JASS Pro

kingW3

New Member
Reaction score
0
Hi,i was wondering about some maps jass to learn a bit i found this
Code:
function skins___OnChat takes nothing returns boolean
local integer p=GetPlayerId(GetTriggerPlayer())
local string str=GetEventPlayerChatString()
local unit oldUnit
local boolean selected=false
local timer t
if SubString(str,0,1)=="#" and s__PlayerStruct_skin[players[p]]==SKIN_READY then
set str=SubString(str,1,StringLength(str))
if(not skins___skinCheat[skins___skinId[p]])and(not SetNumString(num_data,str))then
call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cffff0404Invalid code!|r")
set s__PlayerStruct_skin[players[p]]=SKIN_FAILED
return false
endif
if not skins___skinCheat[skins___skinId[p]]then
call SetNumString(num_mod,skins___skinModulo[skins___skinId[p]])
call SetNumString(num_pub,skins___skinPublic[skins___skinId[p]])
call PowNumMod(num_res,num_data,num_pub,num_mod)
call SetNumString(num_code,gameCode)
endif
if skins___skinCheat[skins___skinId[p]]or NumEqual(num_res,num_code)then
call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cff20c000Login successful!|r")
set s__PlayerStruct_skin[players[p]]=SKIN_OK
if s__PlayerStruct_side[players[p]]==SIDE_HUMAN and s__PlayerStruct_main[players[p]]!=null then
set oldUnit=s__PlayerStruct_main[players[p]]
set selected=IsUnitSelected(oldUnit,Player(p))
if GetLocalPlayer()==Player(p)and selected then
call SelectUnit(oldUnit,false)
endif
call ShowUnit(oldUnit,false)
set s__PlayerStruct_main[players[p]]=CreateUnit(Player(p),skins___skinUnit[skins___skinId[p]],GetUnitX(oldUnit),GetUnitY(oldUnit),GetUnitFacing(oldUnit))
if GetLocalPlayer()==Player(p)and selected then
call SelectUnit(s__PlayerStruct_main[players[p]],true)
endif
set t=CreateTimer()
call SaveUnitHandle(libHandleVars___ht,GetHandleId((t)),(HASH_ATTACH0),(s__PlayerStruct_main[players[p]]))
call SaveUnitHandle(libHandleVars___ht,GetHandleId((t)),(HASH_ATTACH1),(oldUnit))
call TimerStart(t,.0,false,function skins___FixUnitState)
set t=null
set oldUnit=null
endif
else
call DisplayTimedTextToPlayer(Player(p),0,0,10,"|cffff0404Login failed!|r")
set s__PlayerStruct_skin[players[p]]=SKIN_FAILED
endif
endif
return false
endfunction
And i wasn't sure what it is a cheat or something,could be cool if you could explain me what he did there and what it is also about this
Code:
function skins___OnInit takes nothing returns nothing
local integer i=0
local integer j
local trigger trgEsc=XCreateTrigger()
set skins___trgChat=XCreateTrigger()
set gameCode=RandomKey()
call skins___RegisterSkin("7336",'h00Y',"91","46F623B45D26A0C15F462CEB321DEF55")
loop
exitwhen i>11
set skins___skinId[i]=-1
set skins___boxes[i]=null
set j=0
loop
exitwhen j>=skins___numSkins
if StringCase(s__PlayerStruct_name[players[i]],false)==skins___skinName[j]then
set s__PlayerStruct_skin[players[i]]=SKIN_ALLOW
set skins___skinId[i]=j
set j=skins___numSkins
endif
set j=j+1
endloop
if skins___boxes[i]==null then
set skins___boxes[i]=CreateUnit(Player(i),'oVis',640,-2368,0)
endif
set i=i+1
endloop
endfunction
PS h00y is the hero/unit code and 7336 is a name what it provided(the register skin) also could you tell me how to add more skins?
Code:
function skins___RegisterSkin takes string name,integer skin,string publicKey,string modulo returns nothing
set skins___skinName[skins___numSkins]=StringCase(name,false)
set skins___skinUnit[skins___numSkins]=skin
set skins___skinPublic[skins___numSkins]=publicKey
set skins___skinModulo[skins___numSkins]=modulo
set skins___skinCheat[skins___numSkins]=false
set skins___numSkins=skins___numSkins+1
endfunction
function skins___RegisterSkinCheat takes string name,integer skin returns nothing
set skins___skinName[skins___numSkins]=StringCase(name,false)
set skins___skinUnit[skins___numSkins]=skin
set skins___skinPublic[skins___numSkins]=""
set skins___skinModulo[skins___numSkins]=""
set skins___skinCheat[skins___numSkins]=true
set skins___numSkins=skins___numSkins+1
endfunction
Here is whole .j file hope you can help http://www.mediafire.com/?o1kpwvoz1dqqn97
 

Nestharus

o-o
Reaction score
84
Looks like you ripped this out of a map's JASS file, meaning that I assume you don't have WE NewGen since the map doesn't look like it was protected at all (as the code isn't optimized with short var names).
 

kingW3

New Member
Reaction score
0
I don't have it you're right,but i didn't create this map.The original author left it unprotected(anyway i'm not here to steal it or anything i just want to learn jass a bit and understand the above code)
 

Nestharus

o-o
Reaction score
84
looking at the jass file when trying to understand vjass code (that is vjass code) is not gong to help you =P
 

kingW3

New Member
Reaction score
0
It looks quite strange but i all ways learned(i learnt PHP this way) best with looking real examples
 

Nestharus

o-o
Reaction score
84
that code won't help you because it's not a real example... that code is vjass translated into jass.


The author of the map didn't actually write this line out
[ljass]if not skins___skinCheat[skins___skinId[p]]then[/ljass]

the line they wrote was entirely different. The line they wrote was translated into the above line by jasshelper.

The line they wrote was probably this
[ljass]if not (p.skinId.skinCheat) then[/ljass]
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top