Jump to content

JCL

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by JCL

  1. هدا المشكل يحدت معي في أي مرة أشغل الام تي أي قبل ما أضع سماعات الرأس.

    لدا حاول اعادة تشغيل ام تي أي. وادا لم يشتغل الصوت . حاول تنصيبه من جديد

  2. 
    function respawn_player_w(source,time)
        print(1)
    	if isElement(source) and getElementType(source) == "player" then
    		setElementAlpha(source, 100)
    		setElementData(source, "SpawnProtected", true)
    		toggleControl(source, "fire", false)
    		setTimer(function ()
    			setElementData(source, "SpawnProtected", false)
    			setElementAlpha(source, 255)
    			toggleControl(source, "fire", true)
    		end, time*1000, 1)
    		return true
    	else
    		return false
    	end
    end
    
    function call_spawn_function(ammo, attacker, weapon, bodypart)
        respawn_player_w(source,10);
    end
    addEventHandler('onPlayerWasted',root,call_spawn_function);

    حسنا جرب هدا الكود .

    عندما يموت الاعب انتضر 10 تواني 

    • Thanks 1
  3. setResourceInfo its a protected function and you must give it some rights to use it

    so , give admin right to GTWcore resource may solve your problem.

  4. Hi guys

    Some friends asked me about the code for gta v camera or at least similar one, so , here is the code for it :

    local camera_pan;
    local camera_tilt;
    local camera_temp_x;
    local camera_temp_y;
    local camera_temp_z;
    local camera_offset_x;
    local camera_offset_y;
    local camera_offset_z;
    local player_game_x;
    local player_game_y;
    local player_game_z;
    local first_enabled     = 0;
    local mouse_move_x      = 0;
    local mouse_move_y      = 0;
    local camera_speed      = 0.8;
    local enable_sidecamera = 1;
    localplayer             = getLocalPlayer ();
    local fps               = false;
    
    
    local function updateFPS(msSinceLastFrame)
        fps = (1 / msSinceLastFrame) * 1000;
    end
    addEventHandler("onClientPreRender", root, updateFPS)
    
    function check_gui_elements_visible()
        local windows = getElementsByType("gui-window") 
        for i,window in pairs(windows) do
    	    if(guiGetVisible(window) == true) then
    		    return true
    		end
    	end
    	return false;
    end
    
    function isPedAiming ( thePedToCheck )
    	if isElement(thePedToCheck) then
    		if getElementType(thePedToCheck) == "player" or getElementType(thePedToCheck) == "ped" then
    			if getPedTask(thePedToCheck, "secondary", 0) == "TASK_SIMPLE_USE_GUN" then
    				return true;
    			end
    		end
    	end
    	return false;
    end
    
    function attach_camera(distance_x,distance_y)
        local is_any_gui_visible = check_gui_elements_visible();
        if(is_any_gui_visible == true) then mouse_move_x = 0;mouse_move_y = 0;end
    	if(isCursorShowing()) or (isConsoleActive()) or (isMainMenuActive()) or (isMTAWindowActive()) then
    	   mouse_move_x = 0;mouse_move_y = 0;
    	end
    	
        player_game_x   ,player_game_y   ,player_game_z    = getElementPosition(localplayer);
    
        local time_step = 1;
    	if(fps) then  time_step = 1/fps; end
    	
    	camera_pan  = camera_pan  + 1 * mouse_move_x * time_step * 50;
    	camera_tilt = camera_tilt + 1 * mouse_move_y * time_step * 50; 
    	
    	if(camera_tilt > 0.8) then camera_tilt = 0.8; end
    	if(camera_tilt < -2) then camera_tilt = -2; end
    	
    	local offset_x      = player_game_x - distance_y * math.cos(camera_pan+180);
    	local offset_y      = player_game_y - distance_y * math.sin(camera_pan+180);
    	
    	local camera_x      = offset_x - distance_x * math.cos(camera_pan);
    	local camera_y      = offset_y - distance_x * math.sin(camera_pan);
    	local camera_z      = player_game_z + 1 * -camera_tilt;
    	
    	camera_temp_x ,camera_temp_y,camera_temp_z       = interpolateBetween (camera_temp_x,camera_temp_y,camera_temp_z,camera_x,camera_y,camera_z, camera_speed, "Linear");
    	camera_offset_x ,camera_offset_y,camera_offset_z = interpolateBetween (camera_offset_x,camera_offset_y,camera_offset_z,offset_x,offset_y,0, camera_speed, "Linear");
    	
    	setCameraMatrix (camera_temp_x,camera_temp_y,camera_temp_z, camera_offset_x, camera_offset_y, player_game_z+0.5 ,0,100);
    
    end
    
    function camera_activation()
    	if(enable_sidecamera == 1) then
    	    if(first_enabled == 0) then
    		    camera_pan = getPedCameraRotation(localPlayer)+180;
    			first_enabled = 1;
    		end
    	    local v = getPedOccupiedVehicle(localPlayer)
    		if(v) then
    	        if(getCameraTarget () ~= v) then
    	            setCameraTarget (localPlayer);
    		    end
    		else
    		    if(isPedAiming (localPlayer) == true) then
    	            if(getCameraTarget () ~= localPlayer) then
    	                setCameraTarget (localPlayer);
    		        end
    			else
                    attach_camera(1.5,-1);
    			end
    		end
    	    
    	else
    	    first_enabled = 0;
    	    local v = getPedOccupiedVehicle(localPlayer)
    		if(v) then
    	        if(getCameraTarget () ~= v) then
    	            setCameraTarget (v);
    		    end
    		else
    	        if(getCameraTarget () ~= localPlayer) then
    	            setCameraTarget (localPlayer);
    		    end
    		end
    	end
    end
    
    
    addEventHandler ("onClientPreRender", getRootElement(), camera_activation);
    
    addEventHandler( "onClientCursorMove", getRootElement( ),
        function (x, y,_,_ )
    	    local mouse_move_x2 = (0.5 - x) * 100;
    	    local mouse_move_y2 = (0.5 - y) * 100;
    		mouse_move_x ,mouse_move_y = interpolateBetween (0,0, 0,mouse_move_x2,mouse_move_y2,0, 0.1, "Linear");
        end
    );

     

    Example

     

    Feel free to ask any question about the code.

     

     

     

  5. Hi Guys 

    My name is dico, and i'm a programmer (c, c++, directx / opengl)

    This month i start a server on my vps so i can get fun and knowing new friends around the world.

    and what i did , is a new F1 panel created  with new features like (new weapons, flying, god powers and many more)

    in that menu there is 7 levels (player, vip, svip,mod,smod, admin, and Mode god)

    The player earn levels by his hours until he get the final level "Mode God"

    there is also a gate so players can get in and see another world with zombies and some horror scenes

    you can go to this gate by typing in chat "/gate" or in console "gate" or the easiest way you can go to it from F1 panel

    This server just for fun :)

    and when i have time i will add more features to it.

    a Video from the server

     

    now the server info

    Name  Anime Otaku 

     Ip  mtasa://35.237.220.10:22003

    Hope I see you there guys !

     

     

    • Thanks 1
×
×
  • Create New...