Jump to content

[HELP] addCommandHandler for group


Synthe1

Recommended Posts

Hello community, I need your help with script, I want to make this command only for VIP group but I don't know how,  one thing I know is that I have to use:

if isObjectInACLGroup

Can you help me please?

function addPaintjob(commandName,paintjobID)
	me = getLocalPlayer()
if isPedInVehicle ( me ) then
	triggerServerEvent ( "addPJ", resourceRoot, tonumber(paintjobID), me )
end
end
addCommandHandler ("addpaintjob",addPaintjob)

function addPaintjob2(paintjobID,player)
if paintjobID == 1 then
	myTexture = dxCreateTexture( "paintjob1.png" )
	elseif paintjobID == 2 then
	myTexture = dxCreateTexture( "paintjob2.png" )
	elseif paintjobID == 3 then
	myTexture = dxCreateTexture( "paintjob3.png" )
	elseif paintjobID == 4 then
	myTexture = dxCreateTexture( "paintjob4.png" )
	elseif paintjobID == 5 then
	myTexture = dxCreateTexture( "paintjob5.png" )
	elseif paintjobID == 6 then
	myTexture = dxCreateTexture( "paintjob6.jpg" )
	elseif paintjobID == 7 then
	myTexture = dxCreateTexture( "paintjob7.jpg" )
	elseif paintjobID == 8 then
	myTexture = dxCreateTexture( "paintjob8.jpg" )
	elseif paintjobID == 9 then
	myTexture = dxCreateTexture( "paintjob9.jpg" )
	else
	if player == getLocalPlayer() then
	outputChatBox ("There is no such paintjob ID!")
	return
	end
	end
	engineRemoveShaderFromWorldTexture ( shader_cars, "vehiclegrunge256", getPedOccupiedVehicle(player) )
	shader_cars, tec = dxCreateShader ( "shader.fx" )
	engineApplyShaderToWorldTexture ( shader_cars, "vehiclegrunge256", getPedOccupiedVehicle(player) )
	dxSetShaderValue ( shader_cars, "TX0", myTexture ) 
end
addEvent( "addPJ2", true )
addEventHandler( "addPJ2", getLocalPlayer(), addPaintjob2 )

 

Link to post
local ValidIDs = { -- Create a table with valid paintjob ids
    [1]=true, [2]=true, [3]=true,
    [4]=true, [5]=true, [6]=true,
    [7]=true, [8]=true, [9]=true
}

function addPaintjob(player,_,paintjobID)
    local acc = getAccountName( getPlayerAccount( player ) )
    -- get player account name
    if not isObjectInACLGroup( "user."..acc, aclGetGroup( "VIP" ) ) then return end
    -- chekck if player is in ACL 'VIP' and if not then return
    if tonumber(paintjobID) and ValidIDs[paintjobID] then
    -- Check if the ID is Valid
        if isPedInVehicle ( player ) then
            -- Check if the player is in a vehicle
            triggerClientEvent( root, "addPJ", resourceRoot, paintjobID, player )
            -- trigger the client event setting the player who used the command as the source
        else
            outputChatBox( "You are not in a vehicle.", player, 255,100,100 )
        end
    else
        outputChatBox( "Invalid Paintjob ID.", player, 255,100,100 )
    end
end
addCommandHandler ("addpaintjob",addPaintjob)

This is serverside.

 

Also you should store the shaders and textures within a table and delete them when they are no longer needed because i can drain your memory after constant use.

  • Thanks 1
Link to post
2 minutes ago, Mr.Loki said:

local ValidIDs = { -- Create a table with valid paintjob ids
    [1]=true, [2]=true, [3]=true,
    [4]=true, [5]=true, [6]=true,
    [7]=true, [8]=true, [9]=true
}

function addPaintjob(player,_,paintjobID)
    local acc = getAccountName( getPlayerAccount( player ) )
    -- get player account name
    if not isObjectInACLGroup( "user."..acc, aclGetGroup( "VIP" ) ) then return end
    -- chekck if player is in ACL 'VIP' and if not then return
    if tonumber(paintjobID) and ValidIDs[paintjobID] then
    -- Check if the ID is Valid
        if isPedInVehicle ( player ) then
            -- Check if the player is in a vehicle
            triggerClientEvent( root, "addPJ", resourceRoot, paintjobID, player )
            -- trigger the client event setting the player who used the command as the source
        else
            outputChatBox( "You are not in a vehicle.", player, 255,100,100 )
        end
    else
        outputChatBox( "Invalid Paintjob ID.", player, 255,100,100 )
    end
end
addCommandHandler ("addpaintjob",addPaintjob)

This is serverside.

 

Also you should store the shaders and textures within a table and delete them when they are no longer needed because i can drain your memory after constant use.

Please answer me job system please ! @Mr.Loki

Link to post
10 minutes ago, xXGhostXx said:

Please answer me job system please ! @Mr.Loki

The guy above me already gave you an answer. I don't help people who can't make an effort to help themselves(Unless you pay me ofcourse). Also Do not hijack threads you can get your account removed.

 

Link to post

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...