-stolka- Posted September 28, 2013 Posted September 28, 2013 the debugscript reports bad argument for the bindKey function.. function showArrest ( playerSource ) local arrest = getAccountData(playeraccount, "arrest") if not arrest then outputChatBox("you dont have any arrest",playerSource) else outputChatBox("arrest: "..arrest,playerSource) accountN = getAccountName(playeraccount) triggerClientEvent( "onArrestRequest",playerSource, arrest, accountN ) end end addCommandHandler ( "arrest", showArrest ) bindKey ( playerSource, "m", "down", showArrest) CAOS RP SKYPE: stolka.caosrp CONNECT to CAOS RP
Castillo Posted September 28, 2013 Posted September 28, 2013 That's because the function bindKey when used server-side, it requires a player element, and 'playerSource' is obviously nil in your script. addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do bindKey ( player, "m", "down", showArrest ) end end ) addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, "m", "down", showArrest ) end ) function showArrest ( playerSource ) local playeraccount = getPlayerAccount ( playerSource ) local arrest = getAccountData ( playeraccount, "arrest" ) if ( not arrest ) then outputChatBox ( "you dont have any arrest", playerSource ) else outputChatBox ( "arrest: ".. arrest, playerSource ) local accountN = getAccountName ( playeraccount ) triggerClientEvent ( playerSource, "onArrestRequest", playerSource, arrest, accountN ) end end addCommandHandler ( "arrest", showArrest ) As you can see, I binded the key when the player joins and when the resource starts ( to bind it for everyone ). Also, "playeraccount" was not defined, you had to get the account with getPlayerAccount. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-stolka- Posted September 28, 2013 Author Posted September 28, 2013 thanks CAOS RP SKYPE: stolka.caosrp CONNECT to CAOS RP
Castillo Posted September 28, 2013 Posted September 28, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now