Jump to content

x[ سوال ]x فكشن getPlayerIP


Recommended Posts

سلام عليكم انا جيت اسئل بس عن خطا

انا عامل لابل ابي يجي اي بي الاعب اكيد بتكون سرفر

triggerServerEvent("ip",localPlayer) 
addEvent("ip",true) 
addEventHandler("ip",root, 
    function(ip) 
        guiSetText(GUIEditor_Label[16],tostring(ip))   
    end 
) 
  
  
server - 
addEvent("ip",true) 
function ip() 
    local IP = getPlayerIP(source) 
    triggerClientEvent(source,"ip", source,IP) 
end 
addEventHandler("ip",root,ip) 
Link to comment
  
--client 
addEventHandler("onClientRendar",root,function() 
triggerServerEvent("ip",localPlayer) 
end) 
  
addEvent("ip2",true) 
addEventHandler("ip2",root,function(IP) 
guiSetText(GUIEditor_Label[16]," "..IP) 
end) 
  

  
--server 
addEvent("ip",true) 
addEventHandler("ip",root,function() 
local IP = getPlayerIP(source) 
triggerClientEvent("ip2",source,IP) 
end) 
  

Link to comment

سو حدث إذا مثلاً اختار لاعب بالقريد يرسل التريقر للسيرفر عشان يجيب سيرياله

# Server :

addEvent ( "ip", true ) 
addEventHandler ( 'ip', getRootElement ( ), 
    function ( player ) 
        local who = getPlayerFromName ( player ) 
        local ip = getPlayerIP ( who ) 
            triggerClientEvent ("getIP", source, ip) 
    end 
) 

# Client :

addEventHandler("getIP",root, 
    function( ip ) 
        guiSetText(LabelName,ip)   
    end 
) 

Link to comment

أكوادك صحيحة بس ضيف السكربت لقروب الأدمن

  
--client 
addEventHandler("onClientRendar",root,function() 
triggerServerEvent("ip",localPlayer) 
end) 
  

:lol: ترايقر مع رندر؟

Edited by Guest
Link to comment
  
--client 
addEventHandler("onClientRendar",root,function() 
triggerServerEvent("ip",localPlayer) 
end) 
  
addEvent("ip2",true) 
addEventHandler("ip2",root,function(IP) 
guiSetText(GUIEditor_Label[16]," "..IP) 
end) 
  

  
--server 
addEvent("ip",true) 
addEventHandler("ip",root,function() 
local IP = getPlayerIP(source) 
triggerClientEvent("ip2",source,IP) 
end) 
  

" onClientRendar "

الإفنت غلط

Link to comment

كدا؟

addEventHandler("onClientRendar",root,function() 
  if source == button then 
    local sel = guiGridListGetSelectedItem(grid) 
    local text = guiGridListGetItemText(grid,sel,1) 
                if ( sel ~= -1 ) then 
     triggerServerEvent("killPlayer",localPlayer,text) 
     end 
    end 
end) 
  
  
  
Server  
  
addEvent("killPlayer",true) 
addEventHandler("killPlayer",root, 
    function (player) 
        local player = getPlayerFromName(player) 
        if ( player ) then 
            killPed(player) 
        end 
    end 
) 
  

Link to comment

