Jump to content

Zuher Laith

Members
  • Posts

    148
  • Joined

  • Last visited

Everything posted by Zuher Laith

  1. @quindo it worked but not so perfect, on attaching If I was in a dim other than 0 Its invisible, it gets visible when I go to 0, and It works normally If I teleport to another dim .
  2. yes, this is the result: this happens when teleporting to another dimension & the element is attached.
  3. the one you recommended, PepsiCan = createObject(1487,0,0,0) AttachElementToBone(PepsiCan, thePlayer, 12,0,0,0,0,-130,20) -- it works fine .
  4. triggerEvent( "onPlayerDimIntChange", player, lastDimIntTable[player].int, lastDimIntTable[player].dim, curInt, curDim) lastDimensionTable[player].dim = curDim lastDimensionTable[player].int = curInt -- edit: lastDimIntTable[player].dim = curDim lastDimIntTable[player].int = curInt Well, now no error given & no result on changing dim/int ..
  5. I think you forgot a lot of end if here.. Alright, everything works fine, but it doesn't change element dim/int on player change dim/int , and there is one error I found, you may want to look at the code ..
  6. -- server side: function takeCashHandler ( thePlayer, amount ) takePlayerMoney ( thePlayer, tonumber(amount) ) end addEvent( "takeCash", true ) addEventHandler( "takeCash", resourceRoot, takeCashHandler ) -- client side: triggerServerEvent ( "takeCash", resourceRoot, localPlayer, 3 ) same for the rest of those events .
  7. @quindo I feel so stupid after that small edit... I didn't notice .. After testing it gives no errors at start and no specific error line at debugscript 3 . but basically the code you provided made the whole server.lua like it doesn't exist and each event called from client gives the following error:
  8. I got one error here: function updatePlayerAttachedElements(lastInt, lastDim, curInt, curDim) local attachedObjects = getElementChildren ( source, "object") for _,elem in pairs(attachedObjects) setElementDimension( elem, curDim ) -- here setElementInterior( elem, curInt ) end end addEventHandler( "onPlayerDimIntChange", root, updatePlayerAttachedElements ) -- errors: [21:21:15] ERROR: Loading script failed: vend\server.lua:52: 'do' expected n ear 'setElementDimension' [21:21:24] ERROR: Client (NiGht) triggered serverside event AttachPepsi, but eve nt is not added serverside [21:21:24] ERROR: Client (NiGht) triggered serverside event takeCash, but event
  9. let me be honest with you, it became confusing to me since I have a problem with understanding events, client, server .. As I saw your code, I thought this is a client and I didn't understand how should I correctly use it . would you please explain to me how can I change the element dimension based on the code you provide on server side ?
  10. There is now many different replays and ideas in the topic, lets make them one. I've created a function in the bone_attach (idea by Enargy,) and used isElementAttachedToBone to check if object is destroyed later instead of attachedObjects Everything works as suppose to be, but I'm afraid of timers, is this going to be a cause of server usage if I change the timer interval to "100" ? .. because this is on server side .
  11. well, this was the result and it worked without a timer : function attachPepsiHandler () PepsiCan = createObject(1487,0,0,0) setElementParent(PepsiCan, client) exports.bone_attach:attachElementToBone(PepsiCan, client, 12,0,0,0,0,-130,20) -- the code works like this (with uncomment): --setTimer(function() --local attachedObjects = getElementChildren ( client, PepsiCan) -- problem here if not ( getElementDimension ( client ) == 0 ) then -- And here --if attachedObjects then playerdim = getElementDimension ( client ) setElementDimension ( PepsiCan, playerdim ) --end end --end, 1000, 0) -- if I uncomment them, here are the errors: [15:22:59] WARNING: vend\server.lua:22: Bad argument @ 'getElementChildren' [Expected element at argument 1, got nil] [DUP x4] [15:22:59] WARNING: vend\server.lua:23: Bad argument @ 'getElementDimension [Expected element at argument 1, got nil] [DUP x4] end
  12. unfortunately, it didn't work on dimension change .. function attachToPedHandler () PepsiCan = createObject(1487,0,0,0) exports.bone_attach:attachElementToBone(PepsiCan, client, 12,0,0,0,0,-130,20) setElementParent(PepsiCan, client) end but I thought about using SetElementDimension & SetElementInterior , but how do I check for dimension/interior player change ?
  13. Hi everyone, So recently I have been working on some scripting with the famous bone_attach script and I've noticed something important, when I attach object to the client and the client teleports to another interior/dimension, the objects gets invisible but when I go back to the 0 dimension&interior, It gets visible ! plus, even If I created and attached the object in dimension/interior other than 0, its Invisible, I teleport to 0 it gets visible . In this case, how should I make the object that attached to the client visible when he goes to another dimension & interior ? Any help is appreciated .
  14. It shocked me when the "bankInit" function in Xmlserver.lua was not running at all, so I did the following: -- client.lua: addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), function( ) triggerServerEvent( "bankInit", resourceRoot ); end ) -- Xmlserver.lua: function bankInit () -- code and stuff end addEvent( "bankInit", true ) addEventHandler( "bankInit", resourceRoot, bankInit ) and the code worked correctly !, but still.. I'm having a problem with hiding the cursor from client.lua when the onPlayerMarkerLeave event in server side (which is the solution for the problem)
  15. No I'm not getting any errors, Its like the code is not running, but everything else in code works . but at first, the objects in map doesn't show up, so its possible the problem is from Xmlserver.lua
  16. Hi .. I've made a vending machine mod and I'm trying to make it shows up on marker in XML design, I already took an example of what I need, the bank_system has one what I did is copying the xml server file in that mod and edit it to make it right, well its confusing to me because I'm new at this, I pasted the whole code just in case, The problem is might be in Xmlserver.lua, exactly right here: function bankInit( ) local xml_root = xmlLoadFile( "bar.locations.xml" ) local banks = 0 while( xmlFindChild( xml_root, "bank", banks ) ) do local markerSize local tempID = banks+1 banksInfo[ tempID ] = { } local bank_node = xmlFindChild( xml_root, "bank", banks ) banksInfo[ tempID ].name = xmlNodeGetAttribute( bank_node, "name" ) banksInfo[ tempID ].useBlip = xmlNodeGetAttribute( bank_node, "blip" ) or true local bank_loc = xmlFindChild( bank_node, "location", 0 ) banksInfo[ tempID ].posX = tonumber( xmlNodeGetAttribute( bank_loc, "posX" ) ) banksInfo[ tempID ].posY = tonumber( xmlNodeGetAttribute( bank_loc, "posY" ) ) banksInfo[ tempID ].posZ = tonumber( xmlNodeGetAttribute( bank_loc, "posZ" ) ) banksInfo[ tempID ].interior = tonumber( xmlNodeGetAttribute( bank_loc, "interior" ) ) or 0; markerSize = tonumber( xmlNodeGetAttribute( bank_loc, "markerSize" ) ) or 2 banksInfo[ tempID ].marker = createMarker( banksInfo[ tempID ].posX, banksInfo[ tempID ].posY, banksInfo[ tempID ].posZ-.9, "cylinder", markerSize, 250, 0, 0, 100 ) setElementInterior( banksInfo[ tempID ].marker, banksInfo[ tempID ].interior ); if xmlNodeGetAttribute( bank_loc, "ATM" ) == "true" then local rot = tonumber( xmlNodeGetAttribute( bank_loc, "ATMRot" ) ) or 0.0 local x, y, z = banksInfo[ tempID ].posX, banksInfo[ tempID ].posY, banksInfo[ tempID ].posZ x = x + math.sin( math.rad( rot ) ) * .6 y = y + math.cos( math.rad( rot ) ) * .6 banksInfo[ tempID ].ATM = createObject( 2942, x, y, z-.35, 0, 0, (360-rot) ) setElementInterior( banksInfo[ tempID ].ATM, tonumber( xmlNodeGetAttribute( bank_loc, "interior" ) ) or 0 ) setElementParent( banksInfo[ tempID ].ATM, banksInfo[ tempID ].marker ) end banks = banks + 1 end <banks> <bank name="Western Onion ATM" > <location posX="2630.6667480469" posY="1655.393046875" posZ="11.0234375" ATM="true" interior="0" ATMRot="180.0" markerSize="1" /> </bank> </banks> I did a few small edits to make it work, but I actually can't detect the problem and why this is not working, Any help is appreciated .
  17. @IIYAMA Too much good information!, I've looked at every thing you said and its really helpful to me, I'm gonna favorite this to be honest . you are awesome .. Thank you so much for help & time .
  18. I guess I get it now, but still I had a problem in the server side, thePlayer or source doesn't work but client did, let me explain it in code: -- Client side triggerServerEvent ( "takeCash", resourceRoot, 2 ) -- takes $2 of the player -- Server side function takeCashHandler ( thePlayer, amount ) takePlayerMoney ( thePlayer, tonumber(amount) ) end addEvent( "takeCash", true ) addEventHandler( "takeCash", resourceRoot, takeCashHandler ) Whats the problem in this?, and could you please clarify thePlayer, source, client and how to use them right in both sides ? Appreciate your help .
  19. Hi .. I'm wondering about the server side and the client side, what's the difference between them in code ? for my case, I am using bone_attach mod and attached a case to the localPlayer, whats the difference if I wrote it in client side, or server side ? will it show up to the people If I attached it in the client side ?, Please provide me with information as much as possible. Thanks in Advance
  20. Figured it out, I used the "row" int result as a condition since my GridList rows are default . However, what you provided is also a solution . Thank you so much .
  21. Hi As it says in the Title, i have a problem with this .. I looked up on the Wiki and used guiGridListGetItemData, I read the example provided, didn't make it for what I need . function BuyDrink ( button ) if button == "left" then local nRow, nColumn = guiGridListGetSelectedItem( GridList ) if nRow ~= -1 and nColumn ~= - 1 then local row, col = guiGridListGetSelectedItem ( GridList ) local selected = guiGridListGetItemData ( GridList, row, col ) -- This Gives "nil" output outputChatBox ( "You Bought " .. tostring(selected) ) -- Output the Text from selected row of the first Column only end end end Basically I want the Text of my first column selected row, not an int . I hope I made it clear to understand Any help is appreciated .
×
×
  • Create New...