Jump to content

[HELP]serial function


DiGiTal

Recommended Posts

Posted

function msg()
local x = getPlayerSerial(getLocalPlayer())
if x == 633DB08BE0185007B57225507C51C3A2 then
print"works"
print(x)
else 
print "don't works"
end
end
addEventHandler( "onClientResourceStart", root, msg )

I'm starting in scripting, those days i creating simple scripts. but this no error nothing.

Explaine:If the console see the serial = x then it send a msg to the player

Posted
function msg()
	local x = getPlayerSerial(getLocalPlayer())
	if x == "633DB08BE0185007B57225507C51C3A2" then
		print("works")
		print(x)
	else 
		print("don't works")
	end
end
addEventHandler("onClientResourceStart", root, msg)

You should read tutorials about programming before trying it out. The getPlayerSerial function returns a string, so you have to compare it with a string. Print is a function, calling functions are done by using parenthesis.

  • Thanks 1
Posted

Note: The client side version of getPlayerSerial has been deprecated as it can return the wrong value for some players, and is potentially insecure. The following article assumes that the function is serverside only.

  • Thanks 1
Posted
21 minutes ago, NeXuS™ said:

Yes, it does ASSUME, you can still use it on client-side as far as I know.

 

On 11/18/2016 at 01:59, </Mr.Tn6eL> said:

 

Server


function serial( )
    if eventName == "onResourceStart" then
        for k, v in ipairs(getElementsByType("player")) do
            setElementData(v, "serial", getPlayerSerial(v))
        end
    else
        setElementData(source, "serial", getPlayerSerial(source))
    end
end
addEventHandler("onResourceStart", resourceRoot, serial)
addEventHandler("onPlayerJoin", root, serial)

 

Client


_getSerial = getPlayerSerial
function getPlayerSerial(p)
	return (isElement(p) and getElementType(p) == "player") and getElementData(p, "serial") or _getSerial()
end

 

 

  • Thanks 1
Posted

You don't need to add that useless code, if you don't want to handle some really secure thing on client-side.

Quote

Executing client-side command: outputChatBox(getPlayerSerial(localPlayer))
73B520027203B67334**************

It works on client-side aswell, it MAY return a value which is not the real value, depending if it's a faked serial on client-side or not.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...