Jump to content

Photo
- - - - -

= nil?


  • Please log in to reply
8 replies to this topic

#1 PreedSwe

PreedSwe

    Corporal

  • Members
  • 78 posts

Posted 29 March 2012 - 15:47

Are there any other ways to destroy variables other than = nil?
The reason I ask is that certain badly coded cheats(darky etc) do crap like nil = "point/to/script.sqf";
Which when someone comes on the server using that shit, causes more destruction to the running mission than the actual bloody cheat itself by starting to point variables to scripts and crap..

Is it maybe possible to do this?
In init.sqf
myownnil = nil;
Then use destroythisvariable = myownnil;
without myownnil being affected in case nil gets overwritten?

/ Preed

#2 gammadust

gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

Posted 29 March 2012 - 17:33

I never come across this issue, could you provide a reproducible example were the variable is overwriten? This looks like something one should be aware.

i think i seen before a handle to a script named nil and variable destruction mixed without observing any overwrite...

(afaik there is no other way to destroy a variable)

#3 Xeno

Xeno

    ACE Team Leader

  • Members
  • 1814 posts

Posted 29 March 2012 - 18:13

Is it maybe possible to do this?
In init.sqf
myownnil = nil;
Then use destroythisvariable = myownnil;
without myownnil being affected in case nil gets overwritten?

Not possible. Once a global variable named nil "overwrites" the game engine nil its gone.

@gammadust
nil = execVM "bla.sqf";
somevar = nil;
if (isNil "somevar") then {... // does not work anymore, somevar is not nil but contains the handle of the execVM

Xeno

Edited by Xeno, 29 March 2012 - 18:25.

[SIZE=1][/SIZE]

#4 gammadust

gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

Posted 29 March 2012 - 19:08

well, thanks to keep this in mind will save some headaches...

indeed the nil article at the wiki mentions this:

Never ever assign a value to nil!
Doing so creates a global variable with the same name that overrides the "command" nil:

foo = "foo";
nil = "bar";
foo = nil;
hint foo; // displays "bar"



#5 PreedSwe

PreedSwe

    Corporal

  • Members
  • 78 posts

Posted 29 March 2012 - 22:00

So... A) For what reason is it possible to overwrite nil? I mean, you cant overwrite /dev/null... This seems stupid...
B) Is there really no other way to destroy a variable, other than use this flawed method?

#6 gammadust

gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

Posted 07 April 2012 - 16:39

Well, engine's idiosyncrasies. Being aware of it allows you to prevent to bump into it. In regards to what is off one's control (scripts which assign anything to that command in bad practice), at the lack of better solution, you're left with modifying them to suit your needs.

maybe this will give you a hint about why engine works that way:

I did some testing. I think this command should be spelled "nill". "nil" does nothing, while "nill" deletes the variable. This spelling mistake has been around since the OFP scripting reference. --Maddmatt 15:43, 29 September 2007 (CEST)

Are you sure? This works fine:

AVAR="A" ; AVAR=Nil ; Hint Format ["Var %1 IsNil %2",AVAR,IsNil "AVAR"];
UNN 20:54, 29 September 2007 (CEST)
nil is correct. There is nothing like nill. (Because of the way Void values are handled nill may appear to be working, because it is handled as undefined variable) --Suma 22:45, 29 September 2007 (CEST)

here

we'll have to make do :)

#7 PreedSwe

PreedSwe

    Corporal

  • Members
  • 78 posts

Posted 07 April 2012 - 19:02

I can avoid messing that up personally, its those useless programmers that make hacks/cheats that mess it up(darky etc).. So when someone with darky comes on our server, the mission gets fucked up...

#8 gammadust

gammadust

    Master Gunnery Sergeant

  • Members
  • 1056 posts

Posted 07 April 2012 - 19:20

are they bypassing server signature checks or smtg?

I am totaly newb in regards to running a server, but this and this maybe worthwhile.

best luck dealing with those griefers.

#9 PreedSwe

PreedSwe

    Corporal

  • Members
  • 78 posts

Posted 07 April 2012 - 21:00

We are using v2 signatures already.. But there are some hacks apparently that can bypass it.. Not sure if darky is still being developed though.