Jump to content

FatalTerror

Members
  • Posts

    304
  • Joined

  • Last visited

Everything posted by FatalTerror

  1. function ViewGUI () --This is the line i get error on. if ( guiGetVisible ( window ) == true ) then showCursor(false) guiSetVisible(window,false) elseif ( guiGetVisible ( window ) == false ) then showCursor(true) guiSetVisible(window,true) end end function binds () bindKey ( "F1", "down", ViewGUI ) end addCommandHandler ( "bindme", binds )
  2. 2s in the wiki... you find that: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() local xml = xmlLoadFile("welcome.xml") -- open the XML file local messageNodes = xmlNodeGetChildren(xml) -- get all child nodes of the root node () g_WelcomeMessages = {} -- create a new global variable to store the welcome messages for i,node in ipairs(messageNodes) do -- loop over all the message nodes g_WelcomeMessages[i] = xmlNodeGetValue(node) -- retrieve the text in each node end xmlUnloadFile(xml) -- close the XML file end ) addEventHandler("onPlayerJoin", getRootElement(), function() local numMessages = #g_WelcomeMessages -- get the number of messages local message = g_WelcomeMessages[math.random(numMessages)] -- pick a random message outputChatBox(message, source, 0, 255, 0) -- display it to the joining player end Result: <messages> <message>Welcome to the deathmatch server, enjoy your stay.</message> <message>Welcome. Be sure to get your free pizza at Matt's!</message> <message>Party going on at the LS beach, be there</message> </messages>
  3. Please, explain me why you use that: local isMessageEnabled,st = get( getResourceName( getThisResource( ) ).. '.enabledjoinmessage' ) I don't understand why you must the name of the resource
  4. Hm yes it's possible. But it will be plain text You can do it using the PHP function file_get_contents Look this example i made: <?php // PHP File $content = file_get_contents('mypage.php'); if(isset($content)){ echo html2text($content); } else{ echo "No content "; } function html2text($html) { $tags = array ( 0 => '~<h[123][^>]+>~si', 1 => '~<h[456][^>]+>~si', 2 => '~<table[^>]+>~si', 3 => '~<tr[^>]+>~si', 4 => '~<li[^>]+>~si', 5 => '~<br[^>]+>~si', 6 => '~<p[^>]+>~si', 7 => '~<div[^>]+>~si', ); $html = preg_replace($tags,"\n",$html); $html = preg_replace('~</t(d|h)>\s*<t(d|h)[^>]+>~si',' - ',$html); $html = preg_replace('~<[^>]+>~s','',$html); // reducing spaces $html = preg_replace('~ +~s',' ',$html); $html = preg_replace('~^\s+~m','',$html); $html = preg_replace('~\s+$~m','',$html); // reducing newlines $html = preg_replace('~\n+~s',"\n",$html); return $html; } ?> It work perfectly...
  5. callRemote + setTimer = Suicide If you want get a text from your website, try something like that Client-side: thememo = guiCreateMemo(0.5,0.5,1,1, "", false) addEvent("WriteOnTheMemo", true) addEventHandler("WriteOnTheMemo", getRootElement(), function(text) if text then guiSetText(thememo, tostring(text)) end end) Server side: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() setTimer(getWebsite, 10000, 0) end) function result(content) if content then triggerClientEvent("WriteOnTheMemo", getRootElement(), content) end end function getWebsite() local tralala = 1 callRemote("http://www.yourwebsite.com/file.php", result, tralala) end <?php include("mtalibrary.php"); $input = mta::getInput(); $tralala = $input[0]; if($tralala == 1){ // You get your informations about your website etc // and you return the content $content = "My website !"; mta::doReturn($content); } ?>
  6. FatalTerror

    Help ..

    That is server side
  7. Like that ? function vehFix(thePlayer) if thePlayer then theVehicle = getPedOccupiedVehicle(thePlayer) if theVehicle then local domage = getElementHealth ( theVehicle ) if domage < 100 then fixVehicle(theVehicle) end end end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() for i, player in ipairs(getElementsByType("player"))do setTimer(vehFix, 1000, 0, player) end end)
  8. function moveThePlayer(source) local playerexp = getElementData(source, "Exp") if not playerexp then setElementData(source, "Exp", 0) end if (playerexp) <= 500 then setElementData(source, "JOB", "POLICININKAS") setElementModel(source, 280) outputChatBox ( "Sveikiname jus nuo siol esate pareigunas. Dirbkite atsakingai!", source ) else outputChatBox ( "Jus neturite pakankamai patirties!", source ) end end -- define our custom event, and allow it to be triggered from the client ('true') addEvent("giveJob",true) -- add an event handler so that when movePlayerToPosition is triggered, the function moveThePlayer is called addEventHandler("giveJob",root,moveThePlayer) You have forget the second argument in getElementData
  9. FatalTerror

    Help ..

    Your friend send you a client files of FFS scripts and you want to us make the server side for you. Correctly ? It's a joke ? addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(), function(number, sort, model) if (sort == "vehiclechange") and (model == 425)then triggerClientEvent("onHunterEvent", getRootElement()) end end)
  10. https://wiki.multitheftauto.com/wiki/SetCloudsEnabled
  11. It's on race_client.lua For the time played, it's on the line 25: timepassed = dxText:create('0:00:00', screenWidth - 10, screenHeight - 25, false, 'bankgothic', 0.7, 'right'), function updateTime() local tick = getTickCount() local msPassed = tick - g_StartTick if not isPlayerFinished(g_Me) then g_dxGUI.timepassed:text(msToTimeStr(msPassed)) end local timeLeft = g_Duration - msPassed guiSetText(g_GUI.timeleft, msToTimeStr(timeLeft > 0 and timeLeft or 0)) if g_HurryDuration and g_GUI.hurry == nil and timeLeft <= g_HurryDuration then startHurry() end end And for the timeleft, its on the line 34: timeleft = guiCreateLabel(screenWidth/2-108/2, 19, 108, 30, '', false), function updateTime() local tick = getTickCount() local msPassed = tick - g_StartTick if not isPlayerFinished(g_Me) then g_dxGUI.timepassed:text(msToTimeStr(msPassed)) end local timeLeft = g_Duration - msPassed guiSetText(g_GUI.timeleft, msToTimeStr(timeLeft > 0 and timeLeft or 0)) if g_HurryDuration and g_GUI.hurry == nil and timeLeft <= g_HurryDuration then startHurry() end end You have just to change the positions, size, etc. Good luck Edit: Topic edited
  12. When the game is finish, you compare the best score of the player. If you don't know the SQL, learn it or use another system (XML, ...) We don't want make everything for you. Good luck, FatalTerror
  13. addEventHandler("onClientPlayerWasted", getRootElement(), function() if ( isPlayerDead ( getLocalPlayer() ) ) then GUIEditor_Memo[1] = guiCreateMemo(10,39,269,31,"You were killed by:"..killer.."",true,menu) guiSetVisible ( menu, true ) showCursor ( true ) end end)
  14. if not tonumber(x) then -- error: x is not a number Source: http://www.lua.org/pil/8.3.html
  15. Oh yes.. I forgot that people can edit the script if isn't compiled for make a flood
  16. Hm try to use "127.0.0.1" not "localhost" i think
  17. I think he create a new event when the sound is stopped, and if it's stopped he set another song
  18. I must wait how long to have an anwser ? ^^' ( Benxamix2 : Thanks for the english lesson )
  19. dxDrawImage(drawX-1, drawY-1, width+2, height+2, tostring(":race/img/rank"..rank..".png" )) I think it's that and... triggerServerEvent return only a bool value
  20. Men the trigger don't return string or int value
×
×
  • Create New...