Jump to content

Crosshair

Members
  • Posts

    32
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Crosshair's Achievements

Rat

Rat (9/54)

0

Reputation

  1. Hello all. Lets say some players have set an elementdata called "x" with the value "y". I need a function that gets all those players that have getElementdata(player, "x") == "y" and sends a outputChatBox to all of them. PS: I did something but i can`t test it right now since i`m the only player on the server local players = getElementsByType( "player" ) for i=1,#players do if (getElementData(players[i], "x") == "true") then outputChatBox("test", players[i]) end end Could this work ?
  2. i figured this, but i dont` have an idea how to make this work. Any idea ?
  3. I`m trying to make a progress bar with dxdraw. All works well but the rectangle flickers every time till the timer stops. I need help on that so the rectangle would not flicker anymore. local screenW, screenH = guiGetScreenSize() function render() if (isTimer(timer) == false) then i=0 timer = setTimer(function() dxDrawRectangle((screenW - 23) / 2-131, (screenH - 10) / 2, i, 10, tocolor(144, 3, 3, 255), true) i=i+1 end, 50, 100) end removeEventHandler("onClientRender", root, render) end addEventHandler("onClientRender", root, render)
  4. Well thank you for the support and i`l see tomorrow what i will do.
  5. There is also no "plantID" variable declared. I just didn`t included the variable. I make another thing right now. I added on the top id = 0, removed the id argument and add id=id+1 before it creates the object. Now if i use table.insert how do i retrieve the emelents ? with unpack ? What is the best option to do this ? Mine or yours ?
  6. Your right, but i want the player to not enter a number. Just to type plant and the plant will later rise from the ground, So i need the script to add the plant1 in the table with the first position and if he decides to add another plant(plant2) to be added also in the table with the second position. If i don`t use the cmd argument this works and if i use outputchatbox(plants[1]) works.
  7. Hi. I`m trying to make 2 commands that uses one command and i have some problems. plants = { } function plants(thePlayer, cmd, id) if (cmd == "plant") then local x,y,z = getElementPosition(thePlayer) plants[id] = createObject(plantID,x,y,z) end if (cmd == "harvest") then --TODO end end addCommandHandler("plant", plants) addCommandHandler("harvest", plants) When i enter the command "plant" gives me an error at plants[id] = createObject(plantID,x,y,z): table index is nill. If i remove the argument "cmd" from the function all works well.
  8. Hello guys. I tried to make a job and i run in some issues. function enter(thePlayer) marker = createMarker(2809, -2474, 13, "cylinder", 2, 248, 211, 6, 153, thePlayer) blip = createBlip(2809, -2474, 13, 0) addEventHandler("onMarkerHit", marker, marcar) end addEventHandler ( "onVehicleEnter", getRootElement(), enter ) function marcar(thePlayer) destroyElement(marker) destroyElement(blip) end I simplify the code to this. The problem is with destroyElement of course. Bad 'element' pointer @ 'destroyElement'(1) marker and blip is gone but i want to get rid of this warning.
  9. But it`s not. If i put outputDebugString(jucatori) in server side returns the values.
  10. Expected string, got nil at "jucatori"
  11. How about this ? function sql(thePlayer) team = getPlayerTeam(thePlayer) teamstr = getTeamName(team) local sql = mysql:query("SELECT `username` FROM `accounts` WHERE `factiune` = '"..teamstr.."'") if (sql) then while true do row = mysql:fetch_assoc(sql) if (not row) then break end jucatori = row["username"] triggerClientEvent(source, "factiunemeniu", getRootElement(), jucatori) end mysql:free_result(sql) end end addEventHandler("onPlayerJoin", getRootElement(), sql) function factiunemeniu(jucatori) meniu = guiCreateWindow(233,164,600,440,"Meniu factiune",false) grid = guiCreateGridList(9,29,467,379,false,meniu) local nume = guiGridListAddColumn(grid,"Nume",0.2) outputDebugString(jucatori) for k, v in ipairs (jucatori) do local row = guiGridListAddRow(grid) guiGridListSetItemText(grid, row, nume, jucatori, false, false) end end addEvent("factiunemeniu", true) addEventHandler("factiunemeniu", getRootElement(), factiunemeniu) On outputDebugString(jucatori) returns nil. In server side the debug shows
  12. To be more precise: http://i.imgur.com/j5Pc1.png Add those in a gridlist
  13. Still nothing. Got only one result.
  14. No warning but shows only one result.
×
×
  • Create New...