Jump to content

bad argument problema spawn


miniatur

Recommended Posts

hola a todos

bueno este es el resource de spawn de 50p pero modificado, la cuestion es que me tira este mensaje y quisiera saber donde es el problema

l360.png

g_root = getRootElement( ); 
classGroups = { }; 
  
  
addEvent( "spawn_clientRequestSpawn", true ); 
addEventHandler( "spawn_clientRequestSpawn", g_root, 
    function( categoryIndex, classIndex, skinIndex ) 
        local class = classGroups[ categoryIndex ].classes[ classIndex ]; 
        local skin = class.skinMngr.skins[ skinIndex ]; 
        local GangName = class.gang 
            if ( GangName and tostring(GangName)~="" ) then 
                local TheSpawnPlayerGangName = getElementData(client, "gang") 
                if ( TheSpawnPlayerGangName and tostring(TheSpawnPlayerGangName) == GangName ) then 
                    fadeCamera(client, false ); 
                    setTimer( SpawnPlayerOOPFunc, 1000, 1, categoryIndex, classIndex, skinIndex, client ); 
                else 
                    triggerClientEvent (client, "WarningSpawnForGang", client, GangName ) 
                end 
            else 
                fadeCamera(client, false ); 
                setTimer( SpawnPlayerOOPFunc, 1000, 1, categoryIndex, classIndex, skinIndex, client ); 
            end 
    end 
); 
  
function SpawnPlayerOOPFunc(categoryIndex, classIndex, skinIndex, thePlayer) 
    if skinIndex then 
        local class = classGroups[ categoryIndex ].classes[ classIndex ]; 
        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 
            spawned = spawnPlayer( 
                thePlayer, 
                skin.spawnLoc.x, 
                skin.spawnLoc.y, 
                skin.spawnLoc.z, 
                skin.spawnLoc.rot, 
                skin.modelId, 
                0, 0, 
                class.team 
) 
        end 
         
        if spawned then 
            setElementData( thePlayer, "team", class.name ) 
            setElementData( thePlayer, "classnme", tostring(skin.name) ) 
            fadeCamera( thePlayer, true ); 
            setCameraTarget( thePlayer, thePlayer ); 
            setTimer( setCameraTarget, 100, 1, thePlayer, thePlayer ); 
            triggerClientEvent( thePlayer, "spawn_SpawnedSuccessfully", thePlayer ); 
            for _, weapon in ipairs( class.weaponMngr.weapons ) do 
                giveWeapon( thePlayer, weapon.id, weapon.ammo, false ); 
            end 
            createBlipAttachedTo( thePlayer, 0, 2, class.color.red, class.color.green, class.color.blue ) 
        end 
    end 
  
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 
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 
) 

Link to comment
  • Recently Browsing   0 members

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