Jump to content

need help


Blaawee

Recommended Posts

-- 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

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 by Guest
Link to comment
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

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
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 by Guest
Link to comment

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
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...