Jump to content

xXMADEXx

Members
  • Posts

    2,718
  • Joined

  • Last visited

Everything posted by xXMADEXx

  1. hum, how would this be done?
  2. Yea. This is the code now: local rx,ry = guiGetScreenSize() button = {} window = {} gridlist = {} window['groups'] = guiCreateWindow((rx/2-343/2),(rx/2-316/2),343,316,"",false) guiSetAlpha(window['groups'],1) guiWindowSetSizable(window['groups'],false) button['groupsSpawn'] = guiCreateButton(11,267,160,40,"Spawn",false,window['groups']) button['groupsClose'] = guiCreateButton(173,267,161,40,"Cancel",false,window['groups']) guiSetVisible( window['groups'], false ) gridlist['groups'] = guiCreateGridList(9,22,324,243,false,window['groups']) guiGridListAddColumn(gridlist['groups'],"Vehicle",0.4) guiGridListAddColumn(gridlist['groups'],"ID",0.4) function showGroupVehicleSpawners(cars,x,y,z) x = x y = y z = z guiSetVisible(window['groups'],true) showCursor(true) for i,v in ipairs (cars) do guiGridListClear(gridlist['groups']) local name = getVehicleNameFromModel(v) row = guiGridListAddRow(gridlist['groups']) guiGridListSetItemText(gridlist['groups'], row, 1, name, false, false) guiGridListSetItemData(gridlist['groups'], row, 1, v) guiGridListSetItemText(gridlist['groups'], row, 2, tostring(v), false, false) guiGridListSetItemData(gridlist['groups'], row, 2, v) end end addEvent("showGroupVehicleSpawners",true) addEventHandler("showGroupVehicleSpawners",root,showGroupVehicleSpawners) addEventHandler("onClientGUIClick",root, function () if (source==button['groupsClose']) then guiGridListClear(gridlist['groups']) guiSetVisible(window['groups'],false) showCursor(false,false) elseif (source==button['groupsSpawn']) then local row, col = guiGridListGetSelectedItem(gridlist['groups']) local id = guiGridListGetItemData(gridlist['groups'], row, 1) triggerServerEvent("onCreateGroupVehicle",localPlayer,id,x,y,z) guiSetVisible(window['groups'],false) showCursor(false,false) end end )
  3. That would clear it a lot of times. @MADE: Put it under: for i,v in ipairs (cars) do It still happend, only the last car, for the last spawner will appear.
  4. just use new Database functions. mta_mysql.dll is for 32 bit only, and its really old, no need for it anymore.
  5. Well, i did that and it was a fail it still has problem, exept now it will only list the first last
  6. Look at line 47 on client.
  7. I've made this car spawner system, and its all workin good, exept for one thing, that i have no idea why its doing it. For some reason, the cars from the last created spawner are creating in ever vehicel spawner... Server marker = {} vehicleCarSpawns = { -- Format: x, y, z, rotation, "Group", {cars} {1476.7, -2776.3, 14.7, -90, "FBI", {596, 597, 598, 599, 579, 490, 528}}, {1523, -2847.8, 0, 180, "FBI", {472, 473, 595}} } for i,v in ipairs (vehicleCarSpawns) do x,y,z,rot,group,cars = unpack(vehicleCarSpawns[i]) local r,g,b = unpack(exports['[ROG]Groups']:getGangColor(group)) marker[i] = createMarker(x, y, z - 1, "cylinder", 2.3, r, g, b, 150) setElementData(marker[i],"markerType",group) addEventHandler("onMarkerHit",marker[i], function (p) if (getElementData(source,"markerType")==exports['[ROG]Groups']:getPlayerGang(p)) then triggerClientEvent(p,"showGroupVehicleSpawners",p,cars,x,y,z) else triggerClientEvent(p,"message:centerText",p,"Your not in the "..getElementData(source,"markerType"), 5, 255, 0, 0) end end ) end vehicle = {} function onDestroyCustomCars() if isElement(vehicle[source]) then destroyElement(vehicle[source]) vehicle[source] = nil end end addEventHandler("onPlayerQuit", root, onDestroyCustomCars) addEvent("onDestroyCustomCars",true) addEventHandler("onDestroyCustomCars",root,onDestroyCustomCars) function onCreateGroupVehicle(id,x,y,z) if (id) then if (isElement(vehicle[source])) then destroyElement(vehicle[source]) end local r,g,b = unpack(exports['[ROG]Groups']:getGangColor(group)) triggerEvent("spawners:destroyOldCars",source) if (tonumber(x) ~= nil) then vehicle[source] = createVehicle(id, x, y, z, 0, 0, rot) else local rx,ry,rz = getElementPosition(source) vehicle[source] = createVehicle(id, rx, ry, rz, 0, 0, 0) end warpPedIntoVehicle(source,vehicle[source]) setElementData(vehicle[source],"vehOwner","spawners",true) setVehicleColor(vehicle[source],r,g,b) end end addEvent("onCreateGroupVehicle",true) addEventHandler("onCreateGroupVehicle",root,onCreateGroupVehicle) Client local rx,ry = guiGetScreenSize() button = {} window = {} gridlist = {} window['groups'] = guiCreateWindow((rx/2-343/2),(rx/2-316/2),343,316,"",false) guiSetAlpha(window['groups'],1) guiWindowSetSizable(window['groups'],false) button['groupsSpawn'] = guiCreateButton(11,267,160,40,"Spawn",false,window['groups']) button['groupsClose'] = guiCreateButton(173,267,161,40,"Cancel",false,window['groups']) guiSetVisible( window['groups'], false ) gridlist['groups'] = guiCreateGridList(9,22,324,243,false,window['groups']) guiGridListAddColumn(gridlist['groups'],"Vehicle",0.4) guiGridListAddColumn(gridlist['groups'],"ID",0.4) function showGroupVehicleSpawners(cars,x,y,z) x = x y = y z = z guiSetVisible(window['groups'],true) showCursor(true) for i,v in ipairs (cars) do local name = getVehicleNameFromModel(v) -- BUGGED LINE row = guiGridListAddRow(gridlist['groups']) guiGridListSetItemText(gridlist['groups'], row, 1, name, false, false) -- BUGGED LINE guiGridListSetItemData(gridlist['groups'], row, 1, v) guiGridListSetItemText(gridlist['groups'], row, 2, tostring(v), false, false) guiGridListSetItemData(gridlist['groups'], row, 2, v) end end addEvent("showGroupVehicleSpawners",true) addEventHandler("showGroupVehicleSpawners",root,showGroupVehicleSpawners) addEventHandler("onClientGUIClick",root, function () if (source==button['groupsClose']) then guiGridListClear(gridlist['groups']) guiSetVisible(window['groups'],false) showCursor(false,false) elseif (source==button['groupsSpawn']) then local row, col = guiGridListGetSelectedItem(gridlist['groups']) local id = guiGridListGetItemData(gridlist['groups'], row, 1) triggerServerEvent("onCreateGroupVehicle",localPlayer,id,x,y,z) guiGridListClear(gridlist['groups']) guiSetVisible(window['groups'],false) showCursor(false,false) end end )
  8. Use https://community.multitheftauto.com/index.php?p=resources&s=details&id=3016
  9. Use this: function connect() db = dbConnect( "mysql", "dbname=greenhound; host=127.0.0.1", "root", "123", "autoreconnect=1" ) end addEventHandler("onResourceStart",root,connect) and you can read this to get the arguments.
  10. Here are some good events: - Server side: onPlayerLogin onPlayerJoin - Client onClientResourceStart
  11. From here: viewtopic.php?f=148&t=42067&p=486988#p486988
  12. Im sure you can just like search "GTA SA vehicle upgrade images" on google or something.
  13. Hey guys, i was going to make my server logs save to a file on my server's website, but it won't connect. I read something about it being that web hoster's don't let anything outside the server connect, and i also saw you can bypass it with MTA's PHPSDK. But, i don't know anything about PHP, so that's going to be a prob. If you know how, please make a vid tut or detailed comment. Thanks in advance.
  14. I've never had this problem, and i also use Fire Fox - AKA Fire Fox FTW!!
  15. Yea, it is. I use that "if" statment in my gate scripts, and it works fine, i really have no idea why it won't work in this one... Here is the export: <export function="getPlayerGang" type="server" /> <!-- Arguments: thePlayer. Returns: The gang. -->
  16. No, because "..group is the last thing, but if i was going to be that way, i would have to do "Your not in "..group..'!"
  17. Im making vehicle spawners, but for some reason getting the gang is failing... I don't know why. Error: ERROR: call: failed to call "[ROG]Groups:getPlayerGang" [string "?"] Code: addEventHandler("onMarkerHit",marker, function (p) local getGang = exports['[ROG]Groups']:getPlayerGang(p) if (getGang==group) then triggerClientEvent(p,"showGroupVehicleSpawners",p,cars) else triggerClientEvent(p,"message:centerText",p,"Your not in "..group, 3, 255, 0, 0) end end ) -- This is what i use to create the spawner: addGroupSpawner({1319.1091308594, -2584.6645507813, 13.5390625, -90}, {411, 412}, {120, 0, 255}, "Military")
  18. Thank you castillo. Please lock topic, i solved it.
  19. Its not hard to combine them....
  20. so, how exacly do i fix this? Use pairs instead. I already tried that, and can someone tell me the differance between pairs and ipairs?
  21. so, how exacly do i fix this?
×
×
  • Create New...