Robert333

Members
  • Content Count

    15
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Robert333

  • Rank
    Square
  1. Everyone has the problem too. If you create a Window with relative sizes the window will visibly on your PC super but on others not. So my solution is: Create the Window (just the window!) in absolute sizes, so on every PC your GUI has the same large. In the Window you can script your gui-elements in relative sizes again. Tip: --If you want your GUI showing in middle of screen use this code to get the pos and lengths local w = 200 --length on x 200px local h = 200 --length on y 200px local screenX, screenY = guiGetScreenSize () local x = screenX/2 - w/2 local y = screenY/2 - h/2 local window = guiCreateWindow ( x, y, w, h, 'My Window', false )
  2. for i = 1, 20 do if i ~= 15 then -- if the value i is not 15 the script go on else it do nothing -- do what you must do end end I think you mean this. But I also new in Lua, so it can maybe wrong or i haven't understood you.
  3. I think there is just a spelling mistake. You get with the function 'getPlayerOccupiedVehicle' the 'vehicle' and you set 'Vehicle' as variable, but then you called in 'fixVehicle' the variable 'theVehicle'. Try to set in 'fixVehicle' the variable 'Vehicle' or set the variable of 'getPlayerOccupiedVehicle' to 'theVehicle'. If you use Notepad++ you can avoid this mistakes by double clicking the variable, then notepad show you all words (variables) that have the same name.
  4. Maybe the Ped havn't the right slot of weapon, use setPedWeaponSlot to set M4 as Weapon for Ped. But I don't know whether that works I don't work with peds until now. function pedLoad() ped1 = createPed ( 287, 223, 1875, 18 ) giveWeapon( ped1, 31, 500, true ) setPedWeaponSlot ( ped1, 5 ) -- Slot 5, because M4 is a "Assault Rifles" and that is in Slot 5 end addEventHandler ( "onResourceStart", getRootElement(), pedLoad )
  5. Maybe the Ped havn't the right slot of weapon, use setPedWeaponSlot to set M4 as Weapon for Ped. But I don't know whether that works I don't work with peds until now. function pedLoad() ped1 = createPed ( 287, 223, 1875, 18 ) giveWeapon( ped1, 31, 500, true ) setPedWeaponSlot ( ped1, 5 ) -- Slot 5, because M4 is a "Assault Rifles" and that is in Slot 5 end addEventHandler ( "onResourceStart", getRootElement(), pedLoad )
  6. This should works, it's from Wiki: function createGate() gatePolice = createObject ( 987, -2494.3918457031, 1199.9107666016, 36.207420349121, 0, 0, 41.605255126953 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function openGate( playerSource, commandName ) -- FROM WIKI (not mine, so it might be right) -- Open Gate if he has access local playerName = getPlayerName ( playerSource) -- Does he have access to Admin functions? if isObjectInACLGroup( "user." .. playerName, aclGetGroup ( "Admin" ) ) then -- He's an admin. Open the Gate. moveObject( gatePolice, 3000, -2494.3918457031, 1199.9107666016, 43.207420349121 ) end end addCommandHandler( "open", openGate )
  7. This should works, it's from Wiki: function createGate() gatePolice = createObject ( 987, -2494.3918457031, 1199.9107666016, 36.207420349121, 0, 0, 41.605255126953 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createGate ) function openGate( playerSource, commandName ) -- FROM WIKI (not mine, so it might be right) -- Open Gate if he has access local playerName = getPlayerName ( playerSource) -- Does he have access to Admin functions? if isObjectInACLGroup( "user." .. playerName, aclGetGroup ( "Admin" ) ) then -- He's an admin. Open the Gate. moveObject( gatePolice, 3000, -2494.3918457031, 1199.9107666016, 43.207420349121 ) end end addCommandHandler( "open", openGate )
  8. Robert333

    Cancel button

    Thats more clearly: function CreateLoginWindow() wdwLogin = guiCreateWindow( 226, 146, 372, 233, "[Admin Login System]", false ) guiSetVisible( wdwLogin, false ) guiWindowSetMovable( wdwLogin, false ) guiWindowSetSizable( wdwLogin, false ) tabpanel = guiCreateTabPanel( 0.0242, 0.0858, 0.9489, 0.8755, true, wdwLogin ) tab1 = guiCreateTab( "Login", tabpanel ) login = guiCreateButton( 0.1000, 0.8611, 0.2436, 0.1167, "Login", true, tab1 ) username = guiCreateLabel( 0.0113, 0.1167, 0.3768, 0.15, "UserName:", true,tab1 ) guiSetFont(username,"default-bold-small") password = guiCreateLabel( 0.0113, 0.2889, 0.3768, 0.15, "Password:", true, tab1 ) guiSetFont( password, "default-bold-small" ) username = guiCreateEdit( 0.2266, 0.1, 0.3598, 0.1389, localPlayerName, true, tab1 ) password = guiCreateEdit( 0.2266, 0.2611, 0.3598, 0.1389,"", true, tab1 ) Cancel = guiCreateButton( 0.4, 0.85, 0.20, 0.15, "Cancel", true, tab1 ) -- you wrote "Canel" guiEditSetMasked( password, true ) tab2 = guiCreateTab( "Info", tabpanel ) addEventHandler( "onClientGUIClick", Cancel, CloseLoginWindow, false ) -- You must add the EventHandler in function, because before the button-element is nil -- call a new function for closing Window, but first you need a function to show the window, because of "guiSetVisible( wdwLogin, false )" in the top of this function end function openLoginWindow() -- call it when it should open, maybe with the Event "onClientResourceStart" guiSetVisible( wdwLogin, true ) showCursor( true ) -- You need this for clicking the Button end function closeLoginWindow() guiSetVisible( wdwLogin, false ) showCursor( false ) end You don't need to do this functions: Because that Arguments are the defaults of Labels I mean. // edit: I was too slow
  9. Robert333

    Cancel button

    Thats more clearly: function CreateLoginWindow() wdwLogin = guiCreateWindow( 226, 146, 372, 233, "[Admin Login System]", false ) guiSetVisible( wdwLogin, false ) guiWindowSetMovable( wdwLogin, false ) guiWindowSetSizable( wdwLogin, false ) tabpanel = guiCreateTabPanel( 0.0242, 0.0858, 0.9489, 0.8755, true, wdwLogin ) tab1 = guiCreateTab( "Login", tabpanel ) login = guiCreateButton( 0.1000, 0.8611, 0.2436, 0.1167, "Login", true, tab1 ) username = guiCreateLabel( 0.0113, 0.1167, 0.3768, 0.15, "UserName:", true,tab1 ) guiSetFont(username,"default-bold-small") password = guiCreateLabel( 0.0113, 0.2889, 0.3768, 0.15, "Password:", true, tab1 ) guiSetFont( password, "default-bold-small" ) username = guiCreateEdit( 0.2266, 0.1, 0.3598, 0.1389, localPlayerName, true, tab1 ) password = guiCreateEdit( 0.2266, 0.2611, 0.3598, 0.1389,"", true, tab1 ) Cancel = guiCreateButton( 0.4, 0.85, 0.20, 0.15, "Cancel", true, tab1 ) -- you wrote "Canel" guiEditSetMasked( password, true ) tab2 = guiCreateTab( "Info", tabpanel ) addEventHandler( "onClientGUIClick", Cancel, CloseLoginWindow, false ) -- You must add the EventHandler in function, because before the button-element is nil -- call a new function for closing Window, but first you need a function to show the window, because of "guiSetVisible( wdwLogin, false )" in the top of this function end function openLoginWindow() -- call it when it should open, maybe with the Event "onClientResourceStart" guiSetVisible( wdwLogin, true ) showCursor( true ) -- You need this for clicking the Button end function closeLoginWindow() guiSetVisible( wdwLogin, false ) showCursor( false ) end You don't need to do this functions: Because that Arguments are the defaults of Labels I mean. // edit: I was too slow
  10. I didn't want to know how I script, maybe I asked a little bit complicated. I want help with the structure. Perhaps a example helps: function ***() blabla() if blabla then getblabla(bla,bla) end end or -- Function: *** -- function ***( ) blabla( ) -- do blabla if blabla then -- do something when blabla true getblabla ( bla, bla ) -- get blabla from blabla end -- end if end -- end function or function ***() blabla() if blabla then getblabla(bla,bla) end end and the structure of a resource: meta.xml client/client.lua server/server.lua or meta.xml client/gui/menu/menu.lua .../script/world/world.lua .../.../player/player.lua server/script/vehicle/vehicle.lua ... Maybe now it's clear. I want to know some hints which make the script better looking and easier to wrote long scripts. I have a script and it works fine but I still script a new script, because I don't like how my script look. But thanks for answer varez, robhol ------------ Yeah, but you have for example a structure how your resource/script is looking, but I understand your point, maybe I find a solution. Thanks for reply
  11. I didn't want to know how I script, maybe I asked a little bit complicated. I want help with the structure. Perhaps a example helps: function ***() blabla() if blabla then getblabla(bla,bla) end end or -- Function: *** -- function ***( ) blabla( ) -- do blabla if blabla then -- do something when blabla true getblabla ( bla, bla ) -- get blabla from blabla end -- end if end -- end function or function ***() blabla() if blabla then getblabla(bla,bla) end end and the structure of a resource: meta.xml client/client.lua server/server.lua or meta.xml client/gui/menu/menu.lua .../script/world/world.lua .../.../player/player.lua server/script/vehicle/vehicle.lua ... Maybe now it's clear. I want to know some hints which make the script better looking and easier to wrote long scripts. I have a script and it works fine but I still script a new script, because I don't like how my script look. But thanks for answer varez, robhol ------------ Yeah, but you have for example a structure how your resource/script is looking, but I understand your point, maybe I find a solution. Thanks for reply
  12. I mostly no newbie today in scripting LUA, but in last time I always fail at the structure and management of my script/resource. In the last weeks I wrote and I will do in future a gamemode. But now the script is long and unclearly. I tried to clean the code with the "--" Tag and wrote above all functions a header, but it was just unclearly too. Then I have split my "script_server.lua" and "script_client.lua" in many different LUA-Files, but that isn't a solution too. Maybe someone can help and write down his structure of resources. Another problem is in the script. For example should I use "setElementData" or a "table" to set data that isn't given in a MTA-Function. Or should I use one "function" which is called by one "EventHandler" and in the "function" I call another "functions" or should I use for each "function" an "EventHandler"? Hopefully you can help me because I wrote my script just more than ten times new. It's my most difficult problem in scripting. PS: I'm German, and not good in English .
  13. I mostly no newbie today in scripting LUA, but in last time I always fail at the structure and management of my script/resource. In the last weeks I wrote and I will do in future a gamemode. But now the script is long and unclearly. I tried to clean the code with the "--" Tag and wrote above all functions a header, but it was just unclearly too. Then I have split my "script_server.lua" and "script_client.lua" in many different LUA-Files, but that isn't a solution too. Maybe someone can help and write down his structure of resources. Another problem is in the script. For example should I use "setElementData" or a "table" to set data that isn't given in a MTA-Function. Or should I use one "function" which is called by one "EventHandler" and in the "function" I call another "functions" or should I use for each "function" an "EventHandler"? Hopefully you can help me because I wrote my script just more than ten times new. It's my most difficult problem in scripting. PS: I'm German, and not good in English .
  14. First, I'm german, so don't criticize my English. I've one Question: Where can I find the Events. The Functions I founded, they are on the right side, but where are the Events. Maybe I'm too stupid to find them, but maybe someone can help.
  15. Why Psychomania? Sure, there are already enough servers with different Games. Why not, we say! Certainly you are also irritated that your favorite Server is full or the players are unfriendly. Now is finished with it. Psychomania offers all your favorite Games of other Servers, e.g.: Freeroam GUI, Race, FalloutV2, Assault, Stealth, Classic Deathmatch, Team Deathmatch, and more These Games are supported by excellent Scripts which still improve in appearance of the stay on the server: like Superweapons, Paintball, Headshot, Glue, Wantedlevel, Interior, Airbrake, and more And because you maybe often don't like the current Gamemode, we also offer the Votemanager with which you can vote which Game should be begun. Forget full Servers with unfriendly players. By the engagement of the project manager Psyblader we are almost always accessible to you now on a well-arranged connection. Go even today on or now and enjoy the world of San Andreas with great Games. In the Forum you are always welcome and numerous Admins stand to you aside. I hope we see you on the server. See you later, your team of Psychomania © Psychomania