Investor

Members
  • Content Count

    127
  • Joined

  • Last visited

Community Reputation

41 Good

3 Followers

About Investor

  • Rank
    Poot-butt
  • Birthday 14/04/1999

Details

  • Location
    United Kingdom
  • Occupation
    Student & 3D modeller
  • Interests
    3D modelling, law, computer gaming, game development, level design, etc

Recent Profile Visitors

1,502 profile views
  1. The skill value is looked up in the SQL table weaponstats. Since you're already accounting for all the weapon skills possible, let's hypothetically say you want to add stamina stat to this. What you'd do is add a new column in the weaponstats SQL table called "stamina", and then edit this script's skills table by adding [22] = "stamina". The actual value for that stat will be in the SQL table. E.g. owner ak47 m4 ... stamina 23 1000 1000 ... 560 35 600 500 ... 600 So for player with charID 23, the poll[1]["stamina"] will be 560, for poll[1]["m4"] it will be 1000. For charID 35, these will be 600 and 500 respectively. When originally recommending that code, I didn't realise that all the skills were already added, which means you probably won't be adding or removing anything from it, but at least it's still a cleaner code design.
  2. You should show us the code which handles closing whatever it is that disappears forever. Perhaps it uses destroyElement where is should use guiSetVisible.
  3. local skills = { --[skillID] = columnName [77] = "ak47", [78] = "m4", [69] = "pistol", [70] = "silencedpistol", [71] = "deagle", [72] = "shotgun", [73] = "sawnoff", [74] = "spas", [76] = "mp5", [79] = "sniper", } local owner = charID dbQuery( function(qh) local poll = dbPoll(qh,0) local row = poll[1] if not row then return false end -- don't continue if poll[1] is empty (no rows found in weaponstats for this owner) for skillID, columnName in pairs(skills) do -- iterate the table defined above whose key-value pairs are [skill ID] = table column name setPedStat(player, skillID, row[columnName]) end end, {},connection,"SELECT * FROM weaponstats WHERE owner=? LIMIT 1", owner ) This is a little cleaner and more maintainable design. If you add more columns in your weaponstats db-table, all you have to do is update the skills table.
  4. dbQuery(function(qh) local poll = dbPoll(qh,0) for _,v in ipairs(poll) do local ak47 = v["ak47"] -- first of all, this is defined locally to this scope only so it doesn't exist outside the anonymous function(qh) end owner = 1 -- this definition seems very out of place. It should come before dbQuery as it's used in it's parameters end,{},connection,"SELECT * FROM weaponstats WHERE owner=?",owner) setPedStat(player, 77, ak47) -- this executes right after dbQuery but before the dbQuery's callback function, hence ak47 is not defined The solution could look something like this local owner = 1 dbQuery( function(qh) local poll = dbPoll(qh,0) for _,v in ipairs(poll) do -- if the poll result only has one row, it would be better to use local ak47 = poll[1]["ak47"] instead of this loop local ak47 = v["ak47"] setPedStat(player, 77, ak47) end end, {},connection,"SELECT * FROM weaponstats WHERE owner=?",owner)
  5. Presumably you have a line that goes something like this local itemsTableState = getElementType(unknown_variable) well, you need to add local clickedElementModel = getElementModel(unknown_variable) and then elseif itemsTableState == "object" then if clickedElementModel == 2332 then -- if the element model is a safe tabStartX = drawCategoryTab(tabStartX, tabStartY, "main", "safe", "Safe") end end But you haven't provided enough lines for me to know what is the name of the variable storing the clicked element, so I've named it unknown_variable here.
  6. Investor

    Time

    If you mean how many hours have passed since a player was last online, all you have to do is store a timestamp when he quits or logs out (via setAccountData perhaps) and compare that to the current timestamp to get the number of seconds passed, from which you can easily calculate the number of hours.
  7. Investor

    HELP Kick

    doesn't seem to appear in the provided script, which could mean encoding problems. Anyway, while checking the code I also found it to contain a couple U+FEFF characters (ZERO WIDTH NO-BREAK SPACE). The bytes 0xFEFF are apparently also used by UTF-8 for BOM (Byte Order Mark) which could be part of encoding issues, perhaps. Best would be to simply filter out invisible and special characters which shouldn't be there.
  8. The difference is that only a player can issue a command, though an event's source could be any element type. This is why the wiki uses 'player' for command source variable, but you're free to use whatever name you want.
  9. Wrong section I think. Modelling would be more appropriate.
  10. Investor

    Ped voice

    setPedVoice
  11. dutyAllow[key] is a nil value (doesn't exist). You probably wanted dutyAllow[k]
  12. XML is only useful for configurations which you want to be able to change through a normal text editor, but even for that case, JSON is probably faster and easier. SQL is best for pretty much anything else.
  13. Could be related to issue 634 as its solution changed some stuff regarding question marks within a query.
  14. What kind of client function do you need? Client functions mostly require a client because it doesn't make sense to run them unless there is a game client with rendering. There may exist workarounds on the server side for certain functions (such as isElementOnScreen is possible to calculate on the server given a camera position, rotation, fov, clipping start and clipping end, etc.), while others are impossible without a full client (such as collecting a dxScreenSource screenshot) and nonsensical (e.g. drawing dx, CEGUI etc without a client to look at it).
  15. bool isPedOnGround ( ped thePed ) float getGroundPosition ( float x, float y, float z ) getGroundPosition is client-side only and requires the world to be streamed in at that position at the time of calling the function, but if the player is above it it should be loaded.