Jump to content

DynamicBan

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by DynamicBan

  1. Ah thats why, it works now, thnx
  2. I'm trying to add a few trucker skins into a gridlist for a job. But I'm getting some bad arguments, here a ss. Here the script Skins = { {"Native Rancher", 128}, {"Furys Trucker", 133}, {"Beer Trucker", 202}, {"Money Trucker", 206} } function createWindow ( ) local sWidth, sHeight, X, Y = guiGetScreenSize ( ) local Width, Height = 500, 350 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) takeJobWindow = guiCreateWindow ( X, Y, Width, Height, "Trucker Job", false ) takeSkinGrid = guiCreateGridList ( 340, 30, 150, 310, false, takeJobWindow ) guiGridListAddColumn ( takeSkinGrid, "Skin Name" , 0.6 ) guiGridListAddColumn ( takeSkinGrid, "ID", 0.28 ) jobButton = guiCreateButton ( 0, 310, 150, 50, "Take Job", false, takeJobWindow ) cancelButton = guiCreateButton ( 175, 310, 150, 50, "Cancel", false, takeJobWindow ) end addEventHandler ( "onClientResourceStart", getResourceRootElement (), createWindow ) for i,v in ipairs (Skins) do local row = guiGridListAddRow ( takeSkinGrid ) guiGridListSetItemText ( takeSkinGrid, row, 1, v[1], false, true ) guiGridListSetItemText ( takeSkinGrid, row, 2, v[2], false, true ) end
  3. here is the full client script Weapons = { "Shotgun", "Sawn-Off", "SPAZ-12" } Price = { "$2400", "$4800", "$6600" } function createWindow ( ) local sWidth, sHeight = guiGetScreenSize ( ) local Width, Height = 400, 325 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) buyWindow = guiCreateWindow ( X, Y, Width, Height, "Shop", false ) buyButton = guiCreateButton ( 0, 275, 175, 100, "Buy", false, buyWindow ) buyButton1 = guiCreateButton ( 215, 275, 175, 100, "Close", false, buyWindow ) buyGridlist = guiCreateGridList ( 0, 20, 575, 250, false, buyWindow ) guiGridListAddColumn ( buyGridlist, "Weapons", 0.5 ) guiGridListAddColumn ( buyGridlist, "Price", 0.45 ) for key, itemName in pairs ( Weapons ) do local row = guiGridListAddRow ( buyGridlist ) guiGridListSetItemText ( buyGridlist, row, 1, itemName, false, false ) end row = 0 for key, itemName in pairs ( Price ) do guiGridListSetItemText ( buyGridlist, row, 2, itemName, false, false ) row = row + 1 guiSetVisible ( buyWindow, false ) end end addEventHandler ( "onClientResourceStart", getResourceRootElement (), createWindow ) function buttonClicks ( button, state ) if button == "left" and state == "up" then if getElementType ( source ) == "gui-button" then triggerEvent ("onWindowButtonClicked", source, getElementData ( buyWindow, "itemID" ) ) end end end addEventHandler ( "onClientGUIClick", getRootElement ( ), buttonClicks, true ) addCommandHandler ("shop", function () guiSetVisible ( buyWindow, true ) showCursor ( true,true ) end) function buyWindowFunctions ( ) if ( source == buyButton1 ) then guiSetVisible ( buyWindow, false ) showCursor ( false,false ) elseif ( source == buyButton ) then triggerServerEvent ("giveWeaponToPlayer", localPlayer, 30, 30 ) triggerServerEvent ("takePlayerMoney", localPlayer, 2400 ) end end addEventHandler ("onClientGUIClick", root, buyWindowFunctions )
  4. I made a shop panel which can be used while playing a game mode like DM, tdm ect. (this is just a part of the script, everything else works fine ) Client function buyWindowFunctions ( ) if ( source == closeButton ) then guiSetVisible ( buyWindow, false ) showCursor ( false,false ) elseif ( source == buyButton ) then triggerServerEvent ("giveWeapon", localPlayer, 30, 30 ) end end addEventHandler ("onClientGUIClick", root, buyWindowFunctions ) Whenever I press "buy" it gives me an AK-47 with 30 bullets. I made a gridlist with a few weapons. I want to make it so that it does give me the item I press on the gridlist. But I have no idea how or what function/event is needed to make it work like that. elseif ( source == buyButton ) then triggerServerEvent ("giveWeaponToPlayer", localPlayer, 30, 30 ) I do know that this is wrong and whenever I press the buy button it would give me an AK with 30 bullets. Instead of first clicking the item on the gridlist and than pressing buy. I would like to know how to make it so when I press an item on the gridlist and than the buybutton it would give me the item I selected on the gridlist. Server addEvent ("giveWeapon", true ) addEventHandler ("giveWeapon", root, function ( weapon, ammo ) if weapon then giveWeapon ( client, tonumber ( weapon ), ( tonumber ( ammo ) ), true ) end end )
  5. Ok, so this is the deal, every time I try to connect to the server using that button on home page I get kicked due to using a program to modify MTA. Note that: Re-installing MTA or GTA wont fix it. I can connect to it normally, just not when using this button. This link is a screenshot when i'm trying to connect with the connect button http://imageshack.us/photo/my-images/221/4njukua.png/ What could the problem be? And how to solve this? since i'm not using any mods and restarted my PC about 10 times, but nothing happends.
×
×
  • Create New...