Jump to content

Heshan_Shalinda_eUnlock

Members
  • Posts

    56
  • Joined

  • Last visited

Details

  • Gang
    MTA
  • Location
    Sri Lanka
  • Occupation
    Scripter
  • Interests
    MTA Scripting

Recent Profile Visitors

419 profile views

Heshan_Shalinda_eUnlock's Achievements

Snitch

Snitch (10/54)

3

Reputation

  1. Thank you very much but I need a very immediate solution. Thanks
  2. Someone please help me on this. Could you please tell me only the reason then I can fix it..
  3. yes it's from owlgaming... I don't understand what is the reason for it. Could you please tell me of it?
  4. Vehicles in our server will automatically flew when there are more vehicles in the server in my point of view. I don't know what is the error and also I don't no what is the resource which contain that error. Could you please help me to find out it...... Thanks..
  5. How do I find it. There isn't anything called mta_connection in community. I don't know to find one???
  6. local handler = dbPoll(result, -1) Could you please help me to fix this problem. Thanks
  7. I got this but in this you are triggering a server event on client side but I want to trigger a client Event from server side as the reciprocal of this. I want to show window open/close state other players in the server. Tell me what are the failures in my script because when I use this it only shows yo me. -- Client Side -- local function open_event(wndid) local playerVehicle = getPedOccupiedVehicle ( source ) if ( playerVehicle ) then if setVehicleWindowOpen( playerVehicle, wndid, not isVehicleWindowOpen( playerVehicle, wndid ) ) then outputChatBox( "Driver Window Switched" ) else outputChatBox( "You don't have window!" ) end end end local function open_request() triggerServerEvent("onVehicleWindowOpenRequest", localPlayer, seatWindows[0]); end addCommandHandler("open", open_request) addEvent("open", true) addEventHandler( "open", localPlayer, open_event ) addEventHandler ( "onClientGUIClick", GUIEditor.button[13], open_request, false ) -- Server Side -- addEvent("onVehicleWindowOpenRequest", true); addEventHandler("onVehicleWindowOpenRequest", root, function(wndid) triggerClientEvent("open", client, wndid); end ); I don't understand what's wrong in this script could you please tell me what's wrong in this script. Thank you.................
  8. Exactly not ! I want to make vehicle function which change the vehicleWindowState open/close make visible to other players nearby/ in the server. Did you get that? This is my coding............... -- Client Side -- function callClientFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onServerCallsClientFunction", true) addEventHandler("onServerCallsClientFunction", resourceRoot, callClientFunction) GUIEditor = { button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[3] = guiCreateWindow(129, 311, 105, 121, "Open Shutters", false) guiWindowSetSizable(GUIEditor.window[3], false) GUIEditor.button[13] = guiCreateButton(9, 27, 41, 39, "Shutter 01", false, GUIEditor.window[3]) GUIEditor.button[14] = guiCreateButton(54, 71, 41, 39, "Shutter 04", false, GUIEditor.window[3]) GUIEditor.button[15] = guiCreateButton(54, 27, 41, 39, "Shutter 02", false, GUIEditor.window[3]) GUIEditor.button[16] = guiCreateButton(10, 71, 40, 39, "Shutter 03", false, GUIEditor.window[3]) local seatWindows = { [0] = 4, [1] = 2, [2] = 5, [3] = 3 } function open() if isPedInVehicle(getLocalPlayer()) then playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( playerVehicle ) then if seatWindows[0] and setVehicleWindowOpen( playerVehicle, 4, not isVehicleWindowOpen( playerVehicle, 4 ) ) then outputChatBox( "Driver Window Switched" ) else outputChatBox( "You don't have window!" ) end end end end addEventHandler ( "onClientGUIClick", GUIEditor.button[13], open ) function open2() if isPedInVehicle(getLocalPlayer()) then playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( playerVehicle ) then if seatWindows[0] and setVehicleWindowOpen( playerVehicle, 2, not isVehicleWindowOpen( playerVehicle, 2 ) ) then outputChatBox( "Front Right Window switched" ) else outputChatBox( "You don't have window!" ) end end end end addEventHandler ( "onClientGUIClick", GUIEditor.button[15], open2 ) function open3() if isPedInVehicle(getLocalPlayer()) then playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( playerVehicle ) then if seatWindows[0] and setVehicleWindowOpen( playerVehicle, 5, not isVehicleWindowOpen( playerVehicle, 5 ) ) then outputChatBox( "Back Left Window switched!" ) else outputChatBox( "You don't have window!" ) end end end end addEventHandler ( "onClientGUIClick", GUIEditor.button[16], open3 ) function open4() if isPedInVehicle(getLocalPlayer()) then playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) if ( playerVehicle ) then if seatWindows[0] and setVehicleWindowOpen( playerVehicle, 3, not isVehicleWindowOpen( playerVehicle, 3 ) ) then outputChatBox( "Back Right Window switched!" ) else outputChatBox( "You don't have window!" ) end end end end addEventHandler ( "onClientGUIClick", GUIEditor.button[14], open4 ) function guiackapa () if guiGetVisible ( GUIEditor.window[3] ) then guiSetVisible ( GUIEditor.window[3], false ) showCursor(false) else guiSetVisible ( GUIEditor.window[3], true) showCursor(true) end end addEvent( "ShowGUI", false ) addEventHandler ( "ShowGUI", getRootElement(), guiackapa ) bindKey("F10","down",guiackapa) end ) -- Server Script -- function callClientFunction(client, funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end -- If the clientside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) end addCommandHandler("callFunction", function (player, cmd, functionName) callClientFunction(player, functionName) end, false, false) I have tried many functions like triggerClientEvent in server side script part but I was not able do make my script successfully. This is my script which I have used triggerClientEvent and TriggerServerEvent, Could you please help me on this. I want to make windowState visible to other players in the server when I switch window using gui Button.. This part is with triggering I don't understand how to get rid of this mess... please help me... -- Client Side -- GUIEditor = { button = {}, window = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[3] = guiCreateWindow(129, 311, 105, 121, "Open Shutters", false) guiWindowSetSizable(GUIEditor.window[3], false) GUIEditor.button[13] = guiCreateButton(9, 27, 41, 39, "Shutter 01", false, GUIEditor.window[3]) GUIEditor.button[14] = guiCreateButton(54, 71, 41, 39, "Shutter 04", false, GUIEditor.window[3]) GUIEditor.button[15] = guiCreateButton(54, 27, 41, 39, "Shutter 02", false, GUIEditor.window[3]) GUIEditor.button[16] = guiCreateButton(10, 71, 40, 39, "Shutter 03", false, GUIEditor.window[3]) local seatWindows = { [0] = 4, [1] = 2, [2] = 5, [3] = 3 } function open_event(wndid) local playerVehicle = getPedOccupiedVehicle ( source ) if ( playerVehicle ) then if setVehicleWindowOpen( playerVehicle, wndid, not isVehicleWindowOpen( playerVehicle, wndid ) ) then outputChatBox( "Driver Window Switched" ) else outputChatBox( "You don't have window!" ) end end end function open_request() triggerServerEvent("onVehicleWindowOpenRequest", root, seatWindows[0]); end addCommandHandler("open", open_request) addEvent("open", true) addEventHandler( "open", localPlayer, open_event ) addEventHandler ( "onClientGUIClick", GUIEditor.button[13], open_request, false ) function open_event2(wndid) local playerVehicle = getPedOccupiedVehicle ( source ) if ( playerVehicle ) then if setVehicleWindowOpen( playerVehicle, wndid, not isVehicleWindowOpen( playerVehicle, wndid ) ) then outputChatBox( "Front Right Window Switched" ) else outputChatBox( "You don't have window!" ) end end end local function open_request2() triggerServerEvent("onVehicleWindowOpenRequest2", root, seatWindows[1]); end addCommandHandler("open2", open_request2) addEvent("open2", true) addEventHandler( "open2", localPlayer, open_event2 ) addEventHandler ( "onClientGUIClick", GUIEditor.button[15], open_request2, false ) function open_event3(wndid) local playerVehicle = getPedOccupiedVehicle ( source ) if ( playerVehicle ) then if setVehicleWindowOpen( playerVehicle, wndid, not isVehicleWindowOpen( playerVehicle, wndid ) ) then outputChatBox( "Rear Left Window Switched" ) else outputChatBox( "You don't have window!" ) end end end local function open_request3() triggerServerEvent("onVehicleWindowOpenRequest3", root, seatWindows[2]); end addCommandHandler("open3", open_request3) addEvent("open3", true) addEventHandler( "open3", localPlayer, open_event3 ) addEventHandler ( "onClientGUIClick", GUIEditor.button[16], open_request3, false ) function open_event4(wndid) local playerVehicle = getPedOccupiedVehicle ( source ) if ( playerVehicle ) then if setVehicleWindowOpen( playerVehicle, wndid, not isVehicleWindowOpen( playerVehicle, wndid ) ) then outputChatBox( "Rear Right Window Switched" ) else outputChatBox( "You don't have window!" ) end end end local function open_request4() triggerServerEvent("onVehicleWindowOpenRequest4", root, seatWindows[3]); end addCommandHandler("open4", open_request4) addEvent("open4", true) addEventHandler( "open4", localPlayer, open_event4 ) addEventHandler ( "onClientGUIClick", GUIEditor.button[14], open_request4, false ) function guiackapa () if guiGetVisible ( GUIEditor.window[3] ) then guiSetVisible ( GUIEditor.window[3], false ) showCursor(false) else guiSetVisible ( GUIEditor.window[3], true) showCursor(true) end end addEvent( "ShowGUI", false ) addEventHandler ( "ShowGUI", getRootElement(), guiackapa ) bindKey("F10","down",guiackapa) end ) -- Server Side -- addEvent("onVehicleWindowOpenRequest", true); addEventHandler("onVehicleWindowOpenRequest", root, function(wndid) triggerClientEvent("open", client, wndid); end ); addEvent("onVehicleWindowOpenRequest2", true); addEventHandler("onVehicleWindowOpenRequest2", root, function(wndid) triggerClientEvent("open2", client, wndid); end ); addEvent("onVehicleWindowOpenRequest3", true); addEventHandler("onVehicleWindowOpenRequest3", root, function(wndid) triggerClientEvent("open3", client, wndid); end ); addEvent("onVehicleWindowOpenRequest4", true); addEventHandler("onVehicleWindowOpenRequest4", root, function(wndid) triggerClientEvent("open4", client, wndid); end ); Thank you....
  9. Can I bind this into gui button and make some client side function occur by clicking that gui button?? Thank you for your help
  10. I have used this script and create a resource but the doorstate does not working but when we are not in a vehicle the message will we displayed. How to fix this?
  11. Thank you for your help but I want to know why we use callClientFunction. And I want to know if I can use it to an only client side function make visible to all the players in the server.
  12. I want to know the usage of CallClientFunction to make my further scripts. Could someone please help me on this?
  13. Don't worry I have found out how to do it without any help thank you...
  14. Other Players in the server can not see the windows open/close state when I do that and I also can't see that when they do that. What is the reason for that?
×
×
  • Create New...