Jump to content

How can I check serial?


IIYAMA

Recommended Posts

  • Moderators
Posted
function onChat ( message, messageType ) 
        local theSerial = getPlayerSerial( source ) 
        if theSerial == "A48ABXD5945E4AB2EB0BF8BDD486E54994"  then 
        killPlayer(source, source) 
        end 
end 
addEventHandler ( "onPlayerChat", root, onChat ) 

I tryed this above:

I wanna check players their serial.

But I don't get an error or something..... if any player in the server write something, he will die....

Only the player with X serial must be killed.

(this is just a sample. btw fake serial) :)

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
addEventHandler ( 'onPlayerChat', root, 
    function ( ) 
        if ( getPlayerSerial ( source ) == 'A48ABXD5945E4AB2EB0BF8BDD486E54994' ) then 
            killPed ( source ) 
        end 
    end 
) 

Maybe this work.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

  • MTA Team
Posted
function onChat ( message, messageType ) 
        local theSerial = tostring(getPlayerSerial( source )) 
        if theSerial == "A48ABXD5945E4AB2EB0BF8BDD486E54994"  then 
        killPlayer(source, source) 
        end 
end 
addEventHandler ( "onPlayerChat", root, onChat ) 

Posted

Noddy, getPlayerSerial already returns a string. I think you don't need to convert. And killPlayer is deprecated.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted
local serials = 
    { 
        [ "A48ABXD5945E4AB2EB0BF8BDD486E54994" ] = true, 
    } 
  
function onChat ( message, messageType ) 
    local theSerial = getPlayerSerial ( source ) 
    if ( serials[ theSerial ] ) then 
        killPed ( source, source ) 
    end 
end 
addEventHandler ( "onPlayerChat", root, onChat ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Moderators
Posted

ah thx guys :D

= true 

is this needed? what is the function of it?

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

index with boolean value "true" as data will be "parsed", "false" will not be "parsed".

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

  • Moderators
Posted (edited)
index with boolean value "true" as data will be "parsed", "false" will not be "parsed".

>

If I put them at false (arround 3 serial)

Than they all need to be correct, bevore the next step?

---------------------------------------------------------------------

No. If you put all with false value, will be like there are no serials equal to the player's serial.

It has the same result as this?

>

if not ( getPlayerSerial ( source ) == 'A48ABXD5945E4AB2EB0BF8BDD486E54994' ) then

end

>

Edited by Guest

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

No. If you put all with false value, will be like there are no serials equal to the player's serial.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

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...