TheIceman1 Posted July 24, 2012 Posted July 24, 2012 I need set vehicle name on row,whats wrong?No errors Server side: function settext () local accn = getPlayerAccount ( source ) local accdata = getAccountData ( accn, "owner" ) triggerClientEvent ( source, "setext", source ) end addEvent ( "settext", true ) addEventHandler ( "settext", root, settext ) Client side: function setext ( data ) guiGridListSetItemText (GUIEditor_Grid[2], GUIEditor_Row[2], GUIEditor_Column[1], data, false, true) end addEvent ( "setext", true ) addEventHandler ( "setext", root, setext )
scratcher911 Posted July 24, 2012 Posted July 24, 2012 function settextServer () local accn = getPlayerAccount ( source ) local accdata = getAccountData ( accn, "owner" ) triggerClientEvent ( source, "setextClient", source, accdata ) -- You forgot to add accdata end addEvent ( "settextServer", true ) addEventHandler ( "settextServer", root, settextServer ) function setextClient ( data ) guiGridListSetItemText (GUIEditor_Grid[2], GUIEditor_Row[2], GUIEditor_Column[1], data, false, true) end addEvent ( "setextClient", true ) addEventHandler ( "setextClient", root, setextClient )
Genius Posted July 24, 2012 Posted July 24, 2012 function settextServer () local accn = getPlayerAccount ( source ) local accdata = getAccountData ( accn, "owner" ) triggerClientEvent ( source, "setextClient", source, accdata ) -- You forgot to add accdata end addEvent ( "settextServer", true ) addEventHandler ( "settextServer", root, settextServer ) function setextClient ( data ) guiGridListSetItemText (GUIEditor_Grid[2], GUIEditor_Row[2], GUIEditor_Column[1], data, false, true) end addEvent ( "setextClient", true ) addEventHandler ( "setextClient", root, setextClient ) Dont work
scratcher911 Posted July 24, 2012 Posted July 24, 2012 Any errors ? Off: Dude how much accounts do you have on this forum
AMARANT Posted July 24, 2012 Posted July 24, 2012 Try this: Server: function settextServer () -- I suppose you trigger this function from client but you didn't mention it or there will be no 'source' local accn = getPlayerAccount ( source ) local accdata = getAccountData ( accn, "owner" ) triggerClientEvent ( "setextClient", source, accdata ) end addEvent ( "settextServer", true ) addEventHandler ( "settextServer", root, settextServer ) Client: function setextClient ( data ) guiGridListSetItemText (GUIEditor_Grid[2], GUIEditor_Row[2], GUIEditor_Column[1], tostring(data), false, true) end addEvent ( "setextClient", true ) addEventHandler ( "setextClient", getLocalPlayer(), setextClient )
TheIceman1 Posted July 24, 2012 Author Posted July 24, 2012 Try this:Server: function settextServer () -- I suppose you trigger this function from client but you didn't mention it or there will be no 'source' local accn = getPlayerAccount ( source ) local accdata = getAccountData ( accn, "owner" ) triggerClientEvent ( "setextClient", source, accdata ) end addEvent ( "settextServer", true ) addEventHandler ( "settextServer", root, settextServer ) Client: function setextClient ( data ) guiGridListSetItemText (GUIEditor_Grid[2], GUIEditor_Row[2], GUIEditor_Column[1], tostring(data), false, true) end addEvent ( "setextClient", true ) addEventHandler ( "setextClient", getLocalPlayer(), setextClient ) Dont work
TheIceman1 Posted July 24, 2012 Author Posted July 24, 2012 How do you trigger this event: "settext"? Dont understand.
TheIceman1 Posted July 24, 2012 Author Posted July 24, 2012 This? function settext () local accn = getPlayerAccount ( source ) local accdata = getAccountData ( accn, "owner" ) triggerClientEvent ( source, "setext", source ) end addEvent ( "settext", true ) addEventHandler ( "settext", root, settext )
Castillo Posted July 24, 2012 Posted July 24, 2012 No, post the script which triggers the event: "settext".
AMARANT Posted July 24, 2012 Posted July 24, 2012 That's what I mentioned in my comment to lua-code. Solidsnake14, don't you think he didn't even trigger that function?
Castillo Posted July 24, 2012 Posted July 24, 2012 Is what I'm thinking, as he doesn't even understand what I mean.
Jaysds1 Posted July 24, 2012 Posted July 24, 2012 , seems kinda rude, but still "TheIceman1", you have to trigger it.
TheIceman1 Posted July 24, 2012 Author Posted July 24, 2012 I triggered it but its dont work Client side: function setextClient ( data ) guiGridListSetItemText (GUIEditor_Grid[2], GUIEditor_Row[2], GUIEditor_Column[1], data, false, true) triggerServerEvent ( "settextServer", getLocalPlayer()) end addEvent ( "setextClient", true ) addEventHandler ( "setextClient", root, setextClient ) Server side: function settextServer () -- I suppose you trigger this function from client but you didn't mention it or there will be no 'source' local accn = getPlayerAccount ( source ) local accdata = getAccountData ( accn, "owner" ) triggerClientEvent ( "setextClient", source, accdata ) end addEvent ( "settextServer", true ) addEventHandler ( "settextServer", root, settextServer )
AMARANT Posted July 24, 2012 Posted July 24, 2012 (edited) Of course it won't. Your two functions trigger each other but there's no event that call at least one of them. Edited July 24, 2012 by Guest
Jaysds1 Posted July 24, 2012 Posted July 24, 2012 Sorry, but this script doesn't make sense, how is the client-side script suppose to trigger if the server has to trigger it, but in order for the server to trigger it the client has to trigger it, THIS IS GOING TO BE A LOOP!!!
AMARANT Posted July 24, 2012 Posted July 24, 2012 You should make it like this: Client side: function setextClient ( data ) outputChatBox(tostring(data).." received!") guiGridListSetItemText (GUIEditor_Grid[2], GUIEditor_Row[2], GUIEditor_Column[1], tostring(data), false, true) end addEvent ( "setextClient", true ) addEventHandler ( "setextClient", getLocalPlayer(), setextClient ) Server side: function settextServer (thePlayer) local accn = getPlayerAccount ( thePlayer ) local accdata = getAccountData ( accn, "owner" ) triggerClientEvent ( "setextClient", thePlayer, accdata ) end addCommandHandler ( "text", settextServer )
TheIceman1 Posted July 24, 2012 Author Posted July 24, 2012 Now i can buy only one car how can i make it to i can have 2 cars?
AMARANT Posted July 24, 2012 Posted July 24, 2012 Well... Actually we don't know about your system. Why don't you provide us with the full code and then we could try to help you?
TheIceman1 Posted July 25, 2012 Author Posted July 25, 2012 Well... Actually we don't know about your system. Why don't you provide us with the full code and then we could try to help you? If i will post full code then its complet script i can send it to you via PM.
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