Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. -- server side: addCommandHandler ( "ps1", function ( plays_1 ) if isAccountInGroup ( { "Owner", "Admin" }, getAccountName ( getPlayerAccount ( plays_1 ) ) ) then setTimer ( triggerClientEvent, 1000, 1, "playASound", root, "sounds/sound_1.mp3" ) else outputChatBox ("[info]: You have no acces to that command.", plays_1 ) end end ) function isAccountInGroup ( groups, account ) local theGroup = false for _, group in ipairs ( groups ) do if isObjectInACLGroup ( "user.".. account, aclGetGroup ( group ) ) then theGroup = group break end end return theGroup end -- client side: addEvent ( "playASound", true ) addEventHandler ( "playASound", root, function ( path ) playSound ( path ) end )
  2. Yes, the method you were using wasn't safe.
  3. Castillo

    Problem

    function mensagemEvento ( thePlayer ) -- You forgot to defien 'thePlayer' local accountname = getAccountName ( getPlayerAccount ( thePlayer ) ) if (isObjectInACLGroup ( "user.".. accountname, aclGetGroup ( "Admin" ) )) then outputChatBox ( "#00FFFFUm To Enter the Event write /participar in chat", getRootElement(), 255, 0, 0, true ) end end addCommandHandler ( "eventodeagle", mensagemEvento ) -- This has to go after you close the function with the 'end' Read comments.
  4. function submitReg ( ) local firstserial = getPlayerSerial ( source ) local moneys = getPlayerMoney ( source ) local data = dbPoll ( dbQuery ( server, "SELECT money FROM accounts WHERE serial = ?", firstserial ), - 1 ) if ( type ( data) == "table" and #data > 0 ) then dbExec ( server, "UPDATE accounts SET money = ? WHERE serial = ?", moneys, firstserial ) else dbQuery ( server, "INSERT INTO accounts ( serial, money ) VALUES ( ?, ? )", tostring ( firstserial ), tostring ( moneys ) ) end end addEventHandler ( "onPlayerQuit", root, submitReg )
  5. I think that "??" is used for column and table names and "?" is used for values.
  6. What do you mean by "not back"?
  7. What do you mean by "save the serial as nil"? the setMoney function is meant to load the money, so how can it "save the serial"?
  8. What are you trying to do?
  9. Didn't you check the topic creation date? it was two years ago!
  10. Place all of three scripts in a single .lua file and rename function names.
  11. Castillo

    MySQL

    If you are using it without a loop, then you need to include the [ 1 ] before the column name from which you wish to obtain it's value, this "1" represents the index.
  12. Castillo

    MySQL

    local query = dbQuery ( handler, "SQL STRING HERE" ) local data = dbPoll ( query, - 1 ) -- -1 = wait for the result, freezes server until it has the result. if ( type ( data ) == "table" ) then print ( data [ 1 ].myColumnName ) end
  13. local money = { [ 1 ] = math.random ( 150, 400 ), [ 2 ] = math.random ( 400, 600 ), [ 3 ] = math.random ( 600, 800 ), [ 4 ] = math.random ( 800, 1000 ), [ 5 ] = math.random ( 800, 1000 ), [ 6 ] = math.random ( 800, 1000 ), } addEventHandler ( "onPlayerDamage", getRootElement(), function ( attacker, weapon, bodypart, loss ) givePlayerMoney ( attacker, money [ 1 ] ) end )
  14. local money = { [ 1 ] = math.random ( 150, 400 ), [ 2 ] = math.random ( 400, 600 ), [ 3 ] = math.random ( 600, 800 ), [ 4 ] = math.random ( 800, 1000 ), [ 5 ] = math.random ( 800, 1000 ), [ 6 ] = math.random ( 800, 1000 ), } addEventHandler ( "onPlayerDamage", getRootElement(), function ( attacker, weapon, bodypart, loss ) givePlayerMoney ( attacker, money [ math.random ( #money ) ] ) end ) That's what you wanted?
  15. function VIPMENUTRIGGER ( thePlayer , commandName ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "VIP" ) ) then triggerClientEvent ( thePlayer, "VIPSuccess", thePlayer ) else outputChatBox ( "VIP deilsin!!Vip icin : [url=http://www.yvgaming.de]www.yvgaming.de[/url] ye git!", thePlayer ) end end addCommandHandler ( "vip", VIPMENUTRIGGER )
  16. http://pastebin.com/cbvvR57a
  17. bindKey server side has a player argument, bind the key when the player joins ( onPlayerJoin event ).
  18. You added a extra "5". gs1 = createObject ( 975, 2522.8999023438, -1722.1999511719, 13.39999961853, 0, 0, 179.74182128906 ) function gateOpen ( ) moveObject ( gs1, 5000, 2515.3999023438, -1722.1999511719, 13.39999961853 ) end addCommandHandler ( "gss", gateOpen ) function gateClose ( ) moveObject ( gs1, 5000, 2522.8999023438, -1722.1999511719, 13.39999961853 ) end addCommandHandler ( "gsd", gateClose )
  19. Yeah, that's correct, if you want it faster, then lower the time.
×
×
  • Create New...