Jump to content

help me in jail panal scripts


adward

Recommended Posts

Posted

hi guys

i make jail panal

but button jail and unjail not work

please some one help me

this client side:

  
GUIEditor_Window[1] = guiCreateWindow(212,58,358,493,"jail script",false) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Edit[1] = guiCreateEdit(187,132,162,42,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
GUIEditor_Button[1] = guiCreateButton(206,224,122,44,"jail",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(206,324,119,38,"unjail",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(194,94,124,35,"Player Name:",false,GUIEditor_Window[1]) 
function update() 
playerName = getPlayerName ( getLocalPlayer() ) 
        playerList = guiCreateGridList(10,23,174,461,false,GUIEditor_Window[1]) 
        guiGridListSetSelectionMode(playerList,2) 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then  
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), update) 
addEventHandler("onClientPlayerJoin", getRootElement(), update) 
addEventHandler("onClientPlayerQuit", getRootElement(), update) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), update) 
  
  
function click ()  
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( GUIEditor_Edit[1], playerName ) 
end 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
  if (source == GUIEditor_Button[1]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("jail", getLocalPlayer(), playerNick)   
  elseif (source == GUIEditor_Button[2]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("unjail", getLocalPlayer(), playerNick) 
  end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  

server side:

  
addEvent("jail",true)  
  
addEventHandler("jail",root,  
  
function() 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(name) 
     local theVehicle = getPedOccupiedVehicle(thePlayer) 
     if not thePlayer then return end 
             if theVehicle then 
            removePedFromVehicle(thePlayer) 
        end  
     if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",player,255,0,0) return end 
     setElementInterior ( thePlayer, 0 ) 
     setElementPosition (thePlayer, -2354.158203125, 1922.5645751953, 693.34704589844) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." you are in jail now", getRootElement(), 255, 0, 0, true ) 
     showPlayerHudComponent (thePlayer, "weapon", false) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)   
     end 
end) 
  
  
addEvent("unjail",true)  
  
addEventHandler("unjail",root,  
  
function() 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(player)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(name) 
     if thePlayer then 
     if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",player,255,0,0) return end 
     setElementInterior ( thePlayer, 0) 
     setElementPosition ( thePlayer, -2313.3076171875, 1902.7426757813, 9.9688625335693) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.."yor are out the jail now"..name, getRootElement(), 0, 255, 0, true ) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)   
     end 
end) 
  

Posted
the server side look like not your who make.

TAPL

client side:

i make with my self

sreve side:

i got it from another script

if you know how to make it please help me

i not know alot things about script

iam new scriptior

thanks you for reply

Posted

Try This :

Client

  
  
GUIEditor_Window[1] = guiCreateWindow(212,58,358,493,"jail script",false) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Edit[1] = guiCreateEdit(187,132,162,42,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
GUIEditor_Button[1] = guiCreateButton(206,224,122,44,"jail",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(206,324,119,38,"unjail",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(194,94,124,35,"Player Name:",false,GUIEditor_Window[1]) 
function update() 
playerName = getPlayerName ( getLocalPlayer() ) 
        playerList = guiCreateGridList(10,23,174,461,false,GUIEditor_Window[1]) 
        guiGridListSetSelectionMode(playerList,2) 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then 
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), update) 
addEventHandler("onClientPlayerJoin", getRootElement(), update) 
addEventHandler("onClientPlayerQuit", getRootElement(), update) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), update) 
  
  
function click () 
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( GUIEditor_Edit[1], playerName ) 
end 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
  if (source == GUIEditor_Button[1]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("jail", getLocalPlayer(),getLocalPlayer(), playerNick)   
  elseif (source == GUIEditor_Button[2]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("unjail", getLocalPlayer(),getLocalPlayer(), playerNick) 
  end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  

Server

  
  
addEvent("jail",true) 
  
addEventHandler("jail",root, 
  
function(IM,HIM) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(HIM) 
     local theVehicle = getPedOccupiedVehicle(thePlayer) 
     if not thePlayer then return end 
             if theVehicle then 
            removePedFromVehicle(thePlayer) 
        end 
     if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",IM,255,0,0) return end 
     setElementInterior ( thePlayer, 0 ) 
     setElementPosition (thePlayer, -2354.158203125, 1922.5645751953, 693.34704589844) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." you are in jail now", getRootElement(), 255, 0, 0, true ) 
     showPlayerHudComponent (thePlayer, "weapon", false) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end ) 
  
  
addEvent("unjail",true) 
  
addEventHandler("unjail",root, 
function(IM,HIM) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(HIM) 
     if thePlayer then 
     if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",IM,255,0,0) return end 
     setElementInterior ( thePlayer, 0) 
     setElementPosition ( thePlayer, -2313.3076171875, 1902.7426757813, 9.9688625335693) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.."yor are out the jail now"..name, getRootElement(), 0, 255, 0, true ) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end 
end 
 ) 
  