addEventHandler("onClientRendar",root,function() 
  if source == button then 

وش دا ؟ انا لو مكانك اروح انتحر ههههههههههههههههههههههههههههههههههههههههههه

+ عندك اند زياده

المهمم

Client Side :

function guiGridListGetSelectedItemText ( gridList, column ) 
    local item = guiGridListGetSelectedItem ( gridList ) 
    local text = guiGridListGetItemText ( gridList, item, column or 1 ) 
    if ( text ~= '' ) then 
        return text 
    else 
        return false 
    end 
end 
  
addEventHandler("onClientGUIClick",Y_Button, 
function ( ) 
    local Selected , Player_N = guiGridListGetSelectedItem(Y_GridList) , guiGridListGetSelectedItemText ( Y_GridList, Y_Column ) 
        local Player = getPlayerFromName( Player_N ) 
            local xPos , yPos , zPos = getElementVelocity ( Player ) 
                if ( Selected ~= -1 ) then 
                    triggerServerEvent("Ped_Kill",localPlayer , xPos , yPos , zPos , Player) 
    end 
end , false ) 

Server Side :

addEvent("Ped_Kill",true) 
addEventHandler("Ped_Kill",root, 
function ( xPos , yPos , zPos , Player ) 
    setElementVelocity( Player , xPos , yPos , zPos +1 ) 
    killPed(Player) 
end ) 

Link to comment
GUIEditor = { 
    gridlist = {}, 
    window = {}, 
    button = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(537, 139, 263, 431, "Police Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1],false) 
        GUIEditor.button[1] = guiCreateButton(13, 258, 236, 26, "Fix Car", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFEFEFE") 
        GUIEditor.button[2] = guiCreateButton(10, 327, 108, 38, "Kill / Slap", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF0BC4F3") 
        GUIEditor.button[3] = guiCreateButton(145, 327, 108, 38, "Destroy Car", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF0BC4F3") 
        GUIEditor.label[1] = guiCreateLabel(13, 370, 132, 15, "Your Name:", false, GUIEditor.window[1]) 
        GUIEditor.label[2] = guiCreateLabel(10, 401, 181, 15, "#Created By Rock | v1.2", false, GUIEditor.window[1]) 
        guiLabelSetColor(GUIEditor.label[2], 221, 7, 7) 
        GUIEditor.gridlist[1] = guiCreateGridList(10, 28, 244, 220, false, GUIEditor.window[1]) 
        guiGridListAddColumn(GUIEditor.gridlist[1], "Players", 0.9) 
        GUIEditor.button[4] = guiCreateButton(13, 291, 236, 26, "Blow Car", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFEFEFE")     
    end 
) 
  
  
addEvent ( 'open', true ) 
addEventHandler ( 'open', root, 
    function ( ) 
        if guiGetVisible ( GUIEditor.window[1]) then 
            guiSetVisible ( GUIEditor.window[1], false ) 
            showCursor ( false ) 
            guiSetInputEnabled ( false ) 
        else 
            guiSetVisible ( GUIEditor.window[1], true ) 
            showCursor ( true ) 
            guiSetInputEnabled ( false ) 
        end 
    end 
) 
  
function update () 
guiGridListClear(GUIEditor.gridlist[1]) 
for i,v in ipairs (getElementsByType("player")) do 
local rp = guiGridListAddRow (GUIEditor.gridlist[1]) 
guiGridListSetItemText (GUIEditor.gridlist[1],rp,1,getPlayerName(v):gsub("#%x%x%x%x%x%x", ""),false,false) 
end 
end 
addEventHandler ("onClientResourceStart",resourceRoot,update) 
addEventHandler ("onClientPlayerJoin",root,update) 
addEventHandler ("onClientPlayerChangeNick",root,update) 
addEventHandler ("onClientPlayerQuit",root,update) 
  
  
function guiGridListGetSelectedItemText ( GUIEditor.gridlist[1] , 1 ) 
    local item = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) 
    local text = guiGridListGetItemText ( GUIEditor.gridlist[1] , item, column or 1 ) 
    if ( text ~= '' ) then 
        return text 
    else 
        return false 
    end 
end 
  
addEventHandler("onClientGUIClick",Y_Button, 
function ( ) 
    local Selected , Player_N = guiGridListGetSelectedItem(GUIEditor.gridlist[1] ) , guiGridListGetSelectedItemText ( GUIEditor.gridlist[1], 1 ) 
        local Player = getPlayerFromName( Player_N ) 
            local xPos , yPos , zPos = getElementVelocity ( Player ) 
                if ( Selected ~= -1 ) then 
                    triggerServerEvent("Ped_Kill",localPlayer , xPos , yPos , zPos , Player) 
    end 
end , false )  
  

addEvent("Ped_Kill",true) 
addEventHandler("Ped_Kill",root, 
function ( xPos , yPos , zPos , Player ) 
    setElementVelocity( Player , xPos , yPos , zPos +1 ) 
    killPed(Player) 
end ) 

Link to comment

function guiGridListGetSelectedItemText ( GUIEditor.gridlist[1] , 1 ) 
    local item = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) 
    local text = guiGridListGetItemText ( GUIEditor.gridlist[1] , item, column or 1 ) 
    if ( text ~= '' ) then 
        return text 
    else 
        return false 
    end 
end 
  
  

دا ليش تعدله انت شكلك غبي ض1

+ مو طارح مود السيرفر كامل

+ خليت المود كلينت فقط

GUIEditor = { gridlist = {}, window = {}, button = {}, label = {} } 
  
GUIEditor.window[1] = guiCreateWindow(537, 139, 263, 431, "Police Panel", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetVisible(GUIEditor.window[1],false) 
GUIEditor.button[1] = guiCreateButton(13, 258, 236, 26, "Fix Car", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFEFEFE") 
GUIEditor.button[2] = guiCreateButton(10, 327, 108, 38, "Kill / Slap", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF0BC4F3") 
GUIEditor.button[3] = guiCreateButton(145, 327, 108, 38, "Destroy Car", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF0BC4F3") 
GUIEditor.label[1] = guiCreateLabel(13, 370, 132, 15, "Your Name:", false, GUIEditor.window[1]) 
GUIEditor.label[2] = guiCreateLabel(10, 401, 181, 15, "#Created By Rock | v1.2", false, GUIEditor.window[1]) 
guiLabelSetColor(GUIEditor.label[2], 221, 7, 7) 
GUIEditor.gridlist[1] = guiCreateGridList(10, 28, 244, 220, false, GUIEditor.window[1]) 
Column_N = guiGridListAddColumn(GUIEditor.gridlist[1], "Players", 0.9) 
GUIEditor.button[4] = guiCreateButton(13, 291, 236, 26, "Blow Car", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFEFEFE")     
  
addEvent ( 'open', true ) 
addEventHandler ( 'open', root, 
function ( ) 
local Get_ = not guiGetVisible( GUIEditor.window[1] ) 
    guiSetVisible ( GUIEditor.window[1], not Get_ ) 
    showCursor (  Get_ ) 
    guiSetInputEnabled ( false )  
end ) 
  
function Update_ () 
    guiGridListClear(GUIEditor.gridlist[1]) 
        for _,Player in ipairs (getElementsByType("player")) do 
            guiGridListSetItemText (GUIEditor.gridlist[1],guiGridListAddRow (GUIEditor.gridlist[1]),1,getPlayerName(Player):gsub("#%x%x%x%x%x%x", ""),false,false) 
    end 
end 
addEventHandler ("onClientResourceStart",resourceRoot,Update_) 
addEventHandler ("onClientPlayerJoin",root,Update_) 
addEventHandler ("onClientPlayerChangeNick",root,Update_) 
addEventHandler ("onClientPlayerQuit",root,Update_) 
  
  
function guiGridListGetSelectedItemText ( gridList, column ) 
    local item = guiGridListGetSelectedItem ( gridList ) 
    local text = guiGridListGetItemText ( gridList, item, column or 1 ) 
    if ( text ~= '' ) then 
        return text 
    else 
        return false 
    end 
end 
  
addEventHandler("onClientGUIClick",GUIEditor.button[2], 
function ( ) 
    local Selected , Player_N = guiGridListGetSelectedItem(GUIEditor.gridlist[1] ) , guiGridListGetSelectedItemText ( GUIEditor.gridlist[1], Column_N ) 
        local Player = getPlayerFromName( Player_N ) 
            local xPos , yPos , zPos = getElementVelocity ( Player ) 
                if ( Selected ~= -1 ) then 
                    setElementVelocity( Player , xPos , yPos , zPos +1 ) 
                    setElementHealth(Player,0) 
    end 
end , false ) 
Link to comment

# Client :

GUIEditor = { 
    gridlist = {}, 
    window = {}, 
    button = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(537, 139, 263, 431, "Police Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1],false) 
        GUIEditor.button[1] = guiCreateButton(13, 258, 236, 26, "Fix Car", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFEFEFE") 
        GUIEditor.button[2] = guiCreateButton(10, 327, 108, 38, "Kill / Slap", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF0BC4F3") 
        GUIEditor.button[3] = guiCreateButton(145, 327, 108, 38, "Destroy Car", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF0BC4F3") 
        GUIEditor.label[1] = guiCreateLabel(13, 370, 132, 15, "Your Name:", false, GUIEditor.window[1]) 
        GUIEditor.label[2] = guiCreateLabel(10, 401, 181, 15, "#Created By Rock | v1.2", false, GUIEditor.window[1]) 
        guiLabelSetColor(GUIEditor.label[2], 221, 7, 7) 
        GUIEditor.gridlist[1] = guiCreateGridList(10, 28, 244, 220, false, GUIEditor.window[1]) 
        guiGridListAddColumn(GUIEditor.gridlist[1], "Players", 0.9) 
        GUIEditor.button[4] = guiCreateButton(13, 291, 236, 26, "Blow Car", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFEFEFE")     
    end 
) 
  
  
addEvent ( 'open', true ) 
addEventHandler ( 'open', root, 
    function ( ) 
        if guiGetVisible ( GUIEditor.window[1]) then 
            guiSetVisible ( GUIEditor.window[1], false ) 
            showCursor ( false ) 
            guiSetInputEnabled ( false ) 
        else 
            guiSetVisible ( GUIEditor.window[1], true ) 
            showCursor ( true ) 
            guiSetInputEnabled ( false ) 
        end 
    end 
) 
  
function update () 
guiGridListClear(GUIEditor.gridlist[1]) 
for i,v in ipairs (getElementsByType("player")) do 
local rp = guiGridListAddRow (GUIEditor.gridlist[1]) 
guiGridListSetItemText (GUIEditor.gridlist[1],rp,1,getPlayerName(v):gsub("#%x%x%x%x%x%x", ""),false,false) 
end 
end 
addEventHandler ("onClientResourceStart",resourceRoot,update) 
addEventHandler ("onClientPlayerJoin",root,update) 
addEventHandler ("onClientPlayerChangeNick",root,update) 
addEventHandler ("onClientPlayerQuit",root,update) 
  
 addEventHandler ("onClientGUIClick", resourceRoot, 
  function () 
    if (source == GUIEditor.button[2]) then 
      local row = guiGridListGetSelectedItem (GUIEditor.gridlist[1]) 
      local select = guiGridListGetItemText (GUIEditor.gridlist[1], row, 1) 
      if (select and select ~= "") then 
        outputChatBox("#FF0000# #FFFFFFSuccessfully Killed The Player",255,0,0,true) 
        triggerServerEvent ("kill", localPlayer, select) 
      else 
        outputChatBox("#FF0000# #FFFFFFPlease Select A Player",255,0,0,true) 
      end 
    end 
  end 
) 

# Server :

addEvent ( "kill", true ) 
addEventHandler ( 'kill', getRootElement ( ), 
    function ( target ) 
        local player = getPlayerFromName ( target ) 
        local killed = getPlayerName ( player ) 
        killPed(killed) 
    end 
) 

Link to comment

لو تلاحظون هو حاذف اكواد الهيكس من اسم الاعب

عشان كذا ماراح يشتغل

و ينكست عندك شوي خربطة بالسيرفر

Client :

addEventHandler("onClientGUIClick",resourceRoot, 
function () 
  
if source == YourBnt then 
  
local Sel_ = guiGridListGetSelectedItem( YourGrid ) 
     
if ( Sel_ ) and ( Sel_ ~= -1 ) then  
  
local Player_ = guiGridListGetItemText ( YourGrid , Sel_, 1 ) -- بدل هنا رقم الكولمن 
  
triggerServerEvent ( "killPlayer_", localPlayer , Player_ ) 
  
        end 
    end 
end 
    ) 

Server :

function getPlayerFromPartialName(name) 
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil 
    if name then 
        for _, player in ipairs(getElementsByType("player")) do 
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() 
            if name_:find(name, 1, true) then 
                return player 
            end 
        end 
    end 
end 
  
  
addEvent ( "killPlayer_" , true ) 
  
addEventHandler ( "killPlayer_" , root , 
  
function ( PlayerName ) 
  
local player_ = getPlayerFromPartialName ( PlayerName ) 
  
if ( player_ ) then 
  
killPed ( player_ ) 
  
    end 
end 
 ) 
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...