Jump to content

-Note

Members
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

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

-Note's Achievements

Newbie

Newbie (4/54)

0

Reputation

  1. I have this code (client-side) which gets the nearest element but the problem was something I don't want. I mean the element it gets is not the nearest but the second nearest element. Example: Me (localPlayer) Player 1 (v) Player 2 (v) the camera target will be element Player 2 not element player 1 which what I want. function exampleCode() for ik, v in ipairs (getElementsByType("player")) do if v ~= localPlayer then x, y, z = getElementPosition(localPlayer) xv, yv, zv = getElementPosition(v) distance = getDistanceBetweenPoints3D(x, y, z, xv, yv, zv) if distance < 10 then setCameraTarget(xv, yv, zv) end end end end
  2. Is there any way to know if a vehicle is skidding/sliding or not? Because I tried to look at mtasa wiki there's no such thing.. I'll use it for detecting if player is drifting or not. Thanks in advance.
  3. Okay thanks. I already fixed it.
  4. Hello I'm working on something but every time I click the selected grid list it doesn't refresh the content. Btw I'm using a table. storeList = { {food = 22, water = 15000, bp = 12}, {food = 23, water = 20000, bp = 12}, {food = 24, water = 35000, bp = 12}, } function refreshInfoListt() for k, v in ipairs(storeList) do if guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) then guiSetText(GUIEditor.label[2], "Info List: \n\Food: "..v["food"].."\nWater: "..v["water"].."\nBattle Points: "..v["bP"]) end end end addEventHandler("onClientGUIClick", GUIEditor.gridlist[1], refreshInfoListt, false)
  5. Hello can anyone help me here I want to make this work for the staff that are in "username"and permission is "true" in my MySQL Column For example: Column Name staffUser: value (iNote) Column Name hasPermission: value (true) Srry forgot to paste my code! function voidFunction(plr) local query = exports.mysql:query("SELECT * FROM staff") for k,v in ipairs (query) do memberName = v.staff_name outputChatBox(memberName..", please don't misuse this power!", plr, 255, 255, 255) end end addCommandHandler("void", voidFunction) Srry forgot to paste my code! function voidFunction(plr) local query = exports.mysql:query("SELECT * FROM staff") for k,v in ipairs (query) do memberName = v.staff_name outputChatBox(memberName..", please don't misuse this power!", plr, 255, 255, 255) end end addCommandHandler("void", voidFunction)
  6. Is it possible to get the player name who restart/start/stop a specific resource? Cuz I'm using this to catch player name but It returns me some error which is "getPlayerName expected player, got nil" but I already added a player. Sorry if I have done something wrong and this is my first time in Lua. addEventHandler("onResourceStart",root, function (resource, thePlayer) if getResourceInfo(resource,"type") ~= "map" then outputChatBox(getResourceName(resource).." started by "..getPlayerName(thePlayer)) end end )
  7. I use this on meta so I can call it by server or client <export function="getPlayerAccountID" type="client" /> <export function="getPlayerAccountID" type="server" />
  8. I tried using this exports but it won't work function getPlayerAccountID (player) local thePlayer = player or localPlayer if ( isElement(thePlayer)) then local ac = getPlayerAccount(thePlayer) local userID = getAccountID(ac) if (userID) then return tonumber(userID) else return false end else return false end end I tried executing this exports in-game by using run code "srun exports.ServerExports: getPlayerAccountID(p)" and it doesn't work with error "stack overflow" & "tail call" ps: firstly I executed this before executing the command above "srun p = getPlayerFromName("Note")" pss: I tried using "srun getAccountID(getPlayerAccount(p))" and it works but the exports won't. psss: I also tried using this in run code "srun local ac = getPlayerAccount(p)" "srun getAccountID(ac)" and it works too!! I don't know why my exports won't.
×
×
  • Create New...