Now You Have To Do Bind Key Or add a Command To Show Your Panel :wink:

Posted
Try This :

Server

  
  
addEvent("jail",true) 
  
addEventHandler("jail",root, 
  
function(IM,HIM) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(HIM) 
     local theVehicle = getPedOccupiedVehicle(thePlayer) 
     if not thePlayer then return end 
             if theVehicle then 
            removePedFromVehicle(thePlayer) 
        end 
     if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",IM,255,0,0) return end 
     setElementInterior ( thePlayer, 0 ) 
     setElementPosition (thePlayer, -2354.158203125, 1922.5645751953, 693.34704589844) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." you are in jail now", getRootElement(), 255, 0, 0, true ) 
     showPlayerHudComponent (thePlayer, "weapon", false) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end ) 
  
  
addEvent("unjail",true) 
  
addEventHandler("unjail",root, 
function(IM,HIM) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(HIM) 
     if thePlayer then 
     if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",IM,255,0,0) return end 
     setElementInterior ( thePlayer, 0) 
     setElementPosition ( thePlayer, -2313.3076171875, 1902.7426757813, 9.9688625335693) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.."yor are out the jail now"..name, getRootElement(), 0, 255, 0, true ) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end 
end 
 ) 
  

Now You Have To Do Bind Key Or add a Command To Show Your Panel :wink:

server side not work

ERROR:

server.lua

line 9 and line 32

attemt to call global getPlayerFromPartOfName(HIM)

Posted
  
function getPlayerFromPartOfName(playerPart) 
  local pl = getPlayerFromName(playerPart) 
  if isElement(pl) then 
    return pl 
  else 
    for i,v in ipairs (getElementsByType ("player")) do 
      if (string.find(getPlayerName(v),playerPart)) then 
        return v 
      end 
    end 
  end 
end 
  
addEvent("jail",true) 
addEventHandler("jail",root, 
function(IM,HIM) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(HIM) 
     local theVehicle = getPedOccupiedVehicle(thePlayer) 
     if not thePlayer then return end 
             if theVehicle then 
            removePedFromVehicle(thePlayer) 
        end 
     if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",IM,255,0,0) return end 
     setElementInterior ( thePlayer, 0 ) 
     setElementPosition (thePlayer, -2354.158203125, 1922.5645751953, 693.34704589844) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." you are in jail now", getRootElement(), 255, 0, 0, true ) 
     showPlayerHudComponent (thePlayer, "weapon", false) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end) 
  
  
addEvent("unjail",true) 
addEventHandler("unjail",root, 
function(IM,HIM) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(HIM) 
     if thePlayer then 
     if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",IM,255,0,0) return end 
     setElementInterior ( thePlayer, 0) 
     setElementPosition ( thePlayer, -2313.3076171875, 1902.7426757813, 9.9688625335693) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.."yor are out the jail now"..name, getRootElement(), 0, 255, 0, true ) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end 
end) 

Posted
  
function getPlayerFromPartOfName(playerPart) 
  local pl = getPlayerFromName(playerPart) 
  if isElement(pl) then 
    return pl 
  else 
    for i,v in ipairs (getElementsByType ("player")) do 
      if (string.find(getPlayerName(v),playerPart)) then 
        return v 
      end 
    end 
  end 
end 
  
addEvent("jail",true) 
addEventHandler("jail",root, 
function(IM,HIM) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(HIM) 
     local theVehicle = getPedOccupiedVehicle(thePlayer) 
     if not thePlayer then return end 
             if theVehicle then 
            removePedFromVehicle(thePlayer) 
        end 
     if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",IM,255,0,0) return end 
     setElementInterior ( thePlayer, 0 ) 
     setElementPosition (thePlayer, -2354.158203125, 1922.5645751953, 693.34704589844) 
     setElementData ( thePlayer, "isJailed", true ) 
     outputChatBox (name.." you are in jail now", getRootElement(), 255, 0, 0, true ) 
     showPlayerHudComponent (thePlayer, "weapon", false) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end) 
  
  
