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
 
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).
 
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)
 
looking at the jass file when trying to understand vjass code (that is vjass code) is not gong to help you =P
 
It looks quite strange but i all ways learned(i learnt PHP this way) best with looking real examples
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      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