Jump to content

Mr.Loki

Members
  • Posts

    667
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Mr.Loki

  1. When players login do they already have blips?
  2. setPlayerTeam requires a team not a string. function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local playerTeam = getTeamFromName(getAccountData (theCurrentAccount, "team")) if playerTeam then setPlayerTeam(source,playerTeam) end end end addEventHandler ("onPlayerLogin", root, playerLogin)
  3. function kivesz(player, command) local accountName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" )) then aclGroupRemoveObject(aclGetGroup("Admin"), "user."..accountName) end end addCommandHandler("rangki", kivesz) function betesz(player, command) local accountName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin1" )) then aclGroupAddObject (aclGetGroup("Admin"), "user."..accountName) end end addCommandHandler("rangbe", betesz)
  4. that's what i explained in the rest of my post ._.
  5. addCommandHandler (server) has 2 main parameters player playerSource, string commandName, [string arg1, string arg2, ...] so it should be: function kivesz (player, command) then you can use player for your functions instead of source or can just change player to source in the function parameters.
  6. There u go problem solved
  7. Also i forgot to consider the players who have not logged in yet this fix checks if the player has logged in addEventHandler ( "onResourceStart",resourceRoot, function() local players = getElementsByType"player" for i,plr in pairs(players)do if not isGuestAccount(getPlayerAccount(plr))then local acl = hasPermission(plr) setElementData(plr,"PlayerACL", acl) end end end)
  8. You can use the same data "PlayerACL" in the render function
  9. Yeah but you need o loop through all the players and instead of root use resourceRoot because using root means all elements including other resources addEventHandler ( "onResourceStart",resourceRoot, function() local players = getElementsByType"player" for i,plr in pairs(players)do local acl = hasPermission(plr) setElementData(plr,"PlayerACL", acl) end end)
  10. this happens because the player element data for "PlayerACL" isn't set and is returning false a simple bypass is to just convert str to a string so if u see a player with false as acl they just need to relog you can make a function that loops the players and sets their "PlayerACL" to their acl name onResourceStart function dxDrawColorText(str, ax, ay, bx, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) local str = tostring(str) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) ax = ax + w color = tocolor(tonumber("0x"..string.sub(col, 1, 2)), tonumber("0x"..string.sub(col, 3, 4)), tonumber("0x"..string.sub(col, 5, 6)), 255) end last = e+1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,alignX,alignY,clip, wordBreak, postGUI) end end
  11. after you setElementData you should use break or return in the function so everything else does not get overwritten. Here's a better way of doing it, This function i made returns the first acl it detects the player is in local allowed= "Admin,SuperModerator,Moderator,Everyone" function hasPermission(player) local ACLs = split(allowed, ',') for _, group in pairs(ACLs)do local ACLgroup = aclGetGroup ( group ) if ACLgroup then local accName = getAccountName(getPlayerAccount( player )) if isObjectInACLGroup ( "user.".. accName, ACLgroup ) then return group end end end end addEventHandler("onPlayerLogin",root, function() local acl = hasPermission(source) setElementData(source,"PlayerACL", acl) end) If you want you can edit the order of the ACL groups in the allowed var. its best to order it from highest rank to lowest
  12. No prob, just reply here if you are still getting any difficulties with it.
  13. You were going correct till you set "Admin" to true a better key should be something everyone could use. Setting a key like "PlayerAcl" and the value of it to the name of the acl is good. Like this: local admin = getElementData(getLocalPlayer(), "PlayerACL") dxDrawColorText ("#00BAFF" .. getPlayerName(player) .. " " .. state .. "" .. " (" .. admin .. ")", sx-w, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), player ~= g_Me and textscale*NAMETAG_TEXTSIZE or (textscale*NAMETAG_TEXTSIZE)/1.5, srfont, "center", "bottom", false, false, false ) local drawX = sx - NAMETAG_WIDTH*scale/2 addEventHandler("onPlayerLogin",root, function() if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ))then setElementData(source,"PlayerACL","Admin") end end)
  14. You can store it in element data from a table to a string with toJSON format then when you want to use it just convert it back to a table using fromJSON you should do it onPlayerLogin and onResourceStart
  15. getPlayerAcls is a custom server-sided function it wont work client-sided
  16. Try this: local state = getElementData(player,"isAFK") and "AFK" or "Active" dxDrawColorText ("#00BAFF" .. getPlayerName(player) .. " (" .. state .. ")", sx-w, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), player ~= g_Me and textscale*NAMETAG_TEXTSIZE or (textscale*NAMETAG_TEXTSIZE)/1.5, srfont, "center", "bottom", false, false, false )
  17. When you add players to a Room you can setElementData and use the Room name then when a player uses voice onClientPlayerVoiceStart do a check to see if his data for the room's name matches yours if it does not then cancelEvent. addEventHandler ( "onClientPlayerVoiceStart", root, function() if localPlayer ~= source then if getElementData(source, "VoiceRoom") ~= getElementData(localPlayer, "VoiceRoom") then cancelEvent() end end end )
  18. Use findRotation its a custom function so u need to add it to your code.
  19. you should use a loop like this: for currentRow,#availablejobs do end
  20. Also some servers set the game speed to 1.1 you can try that.
  21. you need to use onClientRender on this to draw it on the screen from line 30 to 36 getPlayerSerial is a server sided function this is a client script Use onPlayerLogin to check the player's serial and if its in the table then setElementData(player, "Owner",true) and instead of serials[Ser] use getElementData(p,"Owner")
  22. function mecanico ( thePlayer ) local car= getPedOccupiedVehicle ( thePlayer ) if isPedInVehicle( thePlayer ) then outputChatBox("reparaste el auto correctamente", thePlayer, 255, 255, 0) fixVehicle( car ) else outputChatBox("No estas en el vehiculo para reparar el coche", thePlayer, 255, 0, 0) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), mecanico) addCommandHandler("reparar", mecanico) You are getting the errors because you have the code on the client side, this is a server sided script.
×
×
  • Create New...