Jump to content

[Help :)] setPlayerTeam Error


denny199

Recommended Posts

Hey there, i was making a new gamemode but now i got a error @ setPlayerTeam Using triggering,

but i got a error when i double click on the image, works, but setPlayerTeam is not working

I want that the player who clicked on the Image gets in that team.

Client

  
lp = getLocalPlayer () 
  
-- u don't need gui stuff 
function maaskantje (player) 
outputChatBox ( "Maaskantje" ) 
showCursor ( false ) 
  
triggerServerEvent( 'maaskantjeteam',lp ) 
end 
addEventHandler ( "onClientGUIDoubleClick", GUIEditor_Image[2], maaskantje) 
  
function schijndel (player) 
outputChatBox ( "Schijndel" ) 
showCursor ( false ) 
triggerServerEvent( 'schijndelteam',lp ) 
end 
addEventHandler ( "onClientGUIDoubleClick", GUIEditor_Image[3], schijndel) 

Server

function createTeamsOnStart () 
maaskantje = createTeam ( "Maaskantje", 250, 0, 0 )  
schijndel = createTeam ( "Schijndel", 0, 0, 255 ) 
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  ) 
  
  
  
function maaskantje (source, maaskantje) 
        setPlayerTeam ( source,getTeamFromName( 'Maaskantje' ) ) 
        setElementModel ( source, 280 ) 
end 
addEvent ( "maaskantjeteam", true ) 
addEventHandler ( "maaskantjeteam", root, maaskantje ) 
  
  
function schijndel ( source, schijndel ) 
        setPlayerTeam ( source,getTeamFromName( 'Schijndel' ) ) 
        setElementModel ( source, 280 ) 
end 
addEvent ( "schijndelteam", true ) 
addEventHandler ( "schijndelteam", root, schijndel ) 

Thanks.

Link to comment

Server

local maaskantje = createTeam ( "Maaskantje", 250, 0, 0 )  
local schijndel = createTeam ( "Schijndel", 0, 0, 255 ) 
  
  
function maaskantje ( ) 
    setPlayerTeam ( source,getTeamFromName( 'Maaskantje' ) ) 
    setElementModel ( source, 280 ) 
end 
addEvent ( "maaskantjeteam", true ) 
addEventHandler ( "maaskantjeteam", root, maaskantje ) 
  
  
function schijndel ( ) 
    setPlayerTeam ( source,getTeamFromName( 'Schijndel' ) ) 
    setElementModel ( source, 280 ) 
end 
addEvent ( "schijndelteam", true ) 
addEventHandler ( "schijndelteam", root, schijndel ) 

You not need add source to arguments event handler function, because source already have in event and you replace with nil.

Client

function maaskantje ( ) 
    outputChatBox ( "Maaskantje" ) 
    showCursor ( false ) 
  
    triggerServerEvent( 'maaskantjeteam',localPlayer ) 
end 
addEventHandler ( "onClientGUIDoubleClick", GUIEditor_Image[2], maaskantje ) 
  
function schijndel ( ) 
    outputChatBox ( "Schijndel" ) 
    showCursor ( false ) 
    triggerServerEvent( 'schijndelteam',localPlayer ) 
end 
addEventHandler ( "onClientGUIDoubleClick", GUIEditor_Image[3], schijndel ) 

Variables GUIEditor_Image[2],GUIEditor_Image[3] defined?

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