Charlie_Jefferson Posted November 4, 2011 Share Posted November 4, 2011 Also, blawee: triggerClientEvent Why Client i'm confused now :@ I know right? I don't get it either. Just try the script you've got now, with my corrections and see if it works. Link to comment
Castillo Posted November 4, 2011 Share Posted November 4, 2011 -- client side: addCommandHandler("test", function (_,text) triggerServerEvent("test",localPlayer,text) end) addEvent("returnTest",true) addEventHandler("returnTest",root, function (text) outputChatBox(tostring(text)) end) -- server side: addEvent("test",true) addEventHandler("test",root, function (text) triggerClientEvent(source,"returnTest",source,text) end) Link to comment
Charlie_Jefferson Posted November 4, 2011 Share Posted November 4, 2011 So you want him to use triggerClientEvent so he can display the IP in the server-side lua? Why would he do that? I'm pretty sure that he wants to display the IP in a label. Link to comment
Castillo Posted November 4, 2011 Share Posted November 4, 2011 Dude, you still don't get me, triggerClientEvent is used to SEND INFORMATION TO THE CLIENT SIDE NOT THE SERVER SIDE. Link to comment
Charlie_Jefferson Posted November 4, 2011 Share Posted November 4, 2011 I get what you mean, but I'm pretty sure your wrong. Well, I'll just wait for Blaawee's response, to see if it worked. P.S. I know your the advanced scripter and I'm the noob one, but still, I'll sustain my opinion. Link to comment
Blaawee Posted November 4, 2011 Author Share Posted November 4, 2011 (edited) Client Side : ip1 = guiCreateLabel(0.02,0.62,0.94,0.92,"your ip : ",true,tab1) guiLabelSetColor (ip1,255,255,0,220) guiSetFont(ip1,"default-bold-small") triggerServerEvent("ip", getLocalPlayer()) ping1 = guiCreateLabel(0.02,0.55,0.94,0.92,"your ping : "..tostring(getPlayerPing(localPlayer)),true,tab1) guiLabelSetColor (ping1,255,255,0,220) guiSetFont(ping1,"default-bold-small") theSerial = getPlayerSerial( thePlayer ) serial1 = guiCreateLabel(0.02,0.68,0.94,0.92,"your serial : "..tostring(getPlayerSerial()),true,tab1) guiLabelSetColor (serial1,255,255,0,220) guiSetFont(serial1,"default-bold-small") name1 = guiCreateLabel(0.02,0.82,0.94,0.92," username : ",true,tab1) guiLabelSetColor (name1,0,255,0,220) guiSetFont(name1,"default-bold-small") theTeam = getPlayerTeam( localPlayer ) if theTeam then teamName = getTeamName(theTeam) else teamName = "N/A" end yourteam = guiCreateLabel(0.02,0.88,0.94,0.92,"yourTeam :"..tostring(teamName),true,tab1) guiLabelSetColor (yourteam,0,255,0,220) guiSetFont(yourteam,"default-bold-small") Server Side: function ip1( thePlayer ) pIP = getPlayerIP(thePlayer) end addEvent("ip") addEventHandler("ip", root, ip1) I edit it * Edited November 4, 2011 by Guest Link to comment
Castillo Posted November 4, 2011 Share Posted November 4, 2011 Can you post exactly what he has to do in your opinion? Link to comment
Charlie_Jefferson Posted November 4, 2011 Share Posted November 4, 2011 Can you post exactly what he has to do in your opinion? Well, in my noob opinion, he has to write exactly what he wrote above your post. He made a label, he made the server-side script, which gets the IP of the player, and he triggers the IP get function inside the label, so it displays the IP. That seems pretty logic for me. Not sure if it's correct, but it's pretty logic for me. @Blaawee Try the script you just posted and tell us if it works. Link to comment
Castillo Posted November 4, 2011 Share Posted November 4, 2011 Pretty logic? triggerServerEvent("ip", getPlayerIP()) That's HIGHLY wrong, getPlayerIP is only server side, triggers doesn't work like this! Link to comment
Charlie_Jefferson Posted November 4, 2011 Share Posted November 4, 2011 Uh. I told him to replace that with this: triggerServerEvent("ip", getLocalPlayer()) Link to comment
Castillo Posted November 4, 2011 Share Posted November 4, 2011 But... after that what? do you think triggerServerEvent does magic? because that's pretty much what I get. After triggerServerEvent, you get the IP in the server side, and then what? acording to your "logic" the rest is done by magic. Link to comment
Charlie_Jefferson Posted November 4, 2011 Share Posted November 4, 2011 I've read it up on the wiki, you were right, indeed. Sorry for the trouble and waste of time caused. I'm still learning, that isn't an excuse though. Sorry again. Link to comment
Castillo Posted November 4, 2011 Share Posted November 4, 2011 Finally you get me, is ok, I know it's hard as I was a newbie before . Now, back on topic. -- client side: ip1 = guiCreateLabel(0.02,0.62,0.94,0.92,"your ip : ",true,tab1) guiLabelSetColor (ip1,255,255,0,220) guiSetFont(ip1,"default-bold-small") ping1 = guiCreateLabel(0.02,0.55,0.94,0.92,"your ping : "..tostring(getPlayerPing(localPlayer)),true,tab1) guiLabelSetColor (ping1,255,255,0,220) guiSetFont(ping1,"default-bold-small") theSerial = getPlayerSerial( thePlayer ) serial1 = guiCreateLabel(0.02,0.68,0.94,0.92,"your serial : "..tostring(getPlayerSerial()),true,tab1) guiLabelSetColor (serial1,255,255,0,220) guiSetFont(serial1,"default-bold-small") name1 = guiCreateLabel(0.02,0.82,0.94,0.92," username : ",true,tab1) guiLabelSetColor (name1,0,255,0,220) guiSetFont(name1,"default-bold-small") theTeam = getPlayerTeam( localPlayer ) if theTeam then teamName = getTeamName(theTeam) else teamName = "N/A" end yourteam = guiCreateLabel(0.02,0.88,0.94,0.92,"yourTeam :"..tostring(teamName),true,tab1) guiLabelSetColor (yourteam,0,255,0,220) guiSetFont(yourteam,"default-bold-small") triggerServerEvent("getIP", getLocalPlayer()) addEvent("returnIP",true) addEventHandler("returnIP",root, function (IP) guiSetText(ip1, "your ip: ".. tostring(IP)) end) -- server side: addEvent("getIP",true) addEventHandler("getIP",root, function () triggerClientEvent(source,"returnIP",source,getPlayerIP(source)) end) This has to work. NOTICE: You must add this resource to the acl.xml, "Admin" group. Link to comment
Blaawee Posted November 4, 2011 Author Share Posted November 4, 2011 Now i got it :@ thx Solidsnake Link to comment
Blaawee Posted November 5, 2011 Author Share Posted November 5, 2011 i got another qustion can i draw dxdrawtxt on only admin head ? Link to comment
Charlie_Jefferson Posted November 5, 2011 Share Posted November 5, 2011 (edited) i got another qustion can i draw dxdrawtxt on only admin head ? That is possible, but not sure how to integrate it, since we have to use isObjectInACLGroup(server only) and dxDrawText is client-only. I'll leave it to Castillo. Edit: function adminTag(thePlayer) pname = getPlayerName(thePlayer) if getElementType(thePlayer) == "remote admin" then tagText = dxDrawText(pname, x, y) end attatchElement(tagText, thePlayer) end function render() addEventHandler("onClientRender",rootElement, adminTag) end addEventHandler("onClientResourceStart",resourceRoot, render) x = the absolute X coordinate of the top left corner of the text y = the absolute Y coordinate of the top left corner of the text If remote admin doesn't work, simply try replacing it with admin. Not sure if it works. Try testing it. Edited November 5, 2011 by Guest Link to comment
Castillo Posted November 5, 2011 Share Posted November 5, 2011 DX drawing doesn't return anything, is not a element as it's drawn every frame, it doesn't work that way. Link to comment
Charlie_Jefferson Posted November 5, 2011 Share Posted November 5, 2011 Oh. Hm. Well how do I attach it then? Link to comment
BinSlayer1 Posted November 5, 2011 Share Posted November 5, 2011 well thePlayer = nil because onClientRender has no parameters and that's not the proper way of checking if someone is an admin, not mentioning you shouldn't check if someone is an admin every single frame.. All in all, this kind of script is something that is very hard to achieve for someone who doesn't know much about scripting @-=I Blaawee I=- : I suggest you try to do easier things so you can learn more Link to comment
Charlie_Jefferson Posted November 5, 2011 Share Posted November 5, 2011 well thePlayer = nil because onClientRender has no parametersand that's not the proper way of checking if someone is an admin, not mentioning you shouldn't check if someone is an admin every single frame.. All in all, this kind of script is something that is very hard to achieve for someone who doesn't know much about scripting @-=I Blaawee I=- : I suggest you try to do easier things so you can learn more I know it's hard to achieve. I knew that, but I thought it can be done with my script. Seems not. Link to comment
Blaawee Posted November 5, 2011 Author Share Posted November 5, 2011 soildsnake i realy want to learn let's do it what if i put local screen size like [voice] and put the shadow Link to comment
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