Jump to content

Updated to castillo and gangchat dosent work anymore


Dentos

Recommended Posts

So I change my gang system to castillo and my gangchat resource dosent work anymore :/

addEventHandler ( "onResourceStart", resourceRoot, 
function ( ) 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        bindKey ( player, "Y", "down", "chatbox", "gangChat" ) 
    end 
end 
) 
  
addEventHandler ( "onPlayerJoin", root, 
function ( ) 
    bindKey ( source, "Y", "down", "chatbox", "gangChat" ) 
end 
) 
  
function gangChat ( thePlayer, _, ... ) 
local isInvited = getElementData ( thePlayer, "invited" ) or false 
    if ( isInvited ) then 
        local text = table.concat ( { ... }, " " ) 
        if ( #text > 0 ) then 
            outputChatBox ("#FF32AA [GangChat] "..getPlayerName(thePlayer)..": #FFFFFF" ..text, thePlayer, 255, 255, 255, true ) 
        end 
    end 
end 
addCommandHandler ( "gangChat", gangChat ) 
  
function invitePlayer ( thePlayer, _, playerName ) 
    if not playerName then return end 
        local playerToInvite = getPlayerFromName(playerName) 
  
        if ( isElement ( playerToInvite ) ) and getElementType( playerToInvite ) == "player" then -- At function 'getElementType' you have 'argument' as the argument but this variable doesn't exist so I supposed is 'playerToInvited' 
            setElementData ( playerToInvite, "invited", true ) 
            outputChatBox ( "You have been invited to the chat.", playerToInvite) 
        else 
            outputChatBox ( "There is no such a player!", thePlayer ) 
        end 
    end 
end 
addCommandHandler ( "invite", invitePlayer ) 

please help :/

Link to comment
I get

ERROR: Loading script failed: GangChatd5/server.lua.37:'expected near 'end'

you have an Extra end ,

addEventHandler ( "onResourceStart", resourceRoot, 
function ( ) 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        bindKey ( player, "Y", "down", "chatbox", gangChat ) 
    end 
end 
) 
  
addEventHandler ( "onPlayerJoin", root, 
function ( ) 
    bindKey ( source, "Y", "down", "chatbox", gangChat ) 
end 
) 
  
function gangChat ( thePlayer, _, ... ) 
local isInvited = getElementData ( thePlayer, "invited" ) or false 
    if ( isInvited ) then 
        local text = table.concat ( { ... }, " " ) 
        if ( #text > 0 ) then 
            outputChatBox ("#FF32AA [GangChat] "..getPlayerName(thePlayer)..": #FFFFFF" ..text, thePlayer, 255, 255, 255, true ) 
        end 
    end 
end 
addCommandHandler ( "gangChat", gangChat ) 
  
function invitePlayer ( thePlayer, _, playerName ) 
    if not playerName then return end 
        local playerToInvite = getPlayerFromName(playerName) 
  
        if ( isElement ( playerToInvite ) ) and getElementType( playerToInvite ) == "player" then -- At function 'getElementType' you have 'argument' as the argument but this variable doesn't exist so I supposed is 'playerToInvited' 
            setElementData ( playerToInvite, "invited", true ) 
            outputChatBox ( "You have been invited to the chat.", playerToInvite) 
        else 
            outputChatBox ( "There is no such a player!", thePlayer ) 
        end 
end 
addCommandHandler ( "invite", invitePlayer ) 
Edited by Guest
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...