Jump to content

montel

Members
  • Posts

    18
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

montel's Achievements

Square

Square (6/54)

0

Reputation

  1. i dont know too much about this coding.Can u help me
  2. using exp_system 'https://community.multitheftauto.com/index.php?p=resources&s=details&id=1253' I need lvl 5 = Enter Car, lvl 6 = Enter Aircraft ,lvl 7 = Use M4 ,lvl 8 = Use Sniper Help pls
  3. montel

    Skin Problem

    Old skin should spawn
  4. montel

    Skin Problem

    previous one to add skin problem. Position = { [1] = {2068.3000488281,2369.1999511719,10.800000190735}, [2] = {2071.5,2369.1999511719,10.800000190735}, [3] = {2074.6999511719,2369.3000488281,10.800000190735} } addEventHandler("onPlayerWasted", root, function() spawn() --timer pls end ) function spawn() local x,y,z = unpack(Position[math.random(#Position)]) spawnPlayer ( source, x,y,z) setCameraTarget(source, source) setElementModel(player,getElementModel(player)) --maybe problem ? end
  5. <?php class mta { private $useCurl = false; private $sockTimeout = 6; // seconds public $http_username = ''; public $http_password = ''; public $host = ''; public $port = ''; private $resources = array(); public function __construct( $host, $port, $username = "", $pass = "" ) { $this->host = $host; $this->port = $port; $this->http_username = $username; $this->http_password = $pass; } public function getResource ( $resourceName ) { foreach ( $this->resources as $resource ) { if ( $resource->getName == $resourceName ) return $resource; } $res = new Resource ( $resourceName, $this ); $this->resources[] = $res; return $res; } public static function getInput() { $out = mta::convertToObjects( json_decode( file_get_contents('php://input'), true ) ); return (is_array($out)) ? $out : false; } public static function doReturn() { $val = array(); for ( $i = 0; $i < func_num_args(); $i++ ) { $val[$i] = func_get_arg($i); } $val = mta::convertFromObjects($val); $json_output = json_encode($val); echo $json_output; } public function callFunction( $resourceName, $function, $args ) { if ( $args != null ) { $args = mta::convertFromObjects($args); $json_output = json_encode($args); } else { $json_output = ""; } $path = "/" . $resourceName . "/call/" . $function; $result = $this->do_post_request( $this->host, $this->port, $path, $json_output ); echo $json_output; $out = mta::convertToObjects( json_decode( $result, true ) ); return (is_array($out)) ? $out : false; } public static function convertToObjects( $item ) { if ( is_array($item) ) { foreach ( $item as &$value ) { $value = mta::convertToObjects( $value ); } } else if ( is_string($item) ) { if ( substr( $item, 0, 3 ) == "^E^" ) { $item = new Element( substr( $item, 3 ) ); } elseif ( substr( $item, 0, 3 ) == "^R^" ) { $item = $this->getResource( substr( $item, 3 ) ); } } return $item; } public static function convertFromObjects( $item ) { if ( is_array($item) ) { foreach ( $item as &$value ) { $value = mta::convertFromObjects($value); } } elseif ( is_object($item) ) { if ( get_class($item) == "Element" || get_class($item) == "Resource" ) { $item = $item->toString(); } } return $item; } function do_post_request( $host, $port, $path, $json_data ) { if ( $this->useCurl ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, "http://{$host}:{$port}{$path}" ); curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $json_data ); $result = curl_exec($ch); curl_close($ch); return $result; } else { if ( !$fp = @fsockopen( $host, $port, $errno, $errstr, $this->sockTimeout ) ) { throw new Exception( "Could not connect to {$host}:{$port}" ); } $out = "POST {$path} HTTP/1.0\r\n"; $out .= "Host: {$host}:{$port}\r\n"; if ( $this->http_username && $this->http_password ) { $out .= "Authorization: Basic " . base64_encode( "{$this->http_username}:{$this->http_password}" ) . "\r\n"; } $out .= "Content-Length: " . strlen($json_data) . "\r\n"; $out .= "Content-Type: application/x-www-form-urlencoded\r\n\r\n"; //$out .= "Connection: close\r\n\r\n"; $out .= $json_data . "\r\n\r\n"; if ( !fputs( $fp, $out ) ) { throw new Exception( "Unable to send request to {$host}:{$port}" ); } @stream_set_timeout( $fp, $this->sockTimeout ); $status = @socket_get_status($fp); $response = ''; while ( !feof($fp) && !$status['timed_out'] ) { $response .= fgets( $fp, 128 ); $status = socket_get_status($fp); } fclose( $fp ); $tmp = explode( "\r\n\r\n", $response, 2 ); $headers = $tmp[0]; $response = trim($tmp[1]); preg_match( "/HTTP\/1.(?:0|1)\s*([0-9]{3})/", $headers, $matches ); $statusCode = intval($matches[1]); if ( $statusCode != 200 ) { switch( $statusCode ) { case 401: throw new Exception( "Access Denied. This server requires authentication. Please ensure that a valid username and password combination is provided." ); break; case 404: throw new Exception( "There was a problem with the request. Ensure that the resource exists and that the name is spelled correctly." ); break; } } if ( preg_match( "/^error/i", $response ) ) { throw new Exception( ucwords( preg_replace("/^error:?\s*/i", "", $response ) ) ); } return $response; } } } class Element { var $id; function Element($id) { $this->id = $id; } function toString() { return "^E^" . $this->id; } } class Resource { var $name; private $server; function Resource($name, $server) { $this->name = $name; $this->server = $server; } function toString() { return "^R^" . $this->name; } public function getName() { return $this->name; } function call ( $function ) { $val = array(); for ( $i = 1; $i < func_num_args(); $i++ ) { $val[$i-1] = func_get_arg($i); } return $this->server->callFunction ( $this->name, $function, $val ); } } ?> What's this? Can you give an example? public $http_username = ''; public $http_password = ''; public $host = ''; public $port = '';
  6. montel

    Help Key pad

    the problem is solved.Thx Waba
  7. montel

    Help Key pad

    Scripting the GUI - Tutorial 2 (Gates + Keypads) https://wiki.multitheftauto.com/wiki/Scripting_the_GUI_-_Tutorial_2#Opening_the_keypad Error: WARNING:Loading script failed:keypad/client.lua47: unexpected symbol near '...' Client-Side function createKeypad() -- get the screen width and height local sWidth, sHeight = guiGetScreenSize() -- create the window, using some maths to find the centre of the screen local Width,Height = 142,276 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) keypadWindow = guiCreateWindow(X,Y,Width,Height,"Keypad",false) -- don't allow people to resize the keypad guiWindowSetSizable(keypadWindow,false) -- create buttons labeled 0-9, "*", "#", "Enter" and "C" (clear) keypadButton1 = guiCreateButton(13,68,37,36,"1",false,keypadWindow) keypadButton2 = guiCreateButton(53,68,37,36,"2",false,keypadWindow) keypadButton3 = guiCreateButton(93,68,37,36,"3",false,keypadWindow) keypadButton4 = guiCreateButton(13,108,37,36,"4",false,keypadWindow) keypadButton5 = guiCreateButton(53,108,37,36,"5",false,keypadWindow) keypadButton6 = guiCreateButton(93,108,37,36,"6",false,keypadWindow) keypadButton7 = guiCreateButton(13,148,37,36,"7",false,keypadWindow) keypadButton8 = guiCreateButton(53,148,37,36,"8",false,keypadWindow) keypadButton9 = guiCreateButton(93,148,37,36,"9",false,keypadWindow) keypadButtonAsterix = guiCreateButton(13,188,37,36,"*",false,keypadWindow) keypadButton0 = guiCreateButton(53,188,37,36,"0",false,keypadWindow) keypadButtonHash = guiCreateButton(93,188,37,36,"#",false,keypadWindow) keypadButtonExit = guiCreateButton(13,228,37,36,"Exit",false,keypadWindow) keypadButtonEnter = guiCreateButton(53,228,37,36,"Enter",false,keypadWindow) keypadButtonClear = guiCreateButton(93,228,37,36,"Clear",false,keypadWindow) -- create a gridlist to act as a backdrop on the kaypad display keypadGridlistDisplay = guiCreateGridList(13,25,117,33,false,keypadWindow) guiGridListSetSelectionMode(keypadGridlistDisplay,2) guiSetAlpha(keypadGridlistDisplay,0.6) -- create a label so we can write text on the keypad display keypadLabelDisplay = guiCreateLabel(14,26,115,30,"Enter Keycode.",false,keypadWindow) guiLabelSetColor(keypadLabelDisplay,255,000,000) guiLabelSetVerticalAlign(keypadLabelDisplay,"center") guiLabelSetHorizontalAlign(keypadLabelDisplay,"center",false) guiSetVisible(keypadWindow,false) end -- create the GUI when the resource starts addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),createKeypad) addEventHandler("onKeypadButtonClicked",root,function() ... end) function updateDisplay(text) -- if we are passing some text if text then -- if its a digit or * or #, then append it to the end of the display if tonumber(text) or text == "*" or text == "#" then guiSetText(keypadLabelDisplay,guiGetText(keypadLabelDisplay) .. text) -- otherwise replace the display with the new text else guiSetText(keypadLabelDisplay,text) end -- if we pass nil, clear the display entirely else guiSetText(keypadLabelDisplay,"") end end addEventHandler("onClientGUIClick",keypadWindow,processKeypadClicks,true) function processKeypadClicks(button,state) if button == "left" and state == "up" then -- if the source of this event is a gui button if getElementType(source) == "gui-button" then -- trigger our custom event and send the keypad id of this keypad as an argument triggerEvent("onKeypadButtonClicked",source,getElementData(keypadWindow,"keypadID")) end end end addEvent("onKeypadButtonClicked",false) addEventHandler("onKeypadButtonClicked",root, function(keypadID) end ) addEvent("onKeypadButtonClicked",false) addEventHandler("onKeypadButtonClicked",root, function(keypadID) -- clear the display if this is the first time its being used if guiGetText(keypadLabelDisplay) == "Enter Keycode." or guiGetText(keypadLabelDisplay) == "Invalid Keycode." then updateDisplay() end -- if its the clear button if guiGetText(source) == "Clear" then -- clear the display updateDisplay() -- if its the enter button elseif guiGetText(source) == "Enter" then -- get the currently entered code from the display local code = guiGetText(keypadLabelDisplay) -- if they have entered a code if code then -- trigger the server so we can verify their code triggerServerEvent("verifyKeypadCode",getLocalPlayer(),code,keypadID) end -- if its the exit button elseif guiGetText(source) == "Exit" then -- hide the keypad and reset the display text ready for next time guiSetVisible(keypadWindow,false) updateDisplay("Enter Keycode.") showCursor(false,false) -- otherwise, it must be a character button else updateDisplay(guiGetText(source)) end end ) addEvent("onKeypadVerificationSuccessful",true) addEventHandler("onKeypadVerificationSuccessful",root, function() -- hide the keypad and reset the display text ready for next time guiSetVisible(keypadWindow,false) updateDisplay("Enter Keycode.") showCursor(false,false) end ) addEvent("onKeypadVerificationFailed",true) addEventHandler("onKeypadVerificationFailed",root, function() -- update the display text to show the code was invalid updateDisplay("Invalid Keycode.") end ) addCommandHandler("aç",function() guiSetVisible(keypadWindow,true) showCursor(true,true) setElementData(keypadWindow,"keypadID","a51MainGateKeypadCode") end) addEventHandler("onKeypadVerificationSuccessful",root, -- keypadID is sent back from the server function(keypadID) -- get the gate object (this is where the id="a51MainGateKeypadCode" tag in the map file becomes useful) local gate = getElementByID(keypadID) -- if we found the object if gate then -- get the new position (as we defined in the map file) local x = tonumber(getElementData(gate,"newPosX")) local y = tonumber(getElementData(gate,"newPosY")) local z = tonumber(getElementData(gate,"newPosZ")) -- move the gate moveObject(gate,1500,x,y,z) -- get the original position x = tonumber(getElementData(gate,"posX")) y = tonumber(getElementData(gate,"posY")) z = tonumber(getElementData(gate,"posZ")) -- set a timer to close the gate in 5 seconds setTimer(moveObject,5000,1,gate,1500,x,y,z) end end ) Server-Side local keypadCodes = { ["a51MainGateKeypadCode"] = "4455*#" } addEvent("verifyKeypadCode",true) addEventHandler("verifyKeypadCode",root,function(code,keypadID) if code then -- using the table we created earlier, check if the code supplied is the same as the code for this gate if code == keypadCodes[keypadID] then -- if it is, tell the client that it was successful triggerClientEvent(client,"onKeypadVerificationSuccessful",client,keypadID) else -- if it is not, tell the client that it was not successful triggerClientEvent(client,"onKeypadVerificationFailed",client,keypadID) end end end)
  8. Not working setObjectBreakable(3091,true)
  9. this object can't broke.Need help object = 1423
  10. montel

    Nick Problem

    when the players joined the game any function make choose nick of in the database or sample 100 nicks and i wanna make login id to nick name
  11. How to register logs from the xml when i was bought buy cars? Client maFen = nil local colorButton = {} local cColor = {} local colorButtonA = {} local colorEx = {} local player = getLocalPlayer() function guiStart (atList) if maFen == nil then local x, y = guiGetScreenSize() maFen = guiCreateWindow( x / 2 - 200, y / 2 - 175, 400, 350, "Vehicles Shop", false ) guiSetText ( maFen, "Araç Dükkanı") maTab = guiCreateTabPanel( 180, 30, 230, 100, false, maFen ) carPic = guiCreateStaticImage( 5, 5, 200, 85, "Png\\rien.png", false, maTab ) local cBNum = 0 local cBx = 0.46 while cBNum ~= 4 do cBNum = cBNum + 1 colorButtonA[cBNum] = guiCreateButton ( cBx, 0.39, 0.10, 0.06, "Renk"..cBNum.."", true , maFen ) cBx = cBx + 0.13 end guiWindowSetSizable (maFen, false ) guiWindowSetMovable (maFen, true ) showList(atList) buyButton = guiCreateButton( 0.03, 0.89, 0.33, 0.10, "Satın Al", true, maFen ) closeButton = guiCreateButton( 0.66, 0.89, 0.33, 0.10, "Kapat", true, maFen ) addEventHandler( "onClientGUIClick", maFen, aClickGui ) showCursor ( true ) guiSetVisible ( maFen, true ) --guiCreateStaticImage( 5, 5, 200, 85, "colors\\2.png", false, maTab ) colorFen = guiCreateWindow( x / 2 - 260, y / 2 - 40, 520, 210, "Renkler", false ) local colorNum = 0 local colorNum1 = 0 local colorX = 10 local colorY = 25 while colorNum ~= 127 do colorButton = guiCreateStaticImage( colorX, colorY, 23, 23, "colors\\"..colorNum..".png", false, colorFen ) setElementData ( colorButton , "colorNum1", ""..colorNum.."" ) addEventHandler( "onClientGUIClick", colorButton, aClickGuiColor ) colorNum = colorNum + 1 colorX = colorX + 25 if colorNum1 == 19 then colorY = colorY + 25 colorNum1 = 0 colorX = 10 else colorNum1 = colorNum1 + 1 end end colorCloseButton = guiCreateButton( 0.76, 0.85, 0.23, 0.1, "Kapat", true, colorFen ) addEventHandler( "onClientGUIClick", colorFen, aClickGui ) guiWindowSetSizable ( colorFen, false ) guiSetVisible ( colorFen, false ) else guiSetVisible ( maFen, true ) showCursor ( true ) guiBringToFront ( maFen ) showList(atList) end end addEvent( "guiStart", true ) addEventHandler( "guiStart", getRootElement(), guiStart ) function destroyvehicles ( vehicle ) destroyElement ( vehicle ) end addEvent( "destroyvehicles", true ) addEventHandler( "destroyvehicles", getRootElement(), destroyvehicles ) function showList(atList) local table = {} -- outputChatBox ( ""..atList.."" ) vehicleList = guiCreateGridList ( 0.03 , 0.07, 0.4, 0.8, true, maFen ) vehicleList1 = guiGridListAddColumn( vehicleList, "Araçlar", 0.5 ) priceList = guiGridListAddColumn( vehicleList, "Fiyatı", 0.3 ) node = xmlLoadFile("data\\vehicles.xml") if ( node ) then local vNum = 0 while ( xmlFindSubNode ( node, "group", vNum ) ~= false ) do local group = xmlFindSubNode ( node, "group", vNum ) if xmlNodeGetAttribute ( group, "type" ) == atList then local gName = xmlNodeGetAttribute ( group, "id" ) -- guiGridListSetItemText( vehicleList, guiGridListAddRow ( vehicleList ), 1, ""..gName.."", false, false ) local vNum1 = 0 while ( xmlFindSubNode ( group, "vehicle", vNum1 ) ~= false ) do local aVehicle = xmlFindSubNode ( group, "vehicle", vNum1 ) local vId = xmlNodeGetAttribute ( aVehicle, "id" ) local vName = getVehicleNameFromID ( vId ) local vPrice = xmlNodeGetAttribute ( aVehicle, "price" ) local row = guiGridListAddRow ( vehicleList ) guiGridListSetItemText( vehicleList, row, 1, ""..vName.."", false, false ) guiGridListSetItemText( vehicleList, row, 2, ""..vPrice.."", false, false ) vNum1 = vNum1 + 1 end end vNum = vNum + 1 end addEventHandler( "onClientGUIClick", vehicleList, aClickGuiCar ) addEventHandler( "onClientGUIDoubleClick", vehicleList, aClickDoubleGui ) bindKey ( "arrow_u", "down", navList ) bindKey ( "arrow_d", "down", navList ) xmlUnloadFile ( node ) end return table end function navList ( key, keyState) local rowSel = guiGridListGetSelectedItem ( vehicleList ) if key == "arrow_u" then guiGridListSetSelectedItem ( vehicleList, tonumber(rowSel)-1, 1 ) elseif key == "arrow_d" then guiGridListSetSelectedItem ( vehicleList, tonumber(rowSel)+1, 1 ) end local aCurrentVehicle = guiGridListGetItemText ( vehicleList, guiGridListGetSelectedItem ( vehicleList ), 1 ) guiStaticImageLoadImage ( carPic, "Png\\"..aCurrentVehicle..".png" ) end function aClickGui (button) if ( button == "left") then if ( source == closeButton ) then guiSetVisible ( maFen, false ) guiSetVisible ( colorFen, false ) showCursor ( false ) destroyElement ( vehicleList ) unbindKey ( "arrow_u", "down", navList ) unbindKey ( "arrow_d", "down", navList ) local num = 0 while num ~= 4 do num = num + 1 if ( colorEx[num] ) then guiStaticImageLoadImage ( colorEx[num], "colors\\rien.png" ) end end guiStaticImageLoadImage ( carPic, "Png\\rien.png" ) elseif ( source == buyButton ) then if ( aCurrentVehicle ) ~= "" then local cNum = 0 while cNum ~=4 do cNum = cNum + 1 cColor[cNum] = getElementData ( colorButtonA[cNum], "apColor" ) if cColor[cNum] == false then cColor[cNum] = "1" end end applyVehicle ( cColor[1], cColor[2], cColor[3], cColor[4] ) guiSetVisible ( maFen, false ) guiSetVisible ( colorFen, false ) showCursor ( false ) unbindKey ( "arrow_u", "down", navList ) unbindKey ( "arrow_d", "down", navList ) destroyElement ( vehicleList ) guiStaticImageLoadImage ( carPic, "Png\\rien.png" ) else outputChatBox ( "no vehicle selected" ) end elseif ( source == colorCloseButton ) then guiSetVisible ( colorFen, false ) elseif ( source == colorButtonA[4] ) then guiSetVisible ( colorFen, true ) guiBringToFront ( colorFen ) setElementData ( colorFen, "typColor", "4" ) elseif ( source == colorButtonA[3] ) then guiSetVisible ( colorFen, true ) guiBringToFront ( colorFen ) setElementData ( colorFen, "typColor", "3" ) elseif ( source == colorButtonA[2] ) then guiSetVisible ( colorFen, true ) guiBringToFront ( colorFen ) setElementData ( colorFen, "typColor", "2" ) elseif ( source == colorButtonA[1] ) then guiSetVisible ( colorFen, true ) guiBringToFront ( colorFen ) setElementData ( colorFen, "typColor", "1" ) end end end function aClickGuiColor (button) color1Choose = getElementData ( source, "colorNum1" ) if color1Choose ~= false then typeColorButton = getElementData ( colorFen, "typColor" ) if typeColorButton == "2" then local exPosX = 0.60 affColorExemple ( color1Choose, typeColorButton, exPosX ) elseif typeColorButton == "1" then local exPosX = 0.47 affColorExemple ( color1Choose, typeColorButton, exPosX ) elseif typeColorButton == "3" then local exPosX = 0.73 affColorExemple ( color1Choose, typeColorButton, exPosX ) elseif typeColorButton == "4" then local exPosX = 0.86 affColorExemple ( color1Choose, typeColorButton, exPosX ) end end end function affColorExemple ( color1Choose, typeColorButton, exPosX ) -- outputChatBox ( ""..color1Choose.."" ) guiSetVisible ( colorFen, false ) setElementData ( colorButtonA[tonumber(typeColorButton)], "apColor", ""..color1Choose.."" ) if ( colorEx[tonumber(typeColorButton)] ) then guiStaticImageLoadImage ( colorEx[tonumber(typeColorButton)], "colors\\"..color1Choose..".png" ) else colorEx[tonumber(typeColorButton)] = guiCreateStaticImage( exPosX, 0.46, 0.08, 0.06, "colors\\"..color1Choose..".png", true, maFen ) end end function aClickDoubleGui (button) if (button == "left" ) then if ( source == vehicleList ) then local cNum = 0 while cNum ~=4 do cNum = cNum + 1 cColor[cNum] = getElementData ( colorButtonA[cNum], "apColor" ) if cColor[cNum] == false then cColor[cNum] = "1" end end applyVehicle (cColor[1], cColor[2], cColor[3], cColor[4] ) if aCurrentVehicle ~= "" then --- SE IF FAUDRAI LE METTRE PLUS HAUT y a un doublon ligne 303 guiSetVisible ( maFen, false ) showCursor ( false ) unbindKey ( "arrow_u", "down", navList ) unbindKey ( "arrow_d", "down", navList ) destroyElement ( vehicleList ) guiStaticImageLoadImage ( carPic, "Png\\rien.png" ) end end
  12. Thank You {RoG}xXMADEXx.Worked
  13. Zombies don't open the door.How to do ? local gate1 = createObject(980, 2493.5, 2350.6001, 12.6, 0, 0, 0) local marker = createMarker(2493.5, 2350.6001, 10, "cylinder", 6, 0, 0, 0, 0 ) function moveGate(hitPlayer, matchingDimension) moveObject(gate1, 2000, 2493.5, 2350.6001, 17.6) end addEventHandler("onMarkerHit", marker, moveGate) function moveBack() moveObject(gate1, 2000, 2493.5, 2350.6001, 12.6) end addEventHandler( "onMarkerLeave", marker, moveBack )
×
×
  • Create New...