Jump to content

Argh bad argument


mjau

Recommended Posts

Posted

Hi im working on my spawnmenu and now i want to make it set a player to a specific team when he spawns but i get bad arguments

Heres the code wich should set the team

function setTeam(player) 
setPlayerTeam ( player, Army_Rangers ) 
end 
addEvent( "giveTeam", true ) 
addEventHandler( "giveTeam", getRootElement(), setTeam ) 

And this is waht calls it

function recruitSpawn(button,state) 
    if button == "left" and state == "up" then 
        triggerServerEvent("recruitMove",getLocalPlayer(),207.00390625,1865.75390625,13.140625,0,287) 
        triggerServerEvent("giveweapon",getLocalPlayer()) 
        triggerServerEvent("giveTeam",getLocalPlayer()) 
        closeWindow() 
        removecursor() 
      end 
end 

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

And the team function?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

What you mean it is the girst one the team is aleready created ingame by me

Edit do i have to make the team in the script to ?

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted
local team  =createTeam(Army_Rangers) 
function setTeam(player) 
setPlayerTeam ( player, team ) 
end 
addEvent( "giveTeam", true ) 
addEventHandler( "giveTeam", getRootElement(), setTeam ) 

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted

bandi, that makes no sense... createTeam has 4 arguments, teamName, red, green, blue.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Still bad arguments ths is the code now

armyteam = createTeam(Army_Rangers) 
function setTeam(player) 
setPlayerTeam ( player, armyteam ) 
end 
addEvent( "giveTeam", true ) 
addEventHandler( "giveTeam", getRootElement(), setTeam ) 

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted (edited)

Of course that it makes bad arguments, you aren't creating the team at all.

armyteam = createTeam("Army_Rangers", 255, 255, 255) 
function setTeam(player) 
setPlayerTeam ( player, armyteam ) 
end 
addEvent( "giveTeam", true ) 
addEventHandler( "giveTeam", getRootElement(), setTeam ) 

Oh, and, the client side is wrong, aren't passing the 'player'.

function recruitSpawn(button,state) 
    if button == "left" and state == "up" then 
        triggerServerEvent("recruitMove",getLocalPlayer(),207.00390625,1865.75390625,13.140625,0,287) 
        triggerServerEvent("giveweapon",getLocalPlayer()) 
        triggerServerEvent("giveTeam",getLocalPlayer(),getLocalPlayer()) 
        closeWindow() 
        removecursor() 
      end 
end 

Edited by Guest

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

If you only put one, it'll send 'source', but not to the function (means example: function (source), that's wrong, 'source' won't appear in the function name).

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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