Jump to content

Et-win

Members
  • Posts

    1,390
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Et-win

  1. 1. Use +Max's new code. 2. I have the feeling that you are just letting do us the work and you are doing nothing?
  2. addEventHandler('onPlayerLogin',root, function ( ) local accounts = {} for _, account in pairs( getAccounts( ) ) do account = getAccountName( account ) table.insert(accounts, account) end triggerClientEvent( 'onAccountsSend',root, accounts ) end ) Don't trigger it for every player
  3. function renderHandler() dxDrawImage(screenWidth/2.20,screenHeight/1.50, 150,40,'images/exitmenu_hover.png') end function buttonEnter () if source == menuButton then addEventHandler("onClientRender",root,renderHandler) end end addEventHandler( "onClientMouseEnter", getRootElement(),buttonEnter) function buttonExit () if source == menuButton then removeEventHandler("onClientRender",root,renderHandler) end end addEventHandler( "onClientMouseLeave", getRootElement(),buttonExit)
  4. Make another function and attach it to the 'onClientRender' event. (And place the 'dxDrawImage' code in it) You are now making a event by every frame.
  5. Use debugscript 3 ...............
  6. guiGridListSetItemText ( accountGrid, row, column, acc( player ), false, false ) To: guiGridListSetItemText ( accountGrid, row, column, acc, false, false ) Also remove event 'onClientResourceStart' because it won't have an account triggered with.
  7. Any debugscript errors? And does it even support images? (Just asking, for the rest Idk about this )
  8. --Server-Side: table ipairs fileExists fileOpen fileRead triggerClientEvent fileClose --Client-Side: fileExists fileCreate fileWrite fileClose triggerServerEvent --(Trigger back to the server to request to start the resource) [url=https://wiki.multitheftauto.com/wiki/LoadScript]https://wiki.multitheftauto.com/wiki/LoadScript[/url] Not sure about the last link, not sure about how starting the script for client only.
  9. What was the problem?
  10. As soon as he got the Hunter, get his account data, if it exists then hunter = hunter + 1 and then set it on his account. If it doesn't exists, then set it to 1
  11. local gSelected = guiGetSelectedTab(SW_S_tabpanel1) if (gSelected ~= false) and (gSelected ~= nil) then lol = triggerServerEvent("CWS:onClientRequest:getSettings", getLocalPlayer(), gSelected) outputChatBox(tostring(lol)) My question: Why can't I send the selected tab data to Server-side? (Goes from Client to Server and then back to Client for a special handler) EDIT: When I use toJSON: "Couldn't convert userdata argument to JSON, elements not allowed for this function.". I guess this is my answer, userdata elements are not allowed, but why? EDIT2: Fixed it on another way, but still want to know why it's blocked
  12. Server-side: function saveMoney(tPlayer) if (tPlayer ~= nil) then source = tPlayer end local gAccount = getPlayerAccount(source) if (gAccount ~= false) then local gMoney = getElementData(source, "p_money") if (gMoney ~= false) then setAccountData(gAccount, "p_money", gMoney) end end end addEvent("onRequestSaveMoney", true) addEventHandler("onRequestSaveMoney", getRootElement(), saveMoney) function setMoney(previousAccount, currentAccount) local gMoney = getAccountData(currentAccount, "p_money") if (gMoney ~= false) then setElementData(source, "p_money", gMoney) else setElementData(source, "p_money", 0) end end addEventHandler("onPlayerLogin", getRootElement(), setMoney) You can now work with 'setElementData and 'getElementData'. As soon as you set the money to the player's account in Client-side, then just use this code to save the money to the player's account: triggerServerEvent("onRequestSaveMoney", getLocalPlayer()) As soon as the player logs in, then the money is automatically set. If you want to save the money via Server-side, then use: saveMoney(Fill-in-player-element-HERE) Try to study it, next time you are going to do it by yourself most of the time, instead of let everything done for you by someone else.
  13. *Edits 'Not helping people' list* Good.
  14. How you want to chat via a bind... You can't enter a message by then...
  15. Give the script..... And you are making a script, and you don't know where it sets the element data? Weird..
  16. Et-win

    Question

    Actually, you should pick 1 of the players near the minigun. As soon as that player dies, then go to the next player/vehicle.
  17. local gCurrentMoney = 0 function receiveMoney(gMoney) gCurrentMoney = gMoney end addEvent("onSendMoneyToClient", true) addEventHandler("onSendMoneyToClient", getRootElement(), receiveMoney) --Client function getPlayerMoney ( ) local m = tonumber ( getElementData ( localPlayer, "p_money" ) ) if ( not m ) then m = 0 setElementData ( localPlayer, "p_money", 0 ) end return m end function setPlayerMoney ( money ) return setElementData ( localPlayer, "p_money", money ) end function givePlayerMoney ( money ) local c = getPlayerMoney ( localPlayer ) return setPlayerMoney ( localPlayer, c + money ) end local screenWidth, screenHeight = guiGetScreenSize() addEventHandler ( "onClientRender", root, function ( ) dxDrawText ( "Twoje PP: "..tostring ( getPlayerMoney ( ) ), screenWidth * 0.509 / 2, screenHeight * 0.022, screenWidth * 0.5 / 2, screenHeight * 0, tocolor ( 0, 0, 0, 255), 1, "bankgothic", "left", "top", false, false, true, true) dxDrawText ( "#FFC000Twoje PP: #FF4000"..tostring ( getPlayerMoney ( ) ), screenWidth * 0.506 / 2, screenHeight * 0.02, screenWidth * 0.5 / 2, screenHeight * 0, tocolor ( 2, 2, 214, 255), 1, "bankgothic", "left", "top", false, false, true, true) end ) --Server function onLogin(previousAccount, currentAccount) if not getAccountData(currentAccount, "p_money") or not getAccountData(currentAccount, "p_money") == nil then setAccountData(currentAccount, "p_money", 0) end triggerClientEvent(source, "onSendMoneyToClient", source, getAccountData(currentAccount, "p_money)) end addEventHandler("onPlayerLogin", root, onLogin) function getPlayerMoney ( player ) local m = false local gPlayerAccount = getPlayerAccount(player) if (gPlayerAccount ~= false) and (isGuestAccount(gPlayerAccount) == false) then m = tonumber ( getAccountData ( gPlayerAccount, "p_money" ) ) if ( not m ) then m = 0 setAccountData ( player, "p_money", 0 ) end end return m end function getpoints ( player, command) local gPlayerAccount = getPlayerAccount(player) outputChatBox(tostring(getAccountData ( gPlayerAccount, "p_money" ))) end addCommandHandler ( "getp", getpoints ) EDITED. The rest you can do by yourself, too tired now atm. Try atleast to understand it..
  18. Et-win

    Question

    Lol. addCommandHandler ('mini', function ( ) local nx, ny, nz = getElementPosition ( localPlayer ) local minigunw = createWeapon ( 'minigun', nx, ny, nz +1 ) setWeaponClipAmmo ( minigunw,99999) setWeaponState ( minigunw,"firing") setWeaponProperty( minigunw, "fire_rotation", 0, -30, 0 ) for _, nMax in ipairs ( getElementsByType ('player' )) do x, y, z = getElementPosition ( nMax ) setWeaponTarget ( minigunw ,nMax, 255 ) end for _, nThat in ipairs ( getElementsByType ('vehicle' )) do x, y, z = getElementPosition ( nThat ) setWeaponTarget ( minigunw ,nThat, 255 ) end end )
  19. You have to trigger the player's money to the client, so you can use it there. (triggerServerEvent as soon as the player joins to request her/his money, then trigger back to her/him with triggerClientEvent)
  20. Et-win

    Question

    getElementsByType("vehicle")
  21. You are setting it on the element I see @ Admin Panel. But that is impossible, since everything is going on account data, not element data. Use: setAccountData(getPlayerAccount(getPlayerFromName("Yourname")), "p_money", value)
×
×
  • Create New...