ertlflorian1 Posted January 4, 2013 Posted January 4, 2013 Hi i have a problem with this gui it will be shown on all players! Server: function oncolehit (player) pname = getPlayerName (player) if getElementType ( player ) == "player" then veh = getPedOccupiedVehicle (player) seat = getPedOccupiedVehicleSeat (player) if (veh) and (seat == 0) then local result = mysql_query( handler2, "SELECT * FROM accounts WHERE Name = '"..pname.."'" ) local row = mysql_fetch_assoc(result) if row then if (row["Wert"] == "1") then outputChatBox ("Danke das du das Parkhaus besuchst!", player, 0,255,0) eschrankefunc () end mysql_free_result(result) else if getElementType ( player ) == "player" then veh = getPedOccupiedVehicle (player) seat = getPedOccupiedVehicleSeat (player) if (veh) and (seat == 0) then triggerClientEvent (player, "openGUI", player) end end end end end end addEventHandler ("onColShapeHit", cole, oncolehit) client: function showwindow () local isshowed = guiGetVisible (Grundflaeche) if (isshowed == true) then guiSetVisible (Grundflaeche, false) showCursor(false) guiSetInputEnabled(false) end if (isshowed == false) then guiSetVisible (Grundflaeche, true) showCursor(true) guiSetInputEnabled(true) end end addEvent ("openGUI", true) addEventHandler ("openGUI", getRootElement(), showwindow) Sorry for my bad english! Please help me
manve1 Posted January 4, 2013 Posted January 4, 2013 (edited) Server: function oncolehit (p, hitElement) pname = getPlayerName (p) if ( getElementType ( p ) == "player" ) then veh = getPedOccupiedVehicle (p) seat = getPedOccupiedVehicleSeat (p) if (veh) and (seat == 0) then local result = mysql_query( handler2, "SELECT * FROM accounts WHERE Name = '"..pname.."'" ) local row = mysql_fetch_assoc(result) if row then if (row["Wert"] == "1") then outputChatBox ("Danke das du das Parkhaus besuchst!", p, 0,255,0) eschrankefunc () end mysql_free_result(result) else if ( getElementType ( p ) == "player" ) then veh = getPedOccupiedVehicle (p) seat = getPedOccupiedVehicleSeat (p) if (veh) and (seat == 0) then triggerClientEvent (hitElement, "openGUI", hitElement) end end end end end end addEventHandler ("onColShapeHit", cole, oncolehit) try this Edited January 4, 2013 by Guest
Blaawee Posted January 4, 2013 Posted January 4, 2013 mybe this client : function showwindow () guiSetVisible( Grundflaeche, not guiGetVisible( Grundflaeche ) ) showCursor( guiGetVisible( Grundflaeche ) ) guiSetInputEnabled( guiGetVisible( Grundflaeche ) ) end addEvent ( "openGUI", true ) addEventHandler ( "openGUI", localPlayer, showwindow ) server: function oncolehit ( hitElement, matchingDimension ) if ( getElementType ( hitElement ) == "player" ) and ( getPedOccupiedVehicle ( hitElement ) ) and ( getPedOccupiedVehicleSeat ( hitElement ) == 0 ) and matchingDimension then local result = mysql_query( handler2, "SELECT * FROM accounts WHERE Name = '" .. getPlayerName ( hitElement ) .. "'" ) local row = mysql_fetch_assoc( result ) if ( row ) and ( row["Wert"] == "1" ) then outputChatBox ( "Danke das du das Parkhaus besuchst!", hitElement, 0, 255, 0 ) eschrankefunc () end mysql_free_result( result ) triggerClientEvent ( hitElement, "openGUI", hitElement ) end end addEventHandler ( "onColShapeHit", cole, oncolehit )
TAPL Posted January 4, 2013 Posted January 4, 2013 Your problem is that the GUI is showing for everyone, not only for who has hit the col? Well, the trigger is only for who hit the col, so the problem is no problem. Maybe you want post the rest of the code? Where is the function eschrankefunc () ? Maybe you have other script trigger the event openGUI for everyone? try to change it to something else.
ertlflorian1 Posted January 4, 2013 Author Posted January 4, 2013 Here is the function: function eschrankefunc () if (eschrankeMovingState == false) then if (eschranke == false) then eschrankeMovingState = true setTimer(setefalse, 1500, 1) moveObject (schrankee, 1500, -1804.5000000,1293.0097700,15.8000000, 0, -90, 0) eschranke = true setTimer (eschrankefunc, 2000, 1) else eschrankeMovingState = true setTimer(setefalse, 1500, 1) moveObject (schrankee, 1500, -1804.5000000,1293.0097700,15.8000000, 0, 90, 0) eschranke = false end end end function setefalse () eschrankeMovingState = false end
TAPL Posted January 4, 2013 Posted January 4, 2013 Have you tried change the event name "openGUI" to something else?
ertlflorian1 Posted January 4, 2013 Author Posted January 4, 2013 I have tried it now but it wont work can i send you the complete script to check it? Because i wouldn post it here?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now