Jump to content

Sasu

MTA Contributors
  • Posts

    1,056
  • Joined

  • Last visited

Everything posted by Sasu

  1. Sasu

    Reload ACL

    You need to give runcode admin rights.. <object name="resource.runcode"></object> Restart the Server and there you go.. you can execute commands that require certain rights lice aclReload ()
  2. Sasu

    Reload ACL

    There is no need for that you can do this start runcode then. srun aclReload () --execute this from the console
  3. function aclGetAccountGroups ( account ) local acc = getAccountName ( account ) if ( not acc ) then return false end local res = {} acc = "user."..acc local all = "user.*" for ig, group in ipairs ( aclGroupList() ) do for io, object in ipairs ( aclGroupListObjects ( group ) ) do if ( ( acc == object ) or ( all == object ) ) then table.insert ( res, aclGroupGetName ( group ) ) break end end end return res end
  4. Sasu

    Head Rotation

    Now, the character is looking at me(camera). a Timer? are you crazy? Have you got any good idea?
  5. Sasu

    Head Rotation

    It will not change anything because you can put everything you want as variable.
  6. Sasu

    Head Rotation

    Something like this?: Server: function rotateHead() for i,v in ipairs(getElementsByType("player")) do local _,_,_, x,y,z = getCameraMatrix(v) triggerClientEvent("rotateHead", v, x, y, z) end end setTimer(rotateHead, 3000, 0) Client: addEvent("rotateHead", true) addEventHandler("rotateHead", root, function(rx, ry, rz) setPedLookAt (source, rx, ry, rz, -1) end) It says in debugscript 3: Bad Argument @ 'setPedLookAt'
  7. Sasu

    Head Rotation

    I tried with this but it doesnt work: function onClientLookAtRender() setElementData(localPlayer, "CRotation", getPedCameraRotation(localPlayer)) local cx,cy,cz = getPedBonePosition (localPlayer, -- s8) --> setElementData(localPlayer, "CRotationX", cx) setElementData(localPlayer, "CRotationY", cy) setElementData(localPlayer, "CRotationZ", cz) for i,v in ipairs(getElementsByType("player")) do local CCam = tonumber(getElementData(v, "CRotation")) or 0 local rotcam = math.rad (360 - CCam) local xpos,ypos,zpos = tonumber(getElementData(v, "CRotationX")), tonumber(getElementData(v, "CRotationY")), tonumber(getElementData(v, "CRotationZ")) local xlook,ylook,zlook = xpos - 300*math.sin(rotcam), ypos + 300*math.cos(rotcam), zpos setPedLookAt (v, xlook, ylook, zlook, -1) end end addEventHandler ("onClientRender", root, onClientLookAtRender) Then I tried with this other one but it doesnt work too: Server: function rotateHead() for i,v in ipairs(getElementsByType("player")) do triggerClientEvent("rotateHead", v) end end setTimer(rotateHead, 3000, 0) Client: addEvent("rotateHead", true) addEventHandler("rotateHead", root, function() local rotcam = math.rad (360 - getPedCameraRotation (source)) local xpos,ypos,zpos = getPedBonePosition (source, 8 ) local xlook,ylook,zlook = xpos - 300*math.sin(rotcam), ypos + 300*math.cos(rotcam), zpos setPedLookAt (source, xlook, ylook, zlook, -1) end)
  8. Sasu

    Head Rotation

    You mean to do a loop of all player and then use triggerClientEvent for each player?
  9. Sasu

    help GridList

    I dont know. It would be more easy if you do in SQLite. I can help you, PM Me if you want.
  10. Sasu

    help GridList

    Line 6 ( server ): replace for i=1, fileGetSize(file) do -> while not fileIsEOF(file) do
  11. Try this: local bankMarkers = { {562.79998779297, -1254.5999755859, 16.89999961853, 284, false}, {1001.700012207, -929.40002441406, 41.799999237061, 278.74658203125, false} } local blips = { } local isViewingBlip = {} function executeCheck ( source ) if isViewingBlip[source] then for i,v in ipairs(blips[source]) do if isElement(v) then destroyElement(v) end end blips[source] = {} isViewingBlip[source] = false else if not blips[source] then blips[source] = {} end for i,v in ipairs(bankMarkers) do local id,x,y,z = unpack(v) local b = createBlip(id, x, y, z) table.insert(blips[source], b) end isViewingBlip[source] = true end end addCommandHandler("showatm", executeCheck)
  12. Sasu

    Head Rotation

    I have this script: function onClientLookAtRender() for i,v in ipairs(getElementsByType("player")) do local rotcam = math.rad (360 - getPedCameraRotation (v)) local xpos,ypos,zpos = getPedBonePosition (v, 8 ) local xlook,ylook,zlook = xpos - 300*math.sin(rotcam), ypos + 300*math.cos(rotcam), zpos setPedLookAt (v, xlook, ylook, zlook, -1) end end addEventHandler ("onClientRender", root, onClientLookAtRender) But I saw that it does not work. The localPlayer works correctly but the other players only see to north, I think. Can you help me?
  13. Sasuke* Scripting Hey! How are you? I think that if you are here is because you are looking for a scripter as the title says. Well, first of all I will not do full gamemodes because of the time. You have to give me the idea in detail and if it has a GUI or DX, you should give me any kind of picture of how to make. Do you like to see my scripts in community? Well, let's go. Community Scripts The scripts that were made by me for the community are very old when I was a basic scripter but now my habilities are high but as my knowledge ,in scripts on race gamemode, are low, I will not do race scripts. Well, you can see my profile in the community: Sasuke's community profile Script's test Before you buy the script, I will give you an IP of my server to test the script and see if you can see any bug. I will give you a guarantee of one week, in that time, if you find any bug, you have to say me to fix that bug. Payment Well, I only work with paypal. The price is depend of the script's kind. Then, we will talk about. P.S.: I dont know what else to put. If you have a question, dont wait to reply this post or PM me.
  14. Sasu

    Problem with PHP

    You mean this? : <?php /** ************************************ * MTA PHP SDK ************************************ * * @copyright Copyright (C) 2010, Multi Theft Auto * @author JackC, eAi, Sebas * @link [url=http://www.mtasa.com]http://www.mtasa.com[/url] * @version 0.4 */ 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();
  15. Sasu

    Problem with PHP

    What do you mean with class MTA?
  16. I dont know if the section is correct, but can you help me? I tried to connect to my server from PHP and it says me: My php: <?php require "sdk/mta_sdk.php"; echo 'TEST LALAL ._. ._______. <br>'; $mtaServer = new mta("181.27.149.37", 22005); $resource = $mtaServer->getResource ( "test1" ); $retn = $resource->call ( "getThisResource" ); // $retn is an array containing the values the function returned $resourceElement = $retn[0]; // the first returned value is the resource $retn = $resource->call ( "getResourceName", $resourceElement ); $resourceName = $retn[0]; echo 'hola'; echo $resourceName; ?> And the port 22005 is open, I tested it with command 'openports'.
  17. Sasu

    help GridList

    I didnt understand what you said. Show me a photo.
  18. Sasu

    help GridList

    I dont know if is too late to answer but you could try change line 7 in the server local text = fileRead(file, i) -> local text = fileRead(file, 500)
  19. Should be: function dealDrug ( playerSource ) if ( playerSource ) then myTeam = getPlayerTeam(playerSource) if myTeam then myTeamName = getTeamName(myTeam) if ( myTeamName == "Criminal" ) then setElementFrozen(playerSource, true) setPedAnimation( playerSource, "DEALER", "DEALER_IDLE") x,y,z = getElementPosition(playerSource) markerDeal[playerSource] = createMarker(x,y,z-1, "cylinder", 1.5, 204,0,204) dealerName = getPlayerName( playerSource ) setElementData( markerDeal[playerSource], "dealer", dealerName) bindKey ( playerSource, "w", "down", stopDeal ) bindKey ( playerSource, "a", "down", stopDeal ) bindKey ( playerSource, "s", "down", stopDeal ) bindKey ( playerSource, "d", "down", stopDeal ) setElementData(playerSource, "dStatus", "dealing") else outputChatBox("you are not a Criminal!", playerSource, 255,0,0) end end end end addCommandHandler ( "deal", dealDrug ) function startDealing( hitElement ) if hitElement and source == markerDeal[hitElement] and getElementType(hitElement) == "player" then outputChatBox("start deal", hitElement) end end addEventHandler( "onMarkerHit", root, startDealing )
  20. As the title says, where can i find performancebrowser?
  21. Hey guys, I'm having some problems. I'm currently using Linux Debian 6.0 64 Bits. Everyone on the server randomly gets high ping, first I thought was the network but then I was looking the system resource usage with htop and sometimes the cores used 100% that's when the server lagged and noticed there was Packet Loss I also turned of every unnecessary script but still.. its just soo random. I dont know if im missing a Debian Package ? also Why the server does not use all cores at the same time? Please Help Forgot to mention im getting this kind of error when I start the server and also when I put openports command on the console Querying MTA master server... failed! (28 Error downloading requested files. Timeout was reached. [Connection time-out] [add.php? g=22003&a=22126&h=22005&v=1.3.4-9.05893&x=0_1000_0_1_1&ip=])
  22. Solo debias crear el auto y meterlo a una tabla usando como index el jugador, en este caso 'source'. local vehs = {} function cosas() if isElement(vehs[source]) then destroyElement ( veh ) end local x, y, z = getElementPosition ( source ) vehs[source] = createVehicle ( 411, x, y, z + 2 ) warpPedIntoVehicle(source, vehs[source}) end
  23. Are you sure that the account was registered in account column? Because if it doesn't exist, you will have to create it with "INSERT INTO"
×
×
  • Create New...