Jump to content

Remp

Members
  • Posts

    210
  • Joined

  • Last visited

Everything posted by Remp

  1. First, you spelt button wrong: ... if [b]buttom[/b] == 'left' and state == 'up' then ... If you look at the wiki page for triggerServerEvent you will see the first argument is supposed to be a string with the name of a function, not a function itself Your onClientGUIClick event handles for your buttons should be inside your createTeamWindow function. Any code outside a function is run as soon as the resource starts, meaning at the moment you are trying to add event handlers to buttons that don't actually exist (yet) You are checking for a 'spawnButtonBloods', which doesnt exist: ... elseif source == spawnButtonBloods then ... You will want to use fadeCamera on the player when they spawn or their screen will be black All of these things can be found in a matter of minutes with some simple debugging After fixing the first one the others would show up in debugscript as errors which makes it even easier Formatting your code properly also makes it much easier to see whats going on and where the problems are: ... function movePlayer(button,state) if button == 'left' and state == 'up' then if source == teamButtonCrips then triggerServerEvent('movePlayer', getLocalPlayer(), 2642.4440917969, -2004.3111572266, 13.5546875, 0, 106, 0, 0) outputChatBox('If you Crip throw it up!') ...
  2. http://remp.sparksptpm.co.uk/mta/GUIEditor.zip
  3. there's definitely nothing wrong with both markers having interior 0, there are lots of teleports in the interiors resource where both have interior 0 already the markers you posted work fine for me using the latest interiors resource from the resources repository (http://code.google.com/p/mtasa-resources/downloads/list)
  4. your /(o)oc and /b commands are missing the '..' after message: outputChatBox( "(( [GLOBAL OOC]"..playerNameIs..": "..message" ))" ) should be: outputChatBox( "(( [GLOBAL OOC]"..playerNameIs..": "..message.." ))" ) you are right, /me should be done using onPlayerChat rather than adding your own command handler: addEventHandler("onPlayerChat",root, function(message,messageType) if messageType == 1 then cancelEvent() -- output your message here end end )
  5. if mysql_num_rows(query) is 0 then there is something wrong with your query id guess there is no character with that name (even if your table had no other data it should still return 1 row with the charName in) are you sure 'theUser' is a player? if it is, try using an sql viewer to look at the database
  6. are you on windows? try '\r\n'
  7. i mean to output the exact value, not just see if it equals something: local query = mysql_query( connect_mysql, "SELECT * FROM `players` WHERE charName='" .. getPlayerName( theUser ) .. "'" ) outputDebugString("Result: "..tostring(mysql_num_rows(query))) if mysql_num_rows(query) > 2 then ...
  8. try outputting tostring(mysql_num_rows(query)) to see what it is
  9. what do you debug outputs tell you? where is it having trouble? post your new code and what it outputs when you run it
  10. use player in TalkMe and TalkDo, but use source in sendMessageToNearbyPlayers you might also want to look at server example 4 here: https://wiki.multitheftauto.com/wiki/AddCommandHandler to see how you can get all the text input in the command, rather than only the first word
  11. your query isn't going to be returning a plain integer, so you cant just compare it with 2 you probably want to use this to count the rows first: https://wiki.multitheftauto.com/wiki/Modules/MTA- ... l_num_rows local query = mysql_query( connect_mysql, "SELECT * FROM `players` WHERE charName='" .. getPlayerName( theUser ) .. "'" ) if mysql_num_rows(query) > 2 then ... i would also suggest you make playerState local, it wont cause any real problems being global but it isnt very neat
  12. you are still using 'source' in your commands, there is no source in command handlers use 'player' instead
  13. there are lots of syntax errors in the code, i imagine your marker isnt being created because your script isnt actually loading (its just erroring) if you indent your code its much easier to see the problems: door = createMarker (-699,973,12, "cylinder", 3,255, 0, 0) function fun(hitElement) if getElementType(hitElement)="player" then -- "=" is used to assign values, you should be using "==" to compare values name = getPlayerName(hitElement) if isObjectInACLGroup("user.". .name, aclGetGroup ("Admin"))then -- there should not be a space between the 2 full stops setElementPosition(,x,y,z) -- you are not giving an element argument here (and as you said, x,y,z dont exist) elseif -- 'elseif' is used when you want to do another comparison, use 'else' when you want to just default outputChatBox(hitElement, ":O, this is for Admins only") -- the text should be the first argument, not the second end end end addEventHandler("onMarkerHit", door,fun) Most of these could be fixed with a quick look at the wiki page for each function (or in some cases a quick google for the lua syntax) Fix the errors i pointed out and see how it goes then
  14. there is no other way to do it. you trigger the client, run a clientside function then trigger the server with the result my advice would be dont bother. nothing of any consequence should ever go into the clientside files anyway, gui designs are dime a dozen and i dont think them being stolen is justification for this much work. if you are really worried you could try compiling or obfuscating your scripts, it wont stop anyone determined enough but most people will leave it alone you could also try something like this which would essentially send your whole clientside script as a string through an event then load it on the other side, so it exists only in memory. its not a particularly elegant solution but for smaller scripts its probably ok
  15. use guiSetProperty to set "MousePassThroughEnabled" to "true" on the images this will make your mouse clicks simply pass through the image and onto the button instead
  16. keep in mind compiled scripts can be decompiled just as easily, there is no way to completely safeguard any client side files
  17. string.sub splits a string at a given position ( http://lua-users.org/wiki/StringLibraryTutorial ), to gather all input from a command you will need to use '...' ( check server example 4 here ) but again, you dont need to create your own function to handle this: addEventHandler("onPlayerChat", getRootElement(), function (message, messageType) outputChatBox(message) if messageType == 1 then cancelEvent() outputRadiusChat(source, "* "..getPlayerName(source).." "..message, 20.0, 188, 94, 255, false) end end )
  18. the second argument of triggerEvent is the element to trigger on (the element that will be source in any functions attached to it) the first argument in your commandMe function will be '/me', not the player this strikes me as quite an odd way to do it though, why not call the function directly rather than using an event? or simply even add your commandMe code into your onPlayerChat handle. there is no need to add your own /me command handler
  19. Remp

    Disabling /me

    should be able to just cancel onPlayerChat when /me is used and output your own
  20. try and be more informative with your descriptions, if there isn't an obvious problem its much harder for people to help you when they don't know how its not working all arguments passed from a command will be strings, so you need to use tonumber() on 'amount' before you can use it as a number the elseif statement is one word, 'elseif' not 'else if' thePlayer (first argument passed from a command) is the player that typed the command, so currently your code creates /give and gives money to whoever typed it, not a player that they specify function GivePlayerMoney(thePlayer, command, targetName, amount) -- if they didnt specify a target or an amount then return if not targetName or not amount then return end -- get the player from the name they input local target = getPlayerFromName(targetName) -- convert amount to a number amount = tonumber(amount) -- if the player exists if target then -- if the amount is a number if amount then if (amount <= 500) then givePlayerMoney(target, amount) elseif (amount > 500) then outputChatBox("Invalid amount. (Amount is greater than $500)",thePlayer) end else outputChatBox("Please specify an amount.",thePlayer) end else outputChatBox("Please specify a valid player name.",thePlayer) end end addCommandHandler("givecash", GivePlayerMoney)
  21. resourceRoot is defined by mta and exists in every resource (as the root element of that resource)
  22. you need to decide which edges of the screen you want to have them positioned against (looking at the screenshot, probably bottom/right) then you just need to find the difference between your screen size and your position values for example, for your ammo line: dxDrawText(tostring (showammo2),684.0,731.0,732.0,766.0,tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) --Total Ammo we subtract each of your position values from your screen size (remembering your resolution is 1024x768): left position value is 684, 1024-684 = 340 top position value is 731, 768-731 = 37 right position values is 732, 1024-732 = 292 bottom position value is 766, 768-766 = 2 which then gives us: dxDrawText(tostring (showammo2),sWidth-340, sHeight-37, sWidth-292, sHeight-2, tocolor(0,255,255,175),1.0,"bankgothic","left","top",false,false,false) --Total Ammo this clamps the dx to the same position (relative to the edges of the screen) on every resolution repeat this process for all your dx items (rectangles will be easier because you only need to do the first 2 values)
  23. It wont create a scrollbar unless you create something on it beyond its original size (remember that scrollpanes arent limited to 0-1 (relative) like other elements) so if you simply added a fifth image on it at 1.1 y (beyond 1, so beyond the height you originally specified) it will expand and add a vertical scrollbar: SoDScrollPane = guiCreateScrollPane( 0.1, 0.1, 0.5, 0.9, true, tabTrophySOD ) guiCreateStaticImage( 0.03, 0.3, 0.25, 0.25, "img/trophy.png", true, SoDScrollPane ) guiCreateStaticImage( 0.03, 0.5, 0.25, 0.25, "img/trophy.png", true, SoDScrollPane ) guiCreateStaticImage( 0.03, 0.7, 0.25, 0.25, "img/trophy.png", true, SoDScrollPane ) guiCreateStaticImage( 0.03, 0.9, 0.25, 0.25, "img/trophy.png", true, SoDScrollPane ) guiCreateStaticImage( 0.03, 1.1, 0.25, 0.25, "img/trophy.png", true, SoDScrollPane )
  24. integration how? outputting textlib styled code? might be nice if textlib was expanded to include some more dx items as well
  25. use absolute values, relative will always be a percentage of the parent size (so in this case, a percentage of the screen size) absolute will be the same pixel size across all resolutions
×
×
  • Create New...