-
Posts
1,390 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Et-win
-
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?
-
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
-
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)
-
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.
-
Use debugscript 3 ...............
-
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.
-
I search how to add a background image to panel Freeroam
Et-win replied to Furious^ONE!'s topic in Scripting
Is it in meta.xml? -
I search how to add a background image to panel Freeroam
Et-win replied to Furious^ONE!'s topic in Scripting
Guess I'm blind again. -
I search how to add a background image to panel Freeroam
Et-win replied to Furious^ONE!'s topic in Scripting
Any debugscript errors? And does it even support images? (Just asking, for the rest Idk about this ) -
--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.
-
1 end too much.
-
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
-
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
-
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.
-
*Edits 'Not helping people' list* Good.
-
How you want to chat via a bind... You can't enter a message by then...
-
Give the script..... And you are making a script, and you don't know where it sets the element data? Weird..
-
Actually, you should pick 1 of the players near the minigun. As soon as that player dies, then go to the next player/vehicle.
-
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..
-
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 )
-
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)
-
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)
