nokizorque

Untitled

Apr 17th, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.03 KB | None | 0 0
  1. --Client--
  2. GUIEditor = {
  3.     gridlist = {},
  4.     window = {},
  5.     button = {}
  6. }
  7. thePickup = createPickup(567.61682, 405.20648, 18.92969, 3, 1275)
  8.  
  9. function theGUI(thePickup, matchingDimension)
  10.     if (getTeamName(getPlayerTeam(localPlayer) ~= "Police")) then
  11.         guiSetVisible(GUIEditor.window[1], true)
  12.         showCursor(true)
  13.         outputChatBox("Please pick a uniform.", 255, 255, 255, true)
  14.         --Window
  15.         GUIEditor.window[1] = guiCreateWindow(427, 233, 276, 197, "Police Uniforms", false)
  16.         guiWindowSetSizable(GUIEditor.window[1], false)
  17.         --Gridlist
  18.         GUIEditor.gridlist[1] = guiCreateGridList(49, 34, 170, 117, false, GUIEditor.window[1])
  19.         columnA = guiGridListAddColumn(GUIEditor.gridlist[1], "Uniforms", 0.9)
  20.         guiGridListAddRow(GUIEditor.gridlist[1])
  21.         row1 = guiGridListAddRow(GUIEditor.gridlist[1])
  22.         row2 = guiGridListAddRow(GUIEditor.gridlist[1])
  23.         row3 = guiGridListAddRow(GUIEditor.gridlist[1])
  24.         row4 = guiGridListAddRow(GUIEditor.gridlist[1])
  25.         row5 = guiGridListAddRow(GUIEditor.gridlist[1])
  26.         guiGridListSetItemText(GUIEditor.gridlist[1], row1, columnA, "Los Santos Cop", false, false)
  27.         guiGridListSetItemText(GUIEditor.gridlist[1], row2, columnA, "San Fierro Cop", false, false)
  28.         guiGridListSetItemText(GUIEditor.gridlist[1], row3, columnA, "Las Venturas Cop", false, false)
  29.         guiGridListSetItemText(GUIEditor.gridlist[1], row4, columnA, "Deputy Sheriff 1", false, false)
  30.         guiGridListSetItemText(GUIEditor.gridlist[1], row5, columnA, "Deputy Sheriff 2", false, false)
  31.         --Buttons
  32.         GUIEditor.button[1] = guiCreateButton(171, 155, 87, 32, "Close", false, GUIEditor.window[1])
  33.         guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
  34.         GUIEditor.button[2] = guiCreateButton(10, 156, 87, 31, "Take uniform", false, GUIEditor.window[1])
  35.         guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
  36.     else
  37.         outputChatBox("#ff0000You are not a cop to use this pickup.", 255, 0, 0, true)
  38.     end
  39. end
  40. addEventHandler("onClientPlayerPickupHit", localPlayer, theGUI)
  41.  
  42. --Close GUI
  43. --[[    function closeGUI()
  44.     if (source == GUIEditor.button[1]) then
  45.         guiSetVisible(GUIEditor.window[1], false)
  46.         showCursor(false)
  47.     end
  48. end
  49. addEventHandler("onClientGUIClick", guiRoot, closeGUI)  ]]
  50.  
  51. function closeUI()
  52.     guiSetVisible(GUIEditor.window[1], false)
  53.     showCursor(false)
  54. end
  55. addEventHandler("onClientGUIClick", GUIEditor.button[1], closeUI, true) -- Remove this line, and the function if closing it doesn't work.
  56.  
  57.  
  58.  
  59. --Set Skin
  60. function setPlayerSkin()
  61.     if (source == GUIEditor.button[2]) then
  62.         local row, col = guiGridListGetSelectedItem(GUIEditor.gridlist[1])
  63.         local skin = guiGridListGetItemText(GUIEditor.gridlist[1], row, col)
  64.         outputChatBox("Your uniform has been successfully changed")
  65.         fadeCamera(false, 1.0, 0, 0, 0)
  66.         setTimer(timer, 1000, 1)
  67.         playSFX("script", 94, 2, false)
  68.         if row == row1 then
  69.                 triggerServerEvent("skinID280", localPlayer)
  70.             elseif row == row2 then
  71.                 triggerServerEvent("skinID281", localPlayer)
  72.             elseif row == row3 then
  73.                 triggerServerEvent("skinID282", localPlayer)
  74.             elseif row == row4 then
  75.                 triggerServerEvent("skinID283", localPlayer)
  76.             elseif row == row5 then
  77.                 triggerServerEvent("skinID288", localPlayer)
  78.         end
  79.     end
  80. end
  81. addEventHandler("onClientGUIClick", root, setPlayerSkin)
  82.  
  83. --Server--
  84. function skinID280 (player)
  85.     setElementModel(player, 280)
  86. end
  87.  
  88. function skinID281 (player)
  89.     setElementModel(player, 281)
  90. end
  91. function skinID282 (player)
  92.     setElementModel(player, 282)
  93. end
  94.  
  95. function skinID283 (player)
  96.     setElementModel(player, 283)
  97. end
  98.  
  99. function skinID288 (player)
  100.     setElementModel(player, 288)
  101. end
  102.  
  103. addEvent("skinID280", true)
  104. addEvent("skinID281", true)
  105. addEvent("skinID282", true)
  106. addEvent("skinID283", true)
  107. addEvent("skinID288", true)
  108. addEventHandler("skinID280", root, skinID280)
  109. addEventHandler("skinID281", root, skinID281)
  110. addEventHandler("skinID282", root, skinID282)
  111. addEventHandler("skinID283", root, skinID283)
  112. addEventHandler("skinID288", root, skinID288)
Advertisement
Add Comment
Please, Sign In to add comment