Jump to content

Need Help Please.


ramzi

Recommended Posts

Posted

guys i edited this script,it is (area51 protection)script,it was for skin 287 and i made it for team,but i had this problem!

this is the error msg:

[2014-12-22 18:13:30] WARNING: mil_protection\ad_base_s.lua:14: Bad argument @ 'getPlayerTeam' [Expected player at argument 1, got nil]

[2014-12-22 18:13:30] WARNING: mil_protection\ad_base_s.lua:14: Bad argument @ 'getTeamName' [Expected team at argument 1, got boolean]

and here is the code:

g_base_col = createColCuboid ( 97.3376, 1800.0384, -32.0937, 250, 280, 120 ) 
createBlip ( 193.248, 1890.01, 17.234, 47 ) 
  
g_root = getRootElement () 
  
--rocketOne = createMarker ( -2931.5136, 454.4492, 17.3671, "corona", 1.5, 255, 0, 0, 150 ) --test marker 
--rocketTwo = createMarker ( -2931.5932, 487.1994, 17.3671, "corona", 1.5, 255, 0, 0, 150 ) --test marker 
  
function hit ( pla, dim ) 
    if getElementType ( pla ) == "player" then 
    local vehicle = getPedOccupiedVehicle ( pla ) 
        if vehicle or not vehicle then 
            local className = "Delta Force" 
            if ( getTeamName(getPlayerTeam(thePlayer)) == "Delta Force" ) then 
                outputChatBox ( "Welcome, "..getPlayertName(pla).."!", pla, 0, 150, 0 ) 
            else 
                setElementData ( pla, "inRestrictedArea", "true" ) 
                triggerClientEvent ( pla, "destroyTrepassor", g_root, pla ) 
                outputChatBox ( "***Restricted Area***", pla, 255, 0, 0 ) 
                outputChatBox ( "* "..getPlayerName(pla).." has entered Restricted Area!", g_root, 255, 0, 0 ) 
            end 
        end 
    end 
end 
addEventHandler ( "onColShapeHit", g_base_col, hit ) 
  
function leave ( pla, dim ) 
    if getElementType ( pla ) == "player" then 
    local vehicle = getPedOccupiedVehicle ( pla ) 
        if vehicle or not vehicle then 
            local className = "Delta Force" 
            if ( getTeamName(getPlayerTeam(thePlayer)) == "Delta Force" ) then 
                outputChatBox ( "Good Bye!", pla, 0, 100, 0 ) 
            else 
                setElementData ( pla, "inRestrictedArea", "false" ) 
                triggerClientEvent ( pla, "destroyTimers", g_root, pla ) 
                outputDebugString ( "*"..getPlayerName(pla).." has left col shape" ) 
            end 
        end 
    end 
end 
addEventHandler ( "onColShapeLeave", g_base_col, leave ) 

Posted

  
if ( getTeamName(getPlayerTeam(thePlayer)) == "Delta Force" ) then 
  

replace it with

  
if ( getTeamName(getPlayerTeam(pla)) == "Delta Force" ) then 
  

Your player var is "pla" not thePlayer, that's it.

On line 32 aswell.

Posted

well it worked fine thnx so much,but i still have a little problem with this error:

ERROR: mil_protection\ad_base_s.lua:15: attempt to call global 'getPlayertName' (a nil value),chatbox doesnt appear.

Posted

change this

outputChatBox ( "Welcome, "..getPlayertName(pla).."!", pla, 0, 150, 0 ) 

to this

outputChatBox ( "Welcome, "..getPlayerName(pla).."!", pla, 0, 150, 0 ) 

Posted
well it worked fine thnx so much,but i still have a little problem with this error:

ERROR: mil_protection\ad_base_s.lua:15: attempt to call global 'getPlayertName' (a nil value),chatbox doesnt appear.

oh,i fixed it,i just changed getPlayerName with get ClientName

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