adward Posted November 25, 2011 Share Posted November 25, 2011 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) Link to comment
TAPL Posted November 25, 2011 Share Posted November 25, 2011 the server side look like not your who make. Link to comment
adward Posted November 25, 2011 Author Share Posted November 25, 2011 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 Link to comment
Al3grab Posted November 25, 2011 Share Posted November 25, 2011 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 Link to comment
adward Posted November 25, 2011 Author Share Posted November 25, 2011 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 server side not work ERROR: server.lua line 9 and line 32 attemt to call global getPlayerFromPartOfName(HIM) Link to comment
TAPL Posted November 25, 2011 Share Posted November 25, 2011 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) Link to comment
adward Posted November 25, 2011 Author Share Posted November 25, 2011 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 Link to comment
adward Posted November 25, 2011 Author Share Posted November 25, 2011 (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 November 26, 2011 by Guest Link to comment
adward Posted November 25, 2011 Author Share Posted November 25, 2011 any one help me Link to comment
Jaysds1 Posted November 26, 2011 Share Posted November 26, 2011 ok, I'm confused, What's the problem? Link to comment
adward Posted November 26, 2011 Author Share Posted November 26, 2011 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 Link to comment
mjau Posted November 26, 2011 Share Posted November 26, 2011 To show the time search it was asked about not a long time ago Link to comment
Jaysds1 Posted November 26, 2011 Share Posted November 26, 2011 so, Where does the gui come from? Link to comment
adward Posted November 26, 2011 Author Share Posted November 26, 2011 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 Link to comment
adward Posted November 26, 2011 Author Share Posted November 26, 2011 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 Link to comment
Jaysds1 Posted November 26, 2011 Share Posted November 26, 2011 Is this going to be shown to the admin? Link to comment
adward Posted November 26, 2011 Author Share Posted November 26, 2011 Is this going to be shown to the admin? show player Time Remaining Link to comment
Jaysds1 Posted November 26, 2011 Share Posted November 26, 2011 Where would you like the timer to be shown? Link to comment
Al3grab Posted November 26, 2011 Share Posted November 26, 2011 For Timer You can use setTimer For Drawing the timer use dxDrawText also check this : viewtopic.php?f=91&t=36737#p378594 Link to comment
Jaysds1 Posted November 26, 2011 Share Posted November 26, 2011 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) Link to comment
adward Posted November 26, 2011 Author Share Posted November 26, 2011 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 Link to comment
Jaysds1 Posted November 26, 2011 Share Posted November 26, 2011 Do you want me to put the timer on the gui or show it to the player in jail? Link to comment
adward Posted November 26, 2011 Author Share Posted November 26, 2011 Do you want me to put the timer on the gui or show it to the player in jail? show it to the player in jail 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