Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. Ok so next time, you will explain better. I didn't even know your wanted to use groups from ACL. So now, Stafftag is totally useless, remove it (and wtf, this code can't work, this ,("L4") comes from nowhere: function vehicleGodMod(player) local accname = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user."..accname, aclGetGroup("L3")) or isObjectInACLGroup("user."..accname, aclGetGroup("L4")) then if (isVehicleDamageProof(getPedOccupiedVehicle(player))) then setVehicleDamageProof(getPedOccupiedVehicle(player),false) outputChatBox("Vehicle god mode disabled",player,255) else setVehicleDamageProof(getPedOccupiedVehicle(player),true) outputChatBox("Vehicle god mode enabled",player,0,255) end else outputChatBox("You dont have permission for this command!",player,255) end end addCommandHandler("vgod",vehicleGodMod) addCommandHandler("vehiclegod",vehicleGodMod)
  2. You are obviously lying, otherwise you wouldn't get that error: - But I'm not lying ! - Alright, show me the setElementData that set "Stafftag" to L0 L1 L2 L3 then ...
  3. Everything in Lua are 1 based (and not 0 based like C for example)
  4. Of course, you can replace 3 to 4 ... Which level are you talking about ?! I thought you already did your level system using Stafftag to store it !
  5. So you were trying to get a value that you never seted ... function vehicleGodMod(player) ----- To set at login ---- setElementData(player, "Stafftag", 3) --set the data Stafftag to 3 for player -------------------------- if getElementData(player,"Stafftag") >= 3 then if (isVehicleDamageProof(getPedOccupiedVehicle(player))) then setVehicleDamageProof(getPedOccupiedVehicle(player),false) outputChatBox("Vehicle god mode disabled",player,255) else setVehicleDamageProof(getPedOccupiedVehicle(player),true) outputChatBox("Vehicle god mode enabled",player,0,255) end else outputChatBox("You dont have permission for this command!",player,255) end end addCommandHandler("vgod",vehicleGodMod) addCommandHandler("vehiclegod",vehicleGodMod)
  6. oh ok, then where do you set the "Stafftag" for the player ? I mean, where is/are the setElementData for "Stafftag" ?
  7. Which line please ? (don't write the line number given by the console, just write the entire line corresponding to that line number)
  8. How is your code right now ? Paste it here again please.
  9. Citizen

    help .. ?

    viewforum.php?f=122 viewtopic.php?f=91&t=15740 (Rule II.1)
  10. No you can't do that, you have to trigger a client event that will then send back the result to another function on the server side through a triggerServerEvent. Process: server function 1 -> client function -> server function 2 Example: Server: function func1(thePlayer) triggerClientEvent(thePlayer, "needResult", root) end addCommandHandler("test", func1) addEvent("receiveResult", true) function func2( result ) outputChatBox("The result is "..tostring(result)) end addEventHandler("receiveResult", root, func2) Client: addEvent("needResult", true) function myFunc() local result = true triggerServerEvent("receiveResult", localPlayer, result) end addEventHandler("needResult", root, myFunc) Regards, Citizen
  11. Haha no, you are all wrong, there is a priority problem over this line: if not getElementData (player,"Stafftag") >= 4 then Take a second to look at it. If getElementData (player,"Stafftag") returns 0, then it will result to something like this: if not 0 >= 4 then The priority is given to the not keyword and then the >= And not 0 returns true so we will end with this: if true >= 4 then And doing "not" on a number that is over 0 will returns false So if you got it, you just have to add parenthesis to fix the priority issue: if not (getElementData (player,"Stafftag") >= 4) then It should work. In the meantime, I would recommend to swap the two parts of that if else statement like this: function vehicleGodMod(player) if getElementData(player,"Stafftag") >= 4 then if (isVehicleDamageProof(getPedOccupiedVehicle(player))) then setVehicleDamageProof(getPedOccupiedVehicle(player),false) outputChatBox("Vehicle god mode disabled",player,255) else setVehicleDamageProof(getPedOccupiedVehicle(player),true) outputChatBox("Vehicle god mode enabled",player,0,255) end else outputChatBox("You dont have permission for this command!",player,255) end end addCommandHandler("vgod",vehicleGodMod) addCommandHandler("vehiclegod",vehicleGodMod) Regards, Citizen
  12. Any error in the console ? Did you restarted the resource for modifications taking effects ?
  13. Why replacing the timer with a command ??? GUIEditor.button[3] = guiCreateButton(226, 119, 93, 29, "", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "default-bold-small") function ubdatebutton() local vehicle = getPedOccupiedVehicle( localPlayer ) if vehicle then guiSetVisible(GUIEditor.button[3], true) if isVehicleLocked(vehicle) then guiSetText(GUIEditor.button[3], "Unlock") else guiSetText(GUIEditor.button[3], "Lock") end else guiSetVisible(GUIEditor.button[3], false) end end setTimer(ubdatebutton, 100, 0)
  14. ok try this (didn't test it): local gRoot = getRootElement() local sWidth,sHeight = guiGetScreenSize() local Width,Height = 549,412 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) local playerheight = 20 --Better to be here as it's a constant local nbLinesToDraw = 20 -- the number of lines that will be drawn at the same time local offset = 0 function offsetplus() if offset >= (#getElementsByType ( "player" ))-nbLinesToDraw then return end --Bottom Position offset = offset + 1 end function offsetneg() if offset <= 0 then return end --Top Position offset = offset - 1 end local currentMoney = 0 addEventHandler ( "onClientRender", root, function ( ) local money = getPlayerMoney ( ) if ( currentMoney ~= money ) then outputChatBox ( money ) setElementData ( localPlayer, "playerMoney", money ) currentMoney = money end end) function Scoreboard() dxDrawImage(X,Y,Width,Height, "Scoreboard/images/back.png") dxDrawText("Name", X+60, Y+10, Width,Height, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText(playersO.."/50" ,X+525, Y-15, Width,Height, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Ping", X+480, Y+10, Width, Height, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Geld", X+210, Y+10, Width, Height, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Fraktion", X+350, Y+10, Width, Height, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) local players = getElementsByType ( "player" ) local line = 0 --the current line number - 1 for k, player in pairs(players) do -- we will draw if we are at the right offset AND if we still didn't draw [nbLinesToDraw] lines (here 20) if k > offset and line <= nbLinesToDraw then local ping = getPlayerPing(player) local teamp = getPlayerTeam(player) local teamn = "Keine" if teamp then teamn = getTeamName(teamp) end local money = tonumber ( getElementData(player, "playerMoney") ) or 0 if (ping >= 250) then r,g,b = 255,0,0 elseif (ping >= 120) then r,g,b = 255,69,0 else r,g,b = 0,255,0 end local tmpY = Y+60+playerheight*line dxDrawText(getPlayerName( player ), X+60, tmpY, Width,Height, tocolor(255,255,255), 1 , "default-bold","left", "top",false, false,true,true) dxDrawText(ping, X+480, tmpY, Width, Height, tocolor(r,g,b), 1, "default","left", "top",false,false,true,true) dxDrawText(tostring( money ).." $", X+210, tmpY, Width, Height, tocolor(255,255,255), 1, "default","left", "top",false, false, true, true) dxDrawText(teamn, X+350, tmpY, Width, Height, tocolor(255,255,255), 1, "default","left", "top",false, false, true, true) line = line + 1 end end end function Zeit() local hours = getRealTime().hour local minutes = getRealTime().minute local seconds = getRealTime().second dxDrawText(hours..":"..minutes..":"..seconds, X-325, Y+525, Width, Height, tocolor(255,255,255), 1, "default-bold","left", "top",false, false,true,true) end addEventHandler("onClientRender", gRoot, Zeit) function open() opened = not opened if opened == true then bindKey("mouse_wheel_down", "down", offsetplus) bindKey("mouse_wheel_up", "down", offsetneg) addEventHandler("onClientRender", gRoot, Scoreboard) showChat(false) showPlayerHudComponent("all", false) removeEventHandler("onClientRender", gRoot, Zeit) else offset = 0 unbindKey("mouse_wheel_down", "down", offsetplus) unbindKey("mouse_wheel_up", "down", offsetneg) removeEventHandler("onClientRender", gRoot, Scoreboard) showPlayerHudComponent("all", true) showChat(true) addEventHandler("onClientRender", gRoot, Zeit) end end bindKey("tab","both",open) I'm using offset to hold how much players I must skip for the loop: if there are 40 players, and offset = 5 then it will skip the 5 first players in the loop and so it will list the 6th player to 26th one. Before testing, use /debugscript 3 and tell me if there are errors once you tested it. To test with 40 players (for example) give the loop a table of string (names) and force the value for ping, money and team. Regards, Citizen
  15. You have to fix it, when the player is logging in, the server should set his level. Search in server side for something like this: ... local lvl = --get his level in database setElementData(thePlayer, "level", lvl) outputChatBox("You have been successfully logged in !", thePlayer) ... And try to check if the value of level is correct for all players.
  16. @Smart: He created the event realeasePlayer and probably want to trigger it properly, so let's use that event ? function polices ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then local theTeam = getPlayerTeam ( attacker ) local theWL = getPlayerWantedLevel ( source ) local money = theWL * 2.5 if (attackerweapon == 3 or attackerweapon == 23) and (loss > 2 ) and (theWL > 0) then if getTeamName( theTeam ) == "Police" or getTeamName( theTeam ) == "United States Army" or getTeamName( theTeam ) == "Sheriff Academy" then setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) local theName = getPlayerName ( source ) local theCop = getPlayerName ( attacker ) outputChatBox( "*INFO* "..theName.." has been jailed and arrested by "..theCop.."", source, 255, 255, 0 ) local playeraccount = getPlayerAccount ( attacker ) givePlayerMoney (attacker, money) setElementData(source, "isJailed", "true") setTimer(triggerEvent, 1000, 1, "releasePlayer", source) end end end end addEventHandler ("onPlayerDamage", getRootElement(), polices) function newEvent() local theName = getPlayerName(source) if getElementData(source, "isJailed") == "true" then setElementData(source, "isJailed", "false") setPlayerWantedLevel(source, 0) end end addEvent("releasePlayer", true) addEventHandler("releasePlayer", getRootElement(), newEvent) What did I change ? - First, I changed all your globals variables into locals variables. Only use global variables if you want that variable to be accessible everywhere on the client-side (if this is a client sided script) or on the server-side (if this is a server sided script). - Second, I just changed your setTimer to be like this: setTimer(triggerEvent, 1000, 1, "releasePlayer", source) I'm calling the triggerEvent function after 1 second and only 1 time with the arguments: "releasePlayer" as 1st argument and source (which is the guy in jail) as 2nd argument (the source of the "releasePlayer" event) Regards, Citizen
  17. As I said, the relevant code (creation of the objects, the teleportation code if you did one to go into that interior etc) and a screenshot of what you are calling the "blank space".
  18. Damn it, thought you wouldn't set "[DayZ-MTA]" folder as root folder for the search feature. Then hummm be sure you are checking the "Case sensitive" option and that the filder is "*.*" without quotes obviously. If it still doesn't work, then check the database, it's probably loading objects that the player has and there are some "M1911 Mag" somewhere in the database. If you still can't fix it, just set a default value if the getElementData function returns nil by doing like this: getElementData(source,data[1]) or 0 if the getElementData function returns nil then 0 will be used. So in your case, it will be like this: plusData = math.floor( (getElementData(source,data[1]) or 0)/7 ) Regards, Citizen
  19. Citizen

    Error.

    For the first error, maybe you forgot to add a server file in the meta.xml, or there is an error when that server script is loaded. For the 2nd one, it just means that the element datas ("temperature" and "thirst") aren't set for that layer at the moment you are trying to get them. You can set a default value so that current will never be nil even if the element data isn't setted yet like this: local current = getElementData(player,data) or 0 You can replace 0 by whatever you would like. Note: if the getElementData returns nil, it will result into something like this: local current = nil or 0 and nil or 0 will become 0, so current will be equal to 0 when getElementData will return nil.
  20. Citizen

    Help me

    function rejoinMe()
  21. The answer is no. The return keyword just stop the execution of the function, even if it's inside an if statement or a loop.
  22. Alright, then you don't really understand what tou were actually doing or something. So is it working after adding the missing code I gave you ?
  23. You also just can post the revelant code here ...
×
×
  • Create New...