TroyBoy Posted February 15, 2012 Share Posted February 15, 2012 look i wana do this command: addCommandHandler( "go", gotoplayerposition ) function gotoplayerposition ( theplayer, command ) local playerTeam = getPlayerTeam ( source ) if ( playerTeam ) then local name = getTeamName ( playerTeam ) if name == "Owner" then local find = findPlayer( player ) if find == false then outputChatbox ( "No player with that name." ) else local px, py, pz = getElementPosition ( find ) setElementPosition (source, px, py, pz ) end else outputChatbox ( "Not an admin!" ) end end end for the owner and the admin team but when i try to do this i have an error help please Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 (edited) Server addCommandHandler( "go", function ( player, _,name ) local playerTeam = getPlayerTeam ( player ) if playerTeam then local name = getTeamName ( playerTeam ) if name == "Owner" then local find = findPlayer( name ) if not find then outputChatBox ( "No player with that name." ) else local px, py, pz = getElementPosition ( find ) setElementPosition ( player, px, py, pz ) end else outputChatBox ( "Not an admin!" ) end end end ) Edited February 15, 2012 by Guest Link to comment
TroyBoy Posted February 15, 2012 Author Share Posted February 15, 2012 WARNING: myserver\OwnerTeam.lua:59: Bad argument @ 'addCommandHandler' [Expected function at argument 2, got nil this is this lines this is when i put only owner with the admin this is the error: [2012-02-15 20:04:38] SCRIPT ERROR: myserver\OwnerTeam.lua:81: 'end' expected (to close 'function' at line 60) near '' [2012-02-15 20:04:38] WARNING: Loading script failed: myserver\OwnerTeam.lua:81: 'end' expected (to close 'function' at line 60) near '' Link to comment
TroyBoy Posted February 15, 2012 Author Share Posted February 15, 2012 its work but can you give me this code to work on two teams on the admin team and the owner team Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 addCommandHandler( "go", function ( player, _,name ) local playerTeam = getPlayerTeam ( player ) if playerTeam then local name = getTeamName ( playerTeam ) if name == "Owner" or name == "Admin" then local find = findPlayer( name ) if not find then outputChatBox ( "No player with that name." ) else local px, py, pz = getElementPosition ( find ) setElementPosition ( player, px, py, pz ) end else outputChatBox ( "Not an admin or owner!" ) end end end ) Link to comment
TroyBoy Posted February 15, 2012 Author Share Posted February 15, 2012 ty can you give me a code that only the player TroyBoy can put him self in the Owner Team Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 addCommandHandler( "set_team", function ( player, _,name ) if getPlayerName( player ) == 'TroyBoy' then local find = findPlayer( name ) if not find then outputChatBox ( "No player with that name." ) else setPlayerTeam( find,getTeamFromName( 'Owner' ) ) end else outputChatBox ( "You can't use this command!" ) end end ) /set_team [nickname] Link to comment
TroyBoy Posted February 15, 2012 Author Share Posted February 15, 2012 and can you do this 2 commands only to admin and owner please: addCommandHandler( 'givemoney', function( source,_,player,amount ) local find = findPlayer( player ) if find then if amount then givePlayerMoney( find,tonumber( amount ) ) outputChatBox( '[givemoney]:You transfer $'..amount..' to '..getPlayerName( find ),source,255,0,0 ) else outputChatBox( '[givemoney]:/givemoney [playername][amount]!',source,255,0,0 ) end else outputChatBox( '[givemoney]:Player not found!',source,255,0,0 ) end end ) function consoleGiveCash ( thePlayer, command, amount ) --when the givecash command is called givePlayerMoney ( thePlayer, amount ) --give the player money according to the amount end addCommandHandler ( "givecash", consoleGiveCash ) --add a handler function for the command "givecash" addCommandHandler( 'cv', function( player,_,id_name ) local x,y,z = getElementPosition( player ) local model = getVehicleModelFromName( id_name ) if not model then model = tonumber( id_name ) end if createVehicle( model,x+1,y,z ) then outputChatBox( 'Success created: '..tostring( getVehicleNameFromModel( model ) ) ) else outputChatBox( 'Vehicle not created: '..tostring( getVehicleNameFromModel( model ) ) ) end end ) Link to comment
Kenix Posted February 15, 2012 Share Posted February 15, 2012 Server addCommandHandler( 'givemoney', function( player,_,nick,amount ) local playerTeam = getPlayerTeam ( player ) if playerTeam then local name = getTeamName ( playerTeam ) if name == "Owner" or name == "Admin" then local find = findPlayer( nick ) if find then if amount then givePlayerMoney( find,tonumber( amount ) ) outputChatBox( '[givemoney]:You transfer $'..amount..' to '..getPlayerName( find ),player,255,0,0 ) else outputChatBox( '[givemoney]:/givemoney [playername][amount]!',player,255,0,0 ) end else outputChatBox( '[givemoney]:Player not found!',player,255,0,0 ) end else outputChatBox ( "Not an admin or owner!" ) end end end ) function consoleGiveCash ( player, command, amount ) --when the givecash command is called local playerTeam = getPlayerTeam ( player ) if playerTeam then local name = getTeamName ( playerTeam ) if name == "Owner" or name == "Admin" then givePlayerMoney ( player, tonumber( amount ) ) --give the player money according to the amount else outputChatBox ( "Not an admin or owner!" ) end end end addCommandHandler ( "givecash", consoleGiveCash ) --add a handler function for the command "givecash" addCommandHandler( 'cv', function( player,_,id_name ) local playerTeam = getPlayerTeam ( player ) if playerTeam then local name = getTeamName ( playerTeam ) if name == "Owner" or name == "Admin" then local x,y,z = getElementPosition( player ) local model = getVehicleModelFromName( id_name ) if not model then model = tonumber( id_name ) end if createVehicle( model,x+1,y,z ) then outputChatBox( 'Success created: '..tostring( getVehicleNameFromModel( model ) ) ) else outputChatBox( 'Vehicle not created: '..tostring( getVehicleNameFromModel( model ) ) ) end else outputChatBox ( "Not an admin or owner!" ) end end end ) You should continue to do everything myself. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now