Jump to content

Saml1er

Retired Staff
  • Posts

    1,058
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Saml1er

  1. Saml1er

    Will pay

    You mean voting for maps and other features like that?
  2. Saml1er

    Will pay

    What kind of panel? Since my exams are over, I can script it for you if you're really ready to pay.
  3. Server side: local Map_Data = { } local MapName = "Your Map Name" local me_load = xmlLoadFile ( ":" . . MapName . ."/meta.xml" ) local m_map = xmlFindChild ( m_load ,"map", 0 ) local m_mData = xmlNodeGetAttributes( m_map ) if m_Data then local ma_load = xmlLoadFile(":" . . MapName . . "/" . . m_mData["src"] ) for k, v in ipairs ( xmlNodeGetChildren( ma_load ) ) do -- Now loop and doop --- ....... Some code --- For Creating objects Map_Data [ #Map_Data + 1] = { "object",model, x, y, z, px,py,pz, LOD } -- that "object" is just to specify that its an object when you loop in i,v pairs then use ------ if v[1] == "object" then -- CREATE THE OBJECT IN CLIENT SIDE NOW end end For creating objects in another dimension then: Client side: -- Client side is better, you can send tables from server side for the the players in team local m_Objects = { } _createObject = createObject function createObject (model, x, y, z, px,py,pz, opt) local px = px or 0 local py = py or 0 local pz = pz or 0 local opt = opt or false local m_Cobject = _createObject(model, x, y, z, px,py,pz,opt) if m_Cobject then table.insert { m_Objects, m_Cobject } -- insert into a table so you can destroy it with loop when you want to stop the map return m_Cobject end end local Map_Elements = { } --------------------------------- when creating the objects in client side then for _,v in pairs ( Map_Data ) do if v[1] == "object" then local elem = _createObject (v[2], v[3],v[4],v[5],v[6],v[7],v[8],v[9]) -- replace the coordinates with the map coordinates Map_Elements [ #Map_Elements + 1 ] = elem -- insert it into table so you can remove it with a loop later end end ------------------------- when removing them function RemoveElems () for k,v in pairs ( Map_Elements ) do if isElement (v) then destroyElement (v) else v = nil end end Map_Elements = { } end P.S I was first creating all objects in server side but after talking with Gallardo I decided to make them in client side because he advised me to keep the server side free and I know that its really complicated stuff but if you try to work on it then you'll understand how everything works
  4. I'd like to share my another piece of code with you because you might have problems later on: If you want to wrap all players into vehicles when you create objects and shits then: local spawner = { } -- Insert all your vehicles into this table function WarpAllPedIntoVehNpickup( theTeam ) for i, v in pairs( getPlayersInTeam (getTeamFromName (theTeam) )) do setElementDimension ( v, 1 ) -- replace it with what ever you want local carR = spawner[ math.random( 1,#spawner) ] setElementAlpha ( carR, 255 ) local ab = warpPedIntoVehicle ( v, carR ) if ab then table.remove ( spawner, carR) -- remove it so people don't spawn in the same vehicle but the function will be still running end end return true end WarpAllPedIntoVehNpickup ( "team" )
  5. Why don't you do it with teams? Its more efficient. If you want to know the total players in your server then obviously use: getElementsByType("player") If you want to check how many players are in a arena then: local pTcount = getPlayersInTeam ( getTeamFromName("TEAM NAME") ) if #pTcount == NUMBER then -- some code end In case you want to start a another map for a specified arena. addEventHandler("onPlayerWasted", getRootElement(), function () local pTname = getTeamName ( getPlayerTeam(source) ) local pTcount = getPlayersInTeam ( pTname ) if #pTcount > 0 then -- free camera elseif #pTcount == 0 then -- start another map end end )
  6. Saml1er

    Gang add

    It works. Use [ code = lua ] -- there should be no spaces [ / code ]
  7. Saml1er

    Stat ids

    Weapon Id: 32 http://wiki.sa-mp.com/wiki/Weapons skills: https://wiki.multitheftauto.com/wiki/We ... ill_levels TEC9 0 0 1 50 2 999
  8. Bonsai is my friend and he is an amazing person. I'll suggest you to go with him, good luck.
  9. local oldValue = tonumber (getElementData(thePlayer, "Thingy") ) if type (oldValue) == "number" then setElementData(thePlayer, "Thingy", oldValue + 1 ) end
  10. Saml1er

    help

    this is the error crashes [2014-04-12 18:23:44] ERROR: Client ([bP]1) triggered serverside event requestServicesColShapes, but event is not added serverside [2014-04-12 18:23:44] ERROR: Client ([bP]1) triggered serverside event requestServicesInteriorMarkers, but event is not added serverside [2014-04-12 18:23:44] ERROR: Client ([bP]1) triggered serverside event requestServicesShopMarkers, but event is not added serverside Post the code not the errors because I already saw them.
  11. addEventHandler("onPlayerJoin",root function () end -- This end is for the function ) And there is no other difference.
  12. Remove this line: if source == CriminalGetJob then source is already defined and use outputDebugScript after every line so you can know where the problem is.
  13. dxDrawText will work only for your resolution because you didn't use getGuiScreenSize(). Quoting one of my post.
  14. Saml1er

    help

    Just post the code and I'll help you. Too lazy to download it.
  15. Yes, just like weii said the interior id is incorrect. There are only 1-18 interiors.
  16. I'm not familiar with sizes as well. I got some free time yesterday and decided to make some tests with getCursorPosition() and I found out that its really amazing for sizes. If you want to display your text on the center then: ( This will work on all resolutions ) local sx,sy = guiGetScreenSize() function drawIt () dxDrawText("LOL",sx/2,sy/2, sx/2, sy/2,tocolor(0,255,255,255),0.8,"bankgothic","center","center",false,false,false end addEventHandler("onClientResourceStart", resourceRoot, function () addEventHandler("onClientRender", root, drawIt) end ) Now may god bless you. If you want them at top right or where ever you want on the screen we'll use getCursorPosition() to get the X and Y coordinates to make it fit on all resolutions. _____________________________________________________________________________________________________________ Use the following code to get the X and Y sizes where you want to display your text. addCommandHandler("sh", function () if not showed then showCursor (true) showed = true else showCursor (false) showed = nil end end) addCommandHandler("cu", function () if isCursorShowing() then outputChatBox ("a") local ScreX, ScreY, _, _,_ = getCursorPosition() outputChatBox("SizeX: "..ScreX.." |||| SizeY: "..ScreY ) end end ) Step #1: Use the code I posted. Now execute the command /sh to toggle the cursor ( you must execute this command or else getCursorPosition() won't work. Step #2: Once you execute /sh then place your cursor on the position where you want to display the text and then type /cu and it will output the Screen X and Y in chatbox. Step #3: Now copy the SizeX and SizeY from the chatbox and we'll make a use of it local sx,sy = guiGetScreenSize() local SizeX, SizeY = X,Y --- Replace it with the Size X and Y you got from the chatbox ( with the help of getCursorPosition () function drawIt () dxDrawText("LOL",(SizeX)*sx,( SizeY )*sy, ( SizeX )*sx, ( SizeY )*sy,tocolor(0,255,255,255),0.8,"bankgothic","center","center",false,false,false) end addEventHandler("onClientResourceStart", resourceRoot, function () addEventHandler("onClientRender", root, drawIt) end )
  17. Read your code again. outputChatBox ( "", i) -- Do you see it now? the "i" is in the second arg which is totally wrong. _____________________________________________________________________________________________________________ for i=1, 10 do outputChatBox(i, getRootElement()) end And yes this will work ofc, I never said anything about this.
  18. function LoadMyFile () local pxml = xmlLoadFile(":"..getResourceName(v).."/".."meta.xml") if pxml local Xnode = xmlNodeGetChildren(pxml) for _,v in ipairs(Xnode) do if xmlNodeGetName(v) == "script" and xmlNodeGetAttribute(v, "src") == "common_messages.lua" then Exist_check = true else Exist_check = nil end end if not Exist_check then -- make sure it doesn't exist local Snode = xmlCreateChild(pxml, "script") xmlNodeSetAttribute(Snode, "src", "common_messages.lua") xmlNodeSetAttribute(Snode, "type", "server") xmlSaveFile(pxml) end xmlUnloadFile(pxml) end LoadMyFile () -- Call the function
  19. Saml1er

    Money hack

    That's impossible if the script is server side. Check your server settings and make sure anti-cheat is enabled.
  20. That won't work, its like. outputChatBox("", 1) outputChatBox("", 2) outputChatBox("", 3) ............ ......
  21. Saml1er

    SQL problem

    Wow thats something really useful.
  22. if xmlLoadFile doesn't return false ! I misread it. I thought you said xmlUnloadFile but do you really think that it will be 100 % successful in this way? XML functions are laggy when you loop through huge data like in map files and when you loop through its children and getAttributes then you'll understand why I chose to unload it at the end. I don't have any reason to argue with you if you don't like my idea then just ignore it.
  23. You know you just introduced a bug into this script ??? The version I did was already unloading it after all xml functions ... By doing it in your way, if xmlLoadFile returns false for some reason, you will still try to unload that file: xmlUnloadFile( false ) So it will throw an error like this: Bad argument @xmlUnloadFile [Expected element, got boolean] or something similar to this. I tested it and it works.
  24. Go to your server and login and type /debugscript 3 Please tell us what does it output.
  25. Saml1er

    Ignore

    function getPlayerFromNamePart(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end addCommandHandler ( "ignore", function ( player, cmd, nick ) if ( tostring ( nick ) ) then local ignored = getPlayerFromNamePart(nick ) if ( isElement ( ignored ) and getElementType ( ignored ) == "player" ) then local ignorowani = getElementData ( player, "ignorowani" ) if ( ignorowani [ ignored ] ) then ignorowani [ ignored ] = nil outputChatBox ( "unignored", player, 255, 255, 255, true ) else ignorowani [ ignored ] = true outputChatBox ( "ignored", player, 255, 255, 255, true ) end setElementData ( player, "ignorowani", ignorowani ) else outputChatBox ( "no player", player, 255, 0, 0, true ) end else outputChatBox ( "no nick", player, 255, 0, 0, true ) end end ) Idk how does your system works but anyway you'll need to use https://wiki.multitheftauto.com/wiki/Ge ... omNamePart . EDIT: Seems I'm a little late.
×
×
  • Create New...