Jump to content

Lua Script Online Upgrade Tutorial . Game Gurdian Lua Script control from your servers .


Recommended Posts

Posted (edited)

Hello guys .

Today I will Show You How to make online upgrade on your lua scripts . Control Your Scripts using your Online servers . there were many questions about it , so watch video , its easy .

here is many website for manage program files and texts . easiest for use is paste bin web site .

Paste bin Web Site link :

https://pastebin.com

This online.lua script link :

https://www.mediafire.com/file/9uuy3f2ji3847eu/%5B_ONLINE_%5D.lua/file

If you have any questions ask me in Comments. 

Edited by TopGEOYT
Posted
13 minutes ago, DESYROLLERSE said:

 

Your example script is wrong.

use this


gg.alert('This script needs to connect to the internet for its proper functioning.')
DESTROYER = gg.makeRequest("write your web address here before executing it.").content
if not Content then
gg.alert('  what happened ???. why did you cancel the script ?. you do not want gems ???. ')
else
pcall(load(DESTROYER))
end

Do not copy and paste. link 👇

DESTROLLER_ONLINE.lua 326 B · 1 download

Wtf ? Why are u talking about copy paste .? I just told u about ur error . 

Also in my script i showed peoples example of make request

Posted
34 minutes ago, DESYROLLERSE said:

Your example script is wrong.

Actually, his example is fine. There is no checks for possible errors, but it works normally as shown in the video.

36 minutes ago, DESYROLLERSE said:

use this


gg.alert('This script needs to connect to the internet for its proper functioning.')
DESTROYER = gg.makeRequest("write your web address here before executing it.").content
if not Content then
gg.alert('  what happened ???. why did you cancel the script ?. you do not want gems ???. ')
else
pcall(load(DESTROYER))
end

And this example is wrong. It won't work at all.

You store "content" field of the table returned by "makeRequest" function in the variable "DESTROYER", but then you check the value of non-existing variable "Content". Non-existing variables in Lua contain special value called "nil", which is evaluated to "false" when used in conditional expressions. Therefore, "not Content" will be always equal to "true". Your example will always show the alert and never execute the line with the call to "load" function.

To fix this mistake, as you have already figured out (I hope), the line

if not Content then

needs to be replaced with

if not DESTROYER then

 

Posted
8 minutes ago, CmP said:

Actually, his example is fine. There is no checks for possible errors, but it works normally as shown in the video.

And this example is wrong. It won't work at all.

You store "content" field of the table returned by "makeRequest" function in the variable "DESTROYER", but then you check the value of non-existing variable "Content". Non-existing variables in Lua contain special value called "nil", which is evaluated to "false" when used in conditional expressions. Therefore, "not Content" will be always equal to "true". Your example will always show the alert and never execute the line with the call to "load" function.

To fix this mistake, as you have already figured out (I hope), the line


if not Content then

needs to be replaced with


if not DESTROYER then

 

@CmP thanks for reply .

If we will replace with destroyer then nil function wont work bcs this destroyer is writen only for "=" funtion  and for pcall.  

Posted
1 minute ago, TopGEOYT said:

If we will replace with destroyer then nil function wont work bcs this destroyer is writen only for "=" funtion  and for pcall.

It will work and also it will check for the value being equal to nil or false.

I am not sure, if this check has a meaning (i.e. if "content" field of the table returned by "makeRequest" function can be nil), but even if it doesn't, the example (with the correction) will still work, just that line with the call to "alert" function will never be executed.

Posted
2 minutes ago, CmP said:

It will work and also it will check for the value being equal to nil or false.

Aa yes yes.  Its work . thank for help . i knowed another way for add nil function or if internet connection isnot turned on message for it , but now i know this method too . thx again

Posted
4 minutes ago, DESTR0LLERSE said:

I'm using my brother's account to answer.

@CmP you speak and you speak and you speak ........

A long time ago the error was corrected.