addEvent("unjail",true) 
addEventHandler("unjail",root, 
function(IM,HIM) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(HIM) 
     if thePlayer then 
     if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",IM,255,0,0) return end 
     setElementInterior ( thePlayer, 0) 
     setElementPosition ( thePlayer, -2313.3076171875, 1902.7426757813, 9.9688625335693) 
     setElementData ( thePlayer, "isJailed", false ) 
     outputChatBox (name.."yor are out the jail now"..name, getRootElement(), 0, 255, 0, true ) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end 
end) 

Its work now

thanks you so much

Posted (edited)

Client

  
  
GUIEditor_Window[1] = guiCreateWindow(212,58,358,493,"jail script",false) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Edit[1] = guiCreateEdit(187,132,162,42,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
GUIEditor_Button[1] = guiCreateButton(206,224,122,44,"jail",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(206,324,119,38,"unjail",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(194,94,124,35,"Player Name:",false,GUIEditor_Window[1]) 
function update() 
playerName = getPlayerName ( getLocalPlayer() ) 
        playerList = guiCreateGridList(10,23,174,461,false,GUIEditor_Window[1]) 
        guiGridListSetSelectionMode(playerList,2) 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then 
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), update) 
addEventHandler("onClientPlayerJoin", getRootElement(), update) 
addEventHandler("onClientPlayerQuit", getRootElement(), update) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), update) 
  
  
function click () 
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( GUIEditor_Edit[1], playerName ) 
end 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
  if (source == GUIEditor_Button[1]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("jail", getLocalPlayer(),getLocalPlayer(), playerNick)   
  elseif (source == GUIEditor_Button[2]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("unjail", getLocalPlayer(),getLocalPlayer(), playerNick) 
  end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) 
  

just 1 Question

I Need jail player for 1 min

60 sec

How to do this in client side

and show player on screen

Time remaining

any one helpme

Edited by Guest
Posted
ok, I'm confused, What's the problem?

I Need jail player for 1 min

60 sec

How to do this in client side

and show player on screen

Time remaining

Posted
so, Where does the gui come from?
GUIEditor_Window[1] = guiCreateWindow(212,58,358,493,"jail script",false) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Edit[1] = guiCreateEdit(187,132,162,42,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
GUIEditor_Button[1] = guiCreateButton(206,224,122,44,"jail",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(206,324,119,38,"unjail",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(194,94,124,35,"Player Name:",false,GUIEditor_Window[1]) 
function update() 
playerName = getPlayerName ( getLocalPlayer() ) 
        playerList = guiCreateGridList(10,23,174,461,false,GUIEditor_Window[1]) 
        guiGridListSetSelectionMode(playerList,2) 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then 
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), update) 
addEventHandler("onClientPlayerJoin", getRootElement(), update) 
addEventHandler("onClientPlayerQuit", getRootElement(), update) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), update) 
  
  
function click () 
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( GUIEditor_Edit[1], playerName ) 
end 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
  if (source == GUIEditor_Button[1]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("jail", getLocalPlayer(),getLocalPlayer(), playerNick)   
  elseif (source == GUIEditor_Button[2]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("unjail", getLocalPlayer(),getLocalPlayer(), playerNick) 
  end 
end 
  

Posted
To show the time search it was asked about not a long time ago

i Know to make time in server side

but i need know how to make in client side

if you know help me

Posted

I've fixed your script adward:

Server-side

  
addEvent("jail",true) 
  
addEventHandler("jail",root, 
  
function(playerNick) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(playerNick) 
     local theVehicle = getPedOccupiedVehicle(thePlayer) 
     if not thePlayer then return end 
             if theVehicle then 
            removePedFromVehicle(thePlayer) 
        end 
     if (getElementData( thePlayer, "isJailed") == "yes") then outputChatBox("This player is already in jail.",source,255,0,0) return end 
     setElementInterior ( thePlayer, 0 ) 
     setElementPosition (thePlayer, -2354.158203125, 1922.5645751953, 693.34704589844) 
     setElementData ( thePlayer, "isJailed", "yes" ) 
     outputChatBox (playerNick.." you are in jail now", getRootElement(), 255, 0, 0, true ) 
     showPlayerHudComponent (thePlayer, "weapon", false) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end) 
  
  
addEvent("unjail",true) 
  
addEventHandler("unjail",root, 
  
function(playerNick) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(playerNick) 
     if thePlayer then 
     if not (getElementData( thePlayer, "isJailed") == "no") then outputChatBox("This player is not in jail.",source,255,0,0) return end 
     setElementInterior ( thePlayer, 0) 
     setElementPosition ( thePlayer, -2313.3076171875, 1902.7426757813, 9.9688625335693) 
     setElementData ( thePlayer, "isJailed", "no" ) 
     outputChatBox (playerNick.."yor are out the jail now"..name, getRootElement(), 0, 255, 0, true ) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end) 

Client-side

function create() 
GUIEditor_Window[1] = guiCreateWindow(212,58,358,493,"jail script",false) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Edit[1] = guiCreateEdit(187,132,162,42,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
GUIEditor_Button[1] = guiCreateButton(206,224,122,44,"jail",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(206,324,119,38,"unjail",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(194,94,124,35,"Player Name:",false,GUIEditor_Window[1]) 
playerList = guiCreateGridList(10,23,174,461,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(playerList,2) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, create) 
  
function update() 
playerName = getPlayerName ( getLocalPlayer() ) 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then 
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), update) 
addEventHandler("onClientPlayerQuit", getRootElement(), update) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), update) 
  
  
function click () 
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( GUIEditor_Edit[1], playerName ) 
end 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
  if (source == GUIEditor_Button[1]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("jail", getLocalPlayer(), playerNick)   
     
  elseif (source == GUIEditor_Button[2]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("unjail", getLocalPlayer(), playerNick) 
  end 
end 
addEventHandler ("onClientGUIClick", GUIEditor_Window[1], onGuiClick) 

Posted
I've fixed your script adward:

Server-side

  
addEvent("jail",true) 
  
addEventHandler("jail",root, 
  
function(playerNick) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(playerNick) 
     local theVehicle = getPedOccupiedVehicle(thePlayer) 
     if not thePlayer then return end 
             if theVehicle then 
            removePedFromVehicle(thePlayer) 
        end 
     if (getElementData( thePlayer, "isJailed") == "yes") then outputChatBox("This player is already in jail.",source,255,0,0) return end 
     setElementInterior ( thePlayer, 0 ) 
     setElementPosition (thePlayer, -2354.158203125, 1922.5645751953, 693.34704589844) 
     setElementData ( thePlayer, "isJailed", "yes" ) 
     outputChatBox (playerNick.." you are in jail now", getRootElement(), 255, 0, 0, true ) 
     showPlayerHudComponent (thePlayer, "weapon", false) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end) 
  
  
addEvent("unjail",true) 
  
addEventHandler("unjail",root, 
  
function(playerNick) 
    if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(source)), aclGetGroup ( "Admin" ) ) then 
     local thePlayer = getPlayerFromPartOfName(playerNick) 
     if thePlayer then 
     if not (getElementData( thePlayer, "isJailed") == "no") then outputChatBox("This player is not in jail.",source,255,0,0) return end 
     setElementInterior ( thePlayer, 0) 
     setElementPosition ( thePlayer, -2313.3076171875, 1902.7426757813, 9.9688625335693) 
     setElementData ( thePlayer, "isJailed", "no" ) 
     outputChatBox (playerNick.."yor are out the jail now"..name, getRootElement(), 0, 255, 0, true ) 
    else 
        outputChatBox ("Access denied", thePlayer, 193, 13, 13)  
     end 
end) 

Client-side

function create() 
GUIEditor_Window[1] = guiCreateWindow(212,58,358,493,"jail script",false) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Edit[1] = guiCreateEdit(187,132,162,42,"",false,GUIEditor_Window[1]) 
guiEditSetReadOnly(GUIEditor_Edit[1],true) 
GUIEditor_Button[1] = guiCreateButton(206,224,122,44,"jail",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(206,324,119,38,"unjail",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(194,94,124,35,"Player Name:",false,GUIEditor_Window[1]) 
playerList = guiCreateGridList(10,23,174,461,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(playerList,2) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, create) 
  
function update() 
playerName = getPlayerName ( getLocalPlayer() ) 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then 
                for id, playeritem in ipairs(getElementsByType("player")) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", playerList, click ) 
        end 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), update) 
addEventHandler("onClientPlayerQuit", getRootElement(), update) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), update) 
  
  
function click () 
       local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
       guiSetText ( GUIEditor_Edit[1], playerName ) 
end 
  
function onGuiClick (button, state, absoluteX, absoluteY) 
  if (source == GUIEditor_Button[1]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("jail", getLocalPlayer(), playerNick)   
     
  elseif (source == GUIEditor_Button[2]) then 
    playerNick = guiGetText ( GUIEditor_Edit[1] ) 
    triggerServerEvent ("unjail", getLocalPlayer(), playerNick) 
  end 
end 
addEventHandler ("onClientGUIClick", GUIEditor_Window[1], onGuiClick) 

thanks you so much for help me

what about setTimer i tired to make it

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