Jump to content

Handling change and spawnscreen Help needed


thelaser

Recommended Posts

Hello everybody, i'm new to lua scripting, and saw someone's post with a handling script, i wanna use it for the police sf id 597

is there something wrong?

client

vehicleIDS = { 597, } 
  
function changeHandling ( ) 
    for _, model in ipairs ( vehicleIDS ) do 
        setModelHandling ( model, "maxVelocity", 800 ) 
        setModelHandling ( model, "acceleration", 25 ) 
        setModelHandling ( model, "tractionMultiplier", 5 ) 
        end 
    end 
    addEventHandler ( "onResourceStart", resourceRoot, changeHandling ) 

and also i use the spawnscreen of 50P, but i wanna lock it on ACL because i havn't made a better one with city's etc, so my question is can somebody tell me how i add a category list with the city's and how to change it to ACL locked? i would really appreciate that if someone could help me. i read in an other topic that they said change lua line 21 to this i did it but i did not worked i couldn't spawn as anything, i also tried to make it not with a .map but with a XML file

This is the s_main where i had to edit it in.

g_root = getRootElement( ); 
classGroups = { }; 
  
  
addEvent( "spawn_clientRequestSpawn", true ); 
addEventHandler( "spawn_clientRequestSpawn", g_root, 
    function( categoryIndex, classIndex, skinIndex, password ) 
        if skinIndex then 
            local class = classGroups[ categoryIndex ].classes[ classIndex ]; 
            if class.password then 
                if not password or password == "" then 
                    triggerClientEvent( client, "spawn_requestAclgroup", root, class.name ); 
                    return; 
                elseif password ~= class.password then 
                    outputChatBox( "The password you typed in is incorrect! Try again or cancel to choose different class.", client, 200, 50, 50 ); 
                    triggerClientEvent( client, "spawn_requestPassword", root, class.name ); 
                    return; 
                end 
            end 
             local classACL = aclGetGroup( class.name ); 
            local playerAccount = getPlayerAccount( client ); 
            if ( classACL and ( not isGuestAccount( playerAccount ) ) or ( not isObjectInACLGroup( "user." .. getAccountName( playerAccount ), classACL ) ) ) then 
                outputChatBox( "You are not member of this group/gang/squad/. Please, choose different team!", client, 200, 50, 50 ); 
                requestMenu( client ); 
                return; 
            end 
            local skin = class.skinMngr.skins[ skinIndex ]; 
            local spawn = true; 
            local spawned; 
             
            if spawn then 
                if not class.team then 
                    class.team = createTeam( class.name, class.color.red, class.color.green, class.color.blue ); 
                end 
                 
                local plrTeam = getPlayerTeam( client ); 
                if ( ( plrTeam ) and ( plrTeam ~= class.team ) and ( countPlayersInTeam( plrTeam ) == 1 ) ) then 
                    destroyElement( plrTeam ); 
                end 
                 
                spawned = spawnPlayer( 
                    client, 
                    skin.spawnLoc.x, 
                    skin.spawnLoc.y, 
                    skin.spawnLoc.z, 
                    skin.spawnLoc.rot, 
                    skin.modelId, 
                    0, 0, 
                    class.team 
                ); 
            end 
             
            if spawned then 
                setElementData( client, "team", class.name ) 
                setElementData( client, "skin", skin.name ) 
                fadeCamera( client, true ); 
                setCameraTarget( client, client ); 
                setTimer( setCameraTarget, 200, 1, client, client ); 
                 
                triggerClientEvent( client, "spawn_SpawnedSuccessfully", client ); 
                 
                --setPlayerMoney( client, 500 ); 
                for _, weapon in ipairs( class.weaponMngr.weapons ) do 
                    giveWeapon( client, weapon.id, weapon.ammo, false ); 
                end 
                createBlipAttachedTo( client, 0, 2, class.color.red, class.color.green, class.color.blue ) 
            else 
                triggerClientEvent( client, "spawn_FailedToSpawn", client ); 
                if countPlayersInTeam( class.team ) == 0 then 
                    destroyElement( class.team ); 
                    class.team = nil; 
                end 
            end 
        end 
    end 
); 
  
addEvent( "spawn_checkAclgroup", true ); 
addEventHandler( "spawn_receivePassword", g_root, 
    function( ) 
     
    end 
); 
  
  
addEventHandler( "onPlayerSpawn", g_root, 
    function ( ) 
     
    end 
); 
  
addEventHandler( "onPlayerWasted", g_root, 
    function( ) 
        fadeCamera( source, false, 4 ); 
        setTimer( requestMenu, 5000, 1, source ); 
        deleteAllPlayerBlips( source ) 
    end 
); 
  
function requestMenu( player ) 
    callClientFunc( player, "showSpawnMenu", true, true ); 
    callClientFunc( player, "classSelected" ); 
end 
  
  
addCommandHandler( "kill", 
    function( plr ) 
        killPed( plr ); 
    end 
) 
  
  
  
function preloadClassesInfo( ) 
    local groups = getElementsByType( "category" ); 
    for _, group in ipairs( groups ) do 
        table.insert( classGroups, Group:New( group ) ); 
    end 
end 
addEventHandler( "onResourceStart", getResourceRootElement(), preloadClassesInfo ) 
  
  
function deleteAllPlayerBlips(player) 
    local elements = getAttachedElements(player) 
    if (elements) then 
        for i, element in ipairs(elements) do 
            if (getElementType(element) == "blip") then 
                destroyElement(element) 
            end 
        end 
    end 
    print( "number of players in team: " .. tostring( countPlayersInTeam( getPlayerTeam( player ) ) ) ); 
end 
  
addEventHandler( "onPlayerQuit", g_root, function() deleteAllPlayerBlips(source) end ); 
  
  
------------------------------------------------------------------------------------------ 
------------------------------------------------------------------------------------------ 
function callClientFunc( player, funcName, ... ) 
    if #{ ... } ~= 0 then 
        triggerClientEvent( player, "_clientCallFunction", root, funcName, ... ) 
    else 
        triggerClientEvent( player, "_clientCallFunction", root, funcName ) 
    end 
end 
  
addEvent( "_serverCallFunction", true ) 
addEventHandler( "_serverCallFunction", root,  
    function( funcName, ... ) 
        _G[ funcName ](...) 
    end 
) 

regards Thelaser

Link to comment

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