How to make online script tutorial (#1wapu9s2)

The problem is that I did not have time to correct this one.

why ?????.

I have a restriction to publish content.

and to add: my script never has execution error ... as I stated previously

@TopGEOYT your script is wrong. because when canceling it throws error.

I'm not a programmer and I made them both close their mouths.

imagine if it was a programmer ......

XD

 

[added 3 minutes later]

It is not a valid argument.

you have to think that people will also want to cancel it.

Sh*t.  What ununderstandable? It is simple tutorial . also it isnot my script . 

I tutorial it very long time ago . i domt remember where. Dont think that u wrote this code and nkw u are best .there is better codes for it u may dont know .

Posted
Just now, DESTR0LLERSE said:

the text of the script should not be copied and pasted.

it incorporates symbols that ruin the script.

my script will never throw an error.

prove it with photos or a video.

 

I didnot say anywhere that it throw error. 

U may dont remember that it says CmP xd .

Posted
2 minutes ago, DESTR0LLERSE said:

ur script = error

my script = no error.

I told told that my script is simple variant of make request . also when i told u about ur script error then i told " aa yes it isnot error"

Posted
1 minute ago, TopGEOYT said:

Dont think that u wrote this code and nkw u are best

Don't mind him. Someone who can't admit the mistake he made, who really thinks that he is "closing everyone's mouths" when there are no replies on his absurd statements, who is sure that he "won" every discussion he participated into is not worth the attention of adequate forum members. Such behavior is typical for either kids with some kind of childish outburst or trolls.

Posted
4 minutes ago, CmP said:

Don't mind him. Someone who can't admit the mistake he made, who really thinks that he is "closing everyone's mouths" when there are no replies on his absurd statements, who is sure that he "won" every discussion he participated into is not worth the attention of adequate forum members. Such behavior is typical for either kids with some kind of childish outburst or trolls.

Stop This Psychological Answers Please , becase our fight start about scriping😂

Posted (edited)
19 minutes ago, DESTR0LLERSE said:

the logic says that:

If "a long time ago the error was corrected", then the example that is posted less than 1-2 hours ago would not contain it, but it does. It is posted multiple times and all of the posts contain the mistake I have described.

Such references to "the logic" do not show that you are familiar with it or that you understand it's base principles at all.

Edited by CmP
Posted

Once again, there is a contradiction between your statement and the reality:

1 hour ago, DESYROLLERSE said:

gg.alert('This script needs to connect to the internet for its proper functioning.')
DESTROYER = gg.makeRequest("write your web address here before executing it.").content
if not Content then
gg.alert('  what happened ???. why did you cancel the script ?. you do not want gems ???. ')
else
pcall(load(DESTROYER))
end

 

2 hours ago, DESYROLLERSE said:

use this


gg.alert('This script needs to connect to the internet for its proper functioning.')
DESTROYER = gg.makeRequest("write your web address here before executing it.").content
if not Content then
gg.alert('  what happened ???. why did you cancel the script ?. you do not want gems ???. ')
else
pcall(load(DESTROYER))
end
59 minutes ago, DESTR0LLERSE said:

A long time ago the error was corrected.

You keep repeating that there is "execution error" in @TopGEOYT's script "when cancelling" and that your's example does not have it, but without the correction of what you have called "syntax" your example is meaningless and TopGEOYT's is not. We don't know, have you known about the mistake in your example or not before I have corrected it. Therefore, simple conclusion can be made: your example is worse than TopGEOYT's.

Posted

A review of the example above for anyone who wonders why it works and why one should not code like this.

1 hour ago, DESTR0LLERSE said:

example to execute your script stored on the server.


gg.alert('This script needs to connect to the internet for its proper functioning.')
DESTROYER = gg.makeRequest("link").content
if not DESTROYER then
gg.alert('  what happened ???. why did you cancel the script ?. you do not want gems ???. ')
else
pcall(load(DESTROYER))
end

Second line contains the following code:

DESTROYER = gg.makeRequest("link").content

There are 3 main steps in this code:
  1. "makeRequest" function from "gg" table is called with the corresponding argument.
  2. Result returned by the function is indexed with the key "content".
  3. Value from the step 2 is saved in "DESTROYER" variable.

Then, on the third line there is the following code:

if not DESTROYER then

which checks the condition and executes the code after "then" keyword, if the condition is true. Otherwise, it executes the code after "else" keyword.

To understand, why "one should not code like this", let's review the documentation for "makeRequest" function at GG help. 
https://gameguardian.net/help/classgg.html#ad020d50d3af0a36733e0cbc231055c55

In this case we are interested in the description of the value returned by the function:

Quote

Returns

The table on success, the string on error.

Now, let's get back to the second line of the example.

When function succeeds, the code from the second line behaves as intended. Table returned by the function is indexed with the key "content" and the result of this operation is stored in the variable.

And what happens, when there is an error? String returned by the function is indexed with the key "content" and the value is stored in the variable. By default, there is no meaning of indexing string with a key and luckily for the example, the value returned by such operation is nil. But this behavior is not obvious and not obvious behavior may often lead to errors.

Then how can the example be modified to avoid non-obvious behavior?

The result of the call to "makeRequest" function should be saved to a variable. Then the type of the variable should be checked. If it is "table", the function has succeeded, the variable can be indexed with the key "content" and the result of this operation can be stored in another variable. And if it is "string", then an error occurred, the contents of the variable can be printed to log (via "print" function) and/or shown to the user (via "alert" function).

Example to illustrate the answer above:

local functionResult = gg.makeRequest('link')
local content
if type(functionResult) == 'table' then
  content = functionResult.content
elseif type(functionResult) == 'string' then
  -- print/alert error description
end
-- other actions

Such modification to the code explicitly shows which actions will be performed and when (function succeeds / function fails) getting rid from non-obvious behavior.

  • 2 weeks later...
Posted
On 3/15/2019 at 6:41 PM, TopGEOYT said:

If you have any questions ask me in Comments. 

How to make an script Download another script(show tutorial plz)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.