Jump to content

GUI - need little help


isa_Khamdan

Recommended Posts

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted

What do you mean...? you can't "output" a command.

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

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted
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 

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

You can use tables to store the vehicle of each player, then when he attempts to spawn another, you destroy his current.

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

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

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

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

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 ) 

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

And what is that suposed to do?

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

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

Because that script doesn't do what you just mentioned.

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

There's nothing to "fix", you just have to finish it.

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

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 ) 

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

You aren't reading what I say? that doesn't make any sense...

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

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted
executeCommandHandler( "Nexus", source ) 

?

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
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

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted
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"?

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
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 )

350x20_FFFFFF_FFFFFF_000000_000000.png

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