Jump to content

Help, please


Szaphi

Recommended Posts

Posted

Help me, i don't know how to determine positions, Now this look like this:
faggio1 = createVehicle(403,297.32913, -168.79048, 2.54699, 0, 0, 90)
setElementData(faggio, "pojazd_opis", "test \n GBA 421[SA]28") (Pojazd_opis description vehicle)

wait(3)

if faggio1.position == (403,297.32913, -168.79048, 2.54699, 0, 0, 90) then
    nil 
else 
wait(10)
    faggio1.position = Vector3.new (403,297.32913, -168.79048, 2.54699, 0, 0, 90) 

Posted

Is this even Lua?

 

faggio1 = createVehicle(403,297.32913, -168.79048, 2.54699, 0, 0, 90)
setElementData(faggio1, "pojazd_opis", "test \n GBA 421[SA]28")

if getElementData(faggio1,"pojazd_opis") then
print("it has the data")
end

 

Try explaining the code 

Posted
5 minutes ago, VenomOG said:

Is this even Lua?

 


faggio1 = createVehicle(403,297.32913, -168.79048, 2.54699, 0, 0, 90)
setElementData(faggio1, "pojazd_opis", "test \n GBA 421[SA]28")

if getElementData(faggio1,"pojazd_opis") then
print("it has the data")
end

 

Try explaining the code 

Yeah this is Lua but i dunno how explain position so i'll try vector.3 and Faggio1.Position like in unity, I'll try this an another day becaus in my country is night, and i go sleep.

Posted (edited)
1 hour ago, Szaphi said:

Help me, i don't know how to determine positions, Now this look like this:
faggio1 = createVehicle(403,297.32913, -168.79048, 2.54699, 0, 0, 90)
setElementData(faggio, "pojazd_opis", "test \n GBA 421[SA]28") (Pojazd_opis description vehicle)

wait(3)

if faggio1.position == (403,297.32913, -168.79048, 2.54699, 0, 0, 90) then
    nil 
else 
wait(10)
    faggio1.position = Vector3.new (403,297.32913, -168.79048, 2.54699, 0, 0, 90) 

I just want to determine player in car or not in car, and whe palyer are not in vehicle then teleport to create position, if u know what i mean


faggio1 = createVehicle(403,297.32913, -168.79048, 2.54699, 0, 0, 90)
function VehControllerExit ( x )
    player_faggio1 = getVehicleController ( faggio1 )
    wait(3) --Maybe someone go drive
    if ( player_faggio1 ) then 
          --player is here
    else
          faggio1.posX = 297.32913
          faggio1.posY = -168.79048
          faggio1.posZ = 2.54699
    end
end
addEventHandler ( "onTrailerDetach", getRootElement(), VehControllerExit )
this can work?

 

Edited by Szaphi
Posted (edited)

Okay, Thank, But i have another problem, I dunno how to do acl group
" if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Policja" ) ) then" And i need help, how do gorup acl policja - police

Edited by Szaphi
Posted

you mean this?

if not isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Policja" ) ) then return end

 

Posted (edited)

I mean how add player to acl gorup and how do acl gorup and I can do something like this:
Function addVip()
    something (xD)
end
addCommandHandler ( "giveVip", add|Vip() )?|
|This script for i need a Acl gorup :D


function kajdankii ( player, cmd, gracz )
    local playerName = getAccountName ( getPlayerAccount ( player ) )
    if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "Policja" ) ) then
          setAccountData(getPlayerAccount(getPlayerFromName(gracz)), "kajdanki", true)
          toggleControl(getPlayerFromName(gracz), "sprint", false )
          toggleControl(getPlayerFromName(gracz), "jump", false )
          toggleControl(getPlayerFromName(gracz), "aim_weapon", false )
          toggleControl(getPlayerFromName(gracz), "fire", false )
          toggleControl(getPlayerFromName(gracz), "crouch", false )
          outputChatBox("#0078FFU U put on handcuss",player,255, 0, 0, true)
          outputChatBox("#0078FFPoliceman put on u handcuffs",gracz,255, 0, 0, true) 
|
 

kajdanki = handcuffs

Edited by Szaphi
Posted
function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end

addCommandHandler("addVip", function(pl, cmd, ...)
    local nick = table.concat({...}, " ")
    local player = getPlayerFromPartialName(nick)
    if not player then return end
    local accName = getAccountName(player)
    aclGroupAddObject(aclGetGroup("Vip"), "user."..accName)
end)
 

Try this code

  • 4 weeks later...
Posted

Don't work, i try modify but nothing ;/

On 17/11/2019 at 21:20, JeViCo said:

function getPlayerFromPartialName(name)
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil
    if name then
        for _, player in ipairs(getElementsByType("player")) do
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower()
            if name_:find(name, 1, true) then
                return player
            end
        end
    end
end

addCommandHandler("addVip", function(pl, cmd, ...)
    local nick = table.concat({...}, " ")
    local player = getPlayerFromPartialName(nick)
    if not player then return end
    local accName = getAccountName(player)
    aclGroupAddObject(aclGetGroup("Vip"), "user."..accName)
end)

 

Try this code

 

Posted
addCommandHandler("addVip", function(pl, cmd, ...)
    local nick = table.concat({...}, " ")
    local player = getPlayerFromPartialName(nick)
    if not player then return end
    local acc = getPlayerAccount(player)
    local accName = getAccountName(acc)
    aclGroupAddObject(aclGetGroup("Vip"), "user."..accName)
    aclReload() -- apply changes
end, true)

Mistake was there:

getAccountName(player)

I used player element instead of account
By the way, don't forget to add command.addVip permission to use command

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...