Jump to content

Khalil

Members
  • Posts

    41
  • Joined

  • Last visited

Details

  • Gang
    RRC

Khalil's Achievements

Rat

Rat (9/54)

0

Reputation

  1. Khalil

    How to do ?

    No. Use this to show the GUI bindKey ( "--button--", "down", showGUI ) Then this to hide it bindKey ( "--button--", "up", hideGUI )
  2. It is already defined, clientside.
  3. localPlayer is clientsided, use source.
  4. Client: theMarker = createMarker(2144.6176757813,-1688.2725830078,14.0859375, "cylinder", 2, 204, 0, 204,170) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end drugWindow = guiMyCwindow(301,250,"Buy Drugs") guiSetVisible(drugWindow, false) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,drugWindow) GUIEditor_Button[1] = guiCreateButton(179,200,110,36,"Cancel",false,drugWindow) GUIEditor_Label[2] = guiCreateLabel(19,33,273,50,"Weed ( x 5 )",false,drugWindow) guiLabelSetColor( GUIEditor_Label[2], 0,255,0 ) GUIEditor_Label[3] = guiCreateLabel(19,50,273,50,"Speed ( x 5 )",false,drugWindow) guiLabelSetColor( GUIEditor_Label[3], 204,0,204 ) GUIEditor_Label[4] = guiCreateLabel(19,67,273,50,"Eroine ( x 5 )",false,drugWindow) guiLabelSetColor( GUIEditor_Label[4], 255,255,0 ) GUIEditor_Label[5] = guiCreateLabel(19,84,273,50,"LSD ( x 5 )",false,drugWindow) guiLabelSetColor( GUIEditor_Label[5], 0,0,255 ) GUIEditor_Label[6] = guiCreateLabel(19,101,273,50,"God ( x 5 )",false,drugWindow) guiLabelSetColor( GUIEditor_Label[6], 255,0,0 ) GUIEditor_Button[2] = guiCreateButton(95,33,70,15,"1000$",false,drugWindow) GUIEditor_Button[3] = guiCreateButton(95,50,70,15,"1500$",false,drugWindow) GUIEditor_Button[4] = guiCreateButton(95,67,70,15,"1200$",false,drugWindow) GUIEditor_Button[5] = guiCreateButton(95,84,70,15,"800$",false,drugWindow) GUIEditor_Button[6] = guiCreateButton(95,101,70,15,"2000$",false,drugWindow) function openDrugGui ( localPlayer ) guiSetVisible(drugWindow, true) showCursor(true) end addEventHandler ( "onClientMarkerHit", getRootElement(), openDrugGui ) function removeDrugWindow() guiSetVisible(drugWindow, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , removeDrugWindow, false) function buyWeed(localPlayer) local pMoney = getPlayerMoney(localPlayer) if ( pMoney > 1000 ) then triggerServerEvent("takemoney",localPlayer) end end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , buyWeed, false) Server: function moneyTake() takePlayerMoney(source,1000) end addEvent("takemoney",true) addEventHandler("takemoney",getRootElement(),moneyTake)
  5. oh lol that was a mistake.. so I have this now: function search() for index, player in ipairs ( getElementsByType ( 'player' ) ) do if ( player ~= localPlayer ) then local search = guiGetText(searchBar) string.match(index,search) end end end addEventHandler("onClientGUIChanged",searchBar,search)
  6. Ok so, I have this: function search() for index, player in ipairs ( getElementsByType ( 'player' ) ) do if ( player ~= localPlayer ) then local item = guiGridListGetSelectedItem(gridList) local player = guiGridListGetItemText(gridList,item,0) local search = guiGetText(searchBar) string.match(player,search) end end end addEventHandler("onClientGUIChanged",searchBar,search) How do I remove all the other rows and just have the matched player(s)?
  7. How exactly do I do that?
  8. How do I make it like lil_Toady's admin panel? I made a gridlist, got all the server players in there, and added an editbox.
  9. Works fine thanks Also, when a player leaves the server, the gridlist should automatically refresh, how do I do that?
  10. Hello. I made a gridlist to get all players in the server. I do the command to open the gui and it looks fine. I close the gui, and open it again, then I find three of the same player on the gridlist, I don't know what to do, here's the code: function showGUI ( ) local tostate = not guiGetVisible ( win ) guiSetVisible ( win, tostate ) showCursor ( tostate ) for index, player in ipairs ( getElementsByType ( 'player' ) ) do if ( player ~= localPlayer ) then guiGridListSetItemText ( gridList, guiGridListAddRow ( gridList ), 1, getPlayerName ( player ), false, false ) end end end addCommandHandler("aj",showGUI)
  11. Whatever I do, whenever I use getZoneName, only the zone appears and not the city. local x,y,z = getElementPosition (lp) location = getZoneName ( x, y, z, false) guiSetText(memoThree,location) I even changed location = getZoneName ( x, y, z, false) to location = getZoneName ( x, y, z, true) But still, the city isn't put in the memo, just the zone...
  12. local x,y,z = getElementPosition (lp) guiSetText(memo,math.round(x,3)..","..math.round(y,3)..","..math.round(z,3)) Debug Script says: "attempt to call field 'round' a nil value"
  13. Is it possible to disable clicking on a gridlist's column title?
  14. local lp = getLocalPlayer ( ) local marker = createMarker ( 2043, 1557, 10, "cylinder", 2.0, 0, 0, 255, 0 ) local ped = createPed ( 59, 2043, 1557, 10 ) createBlipAttachedTo ( marker, 25 ) sx, sy = guiGetScreenSize () win = guiCreateWindow(282, 212, 462, 285, "Drug Dealer Job Description", false) guiWindowSetSizable(win, false) buttonCancel = guiCreateButton(49, 236, 119, 39, "Cancel", false, win) buttonAccept = guiCreateButton(270, 236, 119, 39, "Accept", false, win) memoOne = guiCreateMemo(9, 24, 443, 206, "Spawn a boat and go to the marker on your map. Buy some drugs and go to the next marker to sell your drugs.", false, win) guiMemoSetReadOnly(memoOne, true) guiSetVisible ( win, false ) drugsWindow = guiCreateWindow(328, 235, 455, 304, "Drugs Market", false) guiWindowSetSizable(drugsWindow, false) gridList = guiCreateGridList(9, 25, 429, 216, false, drugsWindow) guiGridListAddColumn(gridList, "Drug", 0.3) guiGridListAddColumn(gridList, "Buy for", 0.3) guiGridListAddColumn(gridList, "Sell for", 0.3) for i = 1, 5 do guiGridListAddRow(gridList) end meth = guiGridListSetItemText(gridList, 0, 1, "Meth", false, false) guiGridListSetItemText(gridList, 0, 2, "$500,000", false, false) guiGridListSetItemText(gridList, 0, 3, "$750,000", false, false) cocaine = guiGridListSetItemText(gridList, 1, 1, "Cocaine", false, false) guiGridListSetItemText(gridList, 1, 2, "$50,000", false, false) guiGridListSetItemText(gridList, 1, 3, "$100,000", false, false) heroin = guiGridListSetItemText(gridList, 2, 1, "Heroin", false, false) guiGridListSetItemText(gridList, 2, 2, "$25,000", false, false) guiGridListSetItemText(gridList, 2, 3, "$40,000", false, false) ecstasy = guiGridListSetItemText(gridList, 3, 1, "Ecstasy", false, false) guiGridListSetItemText(gridList, 3, 2, "$15,000", false, false) guiGridListSetItemText(gridList, 3, 3, "$25,000", false, false) marijuana = guiGridListSetItemText(gridList, 4, 1, "Marijuana", false, false) guiGridListSetItemText(gridList, 4, 2, "$5,000", false, false) guiGridListSetItemText(gridList, 4, 3, "$7,500", false, false) guiGridListSetSelectionMode ( gridList, 0 ) buttonCancelTwo = guiCreateButton(38, 247, 118, 47, "Cancel", false, drugsWindow) buttonBuy = guiCreateButton(263, 247, 118, 47, "Buy", false, drugsWindow) guiSetVisible ( drugsWindow, false ) function openGUI ( p ) if ( getElementType ( p ) ~= 'player' or p ~= localPlayer ) then return end if ( getElementModel (lp) ) == 59 then outputChatBox ( "You already have this job", 255, 0, 0 ) return end guiSetVisible ( win, true ) showCursor ( true ) end addEventHandler("onClientMarkerHit", marker, openGUI ) addEventHandler ("onClientGUIClick",root, function () if (source == buttonCancel ) then guiSetVisible ( win, false ) showCursor ( false ) elseif (source == buttonAccept ) then guiSetVisible ( win, false ) showCursor ( false ) triggerServerEvent ("setTeam", lp) setElementModel ( lp, 59 ) drugsMarker = createMarker ( 2048, 1584, 10, "cylinder", 2.0, 255, 0, 0, 255 ) createBlipAttachedTo ( drugsMarker, 41, 2, 255, 0, 0, 255, 0, 65535 ) addEventHandler("onClientMarkerHit", drugsMarker, openDrugsGUI ) end end ) function invPed() cancelEvent() end addEventHandler("onClientPedDamage", ped, invPed) function openDrugsGUI ( p ) if ( getElementType ( p ) == "player" and p == lp ) then guiSetVisible ( drugsWindow, true ) showCursor ( true ) end end addEventHandler ( "onClientGUIClick", root, function ( ) if ( source == buttonCancelTwo ) then guiSetVisible ( drugsWindow, false ) showCursor ( false ) elseif ( source == buttonBuy ) then guiSetVisible ( drugsWindow, false ) showCursor ( false ) outputChatBox ( "Go to the marker to sell your drugs" ) destroyElement ( drugsMarker ) drugBought = guiGridListGetSelectedItem ( gridList ) if ( drugBought == meth ) then if ( getPlayerMoney ( ) >= 500000 ) then triggerServerEvent ( "takeMoney", lp, 500000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == cocaine ) then if ( getPlayerMoney ( ) >= 50000 ) then triggerServerEvent ( "takeMoney", lp, 50000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == heroin ) then if ( getPlayerMoney ( ) >= 25000 ) then triggerServerEvent ( "takeMoney", lp, 25000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == ecstasy ) then if ( getPlayerMoney ( ) >= 15000 ) then triggerServerEvent ( "takeMoney", lp, 15000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end elseif ( drugBought == marijuana ) then if ( getPlayerMoney ( ) >= 5000 ) then triggerServerEvent ( "takeMoney", lp, 5000 ) else outputChatBox ( "You don't have enough money for that", 255, 0, 0 ) end end end end ) SERVER local CrimTeam = createTeam ( "Criminal" ) function takejob () if ( CrimTeam ) then outputChatBox ( "Go to the marker to buy drugs", source, 0, 255, 0 ) setPlayerTeam(source, CrimTeam ) end end addEvent ( "setTeam", true ) addEventHandler ( "setTeam", root, takejob ) function moneyTake () outputChatBox ( "Go to the marker to sell your drugs", source ) end addEvent ("takeMoney", true) addEventHandler ( "takeMoney", root, moneyTake ) Still no money is taken from the player.. Also, it doesn't even check if the player has enough money or not, but it still outputs "Go to the marker to sell your drugs"...
×
×
  • Create New...