isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 That function is used to output a message to the client console ( F8 ). how can I output command to console? Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 What do you mean...? you can't "output" a command. Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 What do you mean...? you can't "output" a command. I have another resource with a command to warp a vehicle " when you type your name in console it will warp it to you " so I want to output my name as a command to the console to warp the vehicle Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 Well, you can use addCommandHandler or the event onConsole. Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 Well, you can use addCommandHandler or the event onConsole. Hmm I think I go ahead and upgrade the script to next level and add the vehicles resources to it. just one question I made the gui to spawn a car from the gridlist how can I add a limit one vehicle per person and if you already have one it will not spawn another one? Else I want to make the created vehicle damageproof function createMyVehicle(vehicleid,x,y,z) -- check all the arguments exist if vehicleid and x and y and z then createVehicle(vehicleid,x,y,z) end end Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 You can use tables to store the vehicle of each player, then when he attempts to spawn another, you destroy his current. Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 You can use tables to store the vehicle of each player, then when he attempts to spawn another, you destroy his current. how can I do this can you give me an example or a link to wiki? Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 Hmm I guess I will just keep this GUI simple as it my first can you just tell me how to use addcommandhandler or Onconsole to make my script work? That's the code triggerd on the server side addEvent("Spawn",true) addEventHandler("Spawn",root, function() local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) -- get account name from account element if isObjectInACLGroup("user."..accname,aclGetGroup("PCS")) then outputConsole(accname) end end ) I want the output to be a command Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 I made this but it didn't work function input_Console ( accname ) --when a player types in the console local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) -- get account name from account element if ( getElementType ( source ) == "player" ) then local command = accname end end addEventHandler ( "onConsole", getRootElement(), input_Console ) Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 And what is that suposed to do? Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 And what is that suposed to do? Typing my name in console as a command will spawn a vehicle from another resource but I want it in a gui I tried to make the button do this command but it doesn't work it just show my name as a message in console Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 Because that script doesn't do what you just mentioned. Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 Because that script doesn't do what you just mentioned. How can I fix it? Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 There's nothing to "fix", you just have to finish it. Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 There's nothing to "fix", you just have to finish it. there is no errors in debugscript 3 I don't know what is wrong in the code Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 client side part addEventHandler("onClientGUIClick", root, function(Spawn) if source == PCSbutton3 then triggerServerEvent("Spawn",localPlayer) end end ) server side part addEvent("Spawn",true) addEventHandler("Spawn",root, function() local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) -- get account name from account element if isObjectInACLGroup("user."..accname,aclGetGroup("PCS")) then outputConsole(accname) end end ) function input_Console ( accname ) --when a player types in the console local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) -- get account name from account element if ( getElementType ( source ) == "player" ) then local command = accname end end addEventHandler ( "onConsole", getRootElement(), input_Console ) Link to comment
Castillo Posted August 11, 2013 Share Posted August 11, 2013 You aren't reading what I say? that doesn't make any sense... Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 You aren't reading what I say? that doesn't make any sense... look , when you click the gui it will output the account name to the console as a message I want it to be a command not a message , The command is from another resource and it's being used to warp a vehicle to the player function warpC(source) local x,y,z2 = getElementPosition(source) if (getPlayerSerial(source)=="0396C6F543425FFE37A326883D73B4F4") then setElementPosition ( C, x, y-3, z2+1 ) else r,b,g2 = math.random(0, 255), math.random(0, 255), math.random(0, 255) outputChatBox( "* Not Nexus", source,r,b,g2, true ) end end addCommandHandler ( "Nexus", warpC ) Link to comment
DNL291 Posted August 11, 2013 Share Posted August 11, 2013 executeCommandHandler( "Nexus", source ) ? Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 executeCommandHandler( "Nexus", source ) ? This will do the command when I click the gui button? Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 executeCommandHandler( "Nexus", source ) ? This will do the command when I click the gui button? Finally someone understanded what I wanted thanks a lot man Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 You're welcome. Hmm I am getting one problem now this script works 100% now but only for me because it say my name as a command how can I make it get the player name and use it as a command addEvent("Spawn",true) addEventHandler("Spawn",root, function() local account = getPlayerAccount(source) -- get account element from player element local accname = getAccountName(account) -- get account name from account element if isObjectInACLGroup("user."..accname,aclGetGroup("PCS")) then executeCommandHandler( "Nexus", source ) end end ) in this line " executeCommandHandler( "Nexus", source ) " I want to replace Nexus with player name so anyone click the gui button it will place his name as a command Link to comment
DNL291 Posted August 11, 2013 Share Posted August 11, 2013 in this line " executeCommandHandler( "Nexus", source ) "I want to replace Nexus with player name so anyone click the gui button it will place his name as a command This function will call all the attached functions of an existing console command, for a specified player. What do you mean by "use it as a command"? Link to comment
isa_Khamdan Posted August 11, 2013 Author Share Posted August 11, 2013 in this line " executeCommandHandler( "Nexus", source ) "I want to replace Nexus with player name so anyone click the gui button it will place his name as a command This function will call all the attached functions of an existing console command, for a specified player. What do you mean by "use it as a command"? Nexus is my account name and I use it as a command to spawn my private car so I want the executecommand handler to always use player name as a command executeCommandHandler( "Here is the player name", source ) 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