-
Posts
431 -
Joined
Everything posted by Al3grab
-
addEvent("nMap",true) -- After Vote Event addEventHandler("nMap",root,function(MapName) startResource(getResourceFromName(MapName)) -- start the map end ) addEvent("doOutputChatBox",true) -- outputChatBox Event addEventHandler("doOutputChatBox",root,function(Message,r,g,b) outputChatBox(Message,root,r,g,b) -- outputChatBox message end ) addCommandHandler("nextmap",function(plr,cmd,...) if plr then outputChatBox("**#FFFF00 Vote Started By : [ "..getPlayerName(plr).." #FFFF00]",plr,255,0,0,true) nextmapname = table.concat({...}," ") nextMap = nil for i,d in ipairs ( getResources() ) do -- get the resource name local resName = getResourceName(d) if string.find(resName,nextmapname) then nextMap = resName end end -- Vote local notEnoughVotesMessage = "Not enough votes to set nextmap as "..nextmapname.."." exports.votemanager:startPoll { --- export the vote manager function title="Set nextmap as "..nextmapname.."?", percentage=75, timeout=30, allowchange=false, maxnominations=3, visibleTo=root, [1]={"Yes", "nMap",plr,nextmapname}, -- "nMap" is the event we added before , and plr is the baseElement in triggerEvent function , nextmapname is the map name [2]={"No", "doOutputChatBox",plr, notEnoughVotesMessage, 255,0,0; default=true}, -- "doOutputChatBox" is the event we added befor , and plr is the baseElement , message , r , g , b } -- Vote end end )
-
function [color=#FF0000][size=8][b]w[/b][/size][/color]in(ammo, killer, weapon, bodypart) addEventHandler( "onPlayerWasted", getRootElement(), [color=#FF0000][b][size=8]W[/size][/b][/color]in)
-
What do want to do exactly ?!
-
Hi , i used setElementSpeed + getElementSpeed from Useful Functions https://wiki.multitheftauto.com/wiki/SetElementSpeed https://wiki.multitheftauto.com/wiki/GetElementSpeed -- From Useful Functions ! function setElementSpeed(element, unit, speed) -- only work if element is moving! if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then -- if true - element is valid, no need to check again local diff = speed/acSpeed local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end ----- function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end ------ function turn(thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) if (not vehicle) then return end local rX, rY, rZ = getVehicleRotation(vehicle) local Speeds = getElementSpeed(vehicle) setElementRotation(vehicle, rX, rY, rZ + 180) local Boost = 80 -- You Can set this to 0 if You Dont Need it ! setTimer(setElementSpeed,1100,1,vehicle,1,Speeds+Boost) -- i used timer to set the car speed after rotation 1 outputChatBox("You turned your vehicle with " .. tostring(Speeds) .. " mph", thePlayer) end function bindTheKey() for index, player in pairs(getElementsByType("player")) do bindKey(player, "lctrl", "down", turn) outputChatBox("#00FF00You can now press #0000FF'left ctrl' #00FF00in vehicle to turn for 180 degrees!", player, 255, 255, 255, true) end end addEventHandler("onResourceStart", resourceRoot, bindTheKey) addEventHandler("onPlayerJoin", root, function() bindKey(source, "lctrl", "down", turn) end) This Should Work !!
-
function arrest(attacker, weapon) if attacker then local weap = getWeaponNameFromID(3) local playerTeam = getPlayerTeam(attacker) if ( getPlayerTeam(attacker)== getTeamFromName("Police") ) then if ( getPlayerWantedLevel(source) == "1" ) or ( getPlayerWantedLevel(source) == "2" ) or ( getPlayerWantedLevel(source) == "3" ) or ( getPlayerWantedLevel(source) == "5" ) or ( getPlayerWantedLevel(source) == "6" ) then if ( weapon ) then if ( weapon == weap ) then local arrestMarker = createMarker(1542.39966, -1675.01782, 13.55443, "cylinder", 2.5, 255, 255, 0, source) toggleAllControls( source, false ) ax, ay, az = getElementPosition ( attacker) cx, cy, cz = getElementPosition ( source ) d = getDistanceBetweenPoints3D(ax, ay, az, cx, cy, cz) if ( d > 10 ) then setElementPosition( source, cx-5, cy, cz ) end end end end end end end addEventHandler( "onPlayerDamage", root, arrest) function mhit(hitElement) if ( getPlayerWantedLevel(hitElement) == "1" ) or ( getPlayerWantedLevel(hitElement) == "2" ) or ( getPlayerWantedLevel(hitElement) == "3" ) or ( getPlayerWantedLevel(hitElement) == "5" ) or ( getPlayerWantedLevel(hitElement) == "6" ) then setElementInterior(hitElement, 6) setElementPosition(hitElement, 264.74969, 77.49036, 1001.03906) else end end addEventHandler( "onMarkerHit", arrestMarker, mhit ) Try This
-
For Timer You can use setTimer For Drawing the timer use dxDrawText also check this : viewtopic.php?f=91&t=36737#p378594
-
Try This : Client GUIEditor_Window[1] = guiCreateWindow(212,58,358,493,"jail script",false) guiSetVisible(GUIEditor_Window[1],false) GUIEditor_Edit[1] = guiCreateEdit(187,132,162,42,"",false,GUIEditor_Window[1]) guiEditSetReadOnly(GUIEditor_Edit[1],true) GUIEditor_Button[1] = guiCreateButton(206,224,122,44,"jail",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(206,324,119,38,"unjail",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(194,94,124,35,"Player Name:",false,GUIEditor_Window[1]) function update() playerName = getPlayerName ( getLocalPlayer() ) playerList = guiCreateGridList(10,23,174,461,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(playerList,2) local column = guiGridListAddColumn( playerList, "Player", 0.85 ) if ( column ) then for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) end addEventHandler ( "onClientGUIClick", playerList, click ) end end addEventHandler ( "onClientResourceStart", getRootElement(), update) addEventHandler("onClientPlayerJoin", getRootElement(), update) addEventHandler("onClientPlayerQuit", getRootElement(), update) addEventHandler("onClientPlayerChangeNick", getRootElement(), update) function click () local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) guiSetText ( GUIEditor_Edit[1], playerName ) end function onGuiClick (button, state, absoluteX, absoluteY) if (source == GUIEditor_Button[1]) then playerNick = guiGetText ( GUIEditor_Edit[1] ) triggerServerEvent ("jail", getLocalPlayer(),getLocalPlayer(), playerNick) elseif (source == GUIEditor_Button[2]) then playerNick = guiGetText ( GUIEditor_Edit[1] ) triggerServerEvent ("unjail", getLocalPlayer(),getLocalPlayer(), playerNick) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) Server addEvent("jail",true) addEventHandler("jail",root, function(IM,HIM) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(HIM) local theVehicle = getPedOccupiedVehicle(thePlayer) if not thePlayer then return end if theVehicle then removePedFromVehicle(thePlayer) end if getElementData( thePlayer, "isJailed") then outputChatBox("This player is already in jail.",IM,255,0,0) return end setElementInterior ( thePlayer, 0 ) setElementPosition (thePlayer, -2354.158203125, 1922.5645751953, 693.34704589844) setElementData ( thePlayer, "isJailed", true ) outputChatBox (name.." you are in jail now", getRootElement(), 255, 0, 0, true ) showPlayerHudComponent (thePlayer, "weapon", false) else outputChatBox ("Access denied", thePlayer, 193, 13, 13) end end ) addEvent("unjail",true) addEventHandler("unjail",root, function(IM,HIM) if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(IM)), aclGetGroup ( "Admin" ) ) then local thePlayer = getPlayerFromPartOfName(HIM) if thePlayer then if not getElementData( thePlayer, "isJailed") then outputChatBox("This player is not in jail.",IM,255,0,0) return end setElementInterior ( thePlayer, 0) setElementPosition ( thePlayer, -2313.3076171875, 1902.7426757813, 9.9688625335693) setElementData ( thePlayer, "isJailed", false ) outputChatBox (name.."yor are out the jail now"..name, getRootElement(), 0, 255, 0, true ) else outputChatBox ("Access denied", thePlayer, 193, 13, 13) end end end ) Now You Have To Do Bind Key Or add a Command To Show Your Panel
-
Ok next time i will
-
thePlayer: The player that will be presented as executer of the command to the handler function(s) of the command. so who will be the executer ? remember that the command 'add' is only for admin -_-" the executer will be the same player after giving him admin rights and then removing it after executing !
-
Thx , I Cant Understand You ?
-
-- Making Your Gui Should'nt be with the onGuiClick Event ,, so : editbox = guiCreateEdit(11, 41, 241, 22, "", false, shopwinow) -- make your Gui guiSetEnabled(editbox ,false) -- Set it Disabled -- then set your event handler function onGuiClick (button, state, absoluteX, absoluteY) if ( source == weapButton_25 ) then triggerServerEvent("button", getLocalPlayer()) -- Start if ( source == editbox ) then -- on Clicked function Enableit() -- enabling it guiSetEnabled(editbox ,true) -- set it to enabled outputChatBox("the button has been displayed") -- output ur msg to chat end --- end ! setTimer(Enableit,60*1000,1) -- Set your timer -- END end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick)
-
https://community.multitheftauto.com/index.php?p= ... ls&id=3219 Stolen
-
i Think if the Resources has been Listed By Path it will be more Organized.
-
You Can Use string.find getMapName()
-
Community Link : https://community.multitheftauto.com/index.php?p=resources&s=details&id=3202 War Panel By Al3grab Hi, this is my resource War Panel For War GameModes . Includes : * Rules Tab [ Edit Rules Images.png From Al3grab Folder ] * Weapons Shop [ Edit Prices From meta.xml Or Admin Panel ] * Shop [ Edit Prices From meta.xml Or Admin Panel ] * Login/Register * Money Send Keys : - F2 = To Open The War Panel [ Edit The Key From meta.xml Or Admin Panel ] - J = to Take / Remove Jetback. - L = to Enable / Disable Laser. - F6 = To Show / Hide Shield. Video for Shop Features : How To Install : - Download the Resource. - You Can Edit The Prices/Open Key From meta.xml file or from Resource Settings via Admin Panel . - Dont Forget To Give The Resource Admin Rights - Run It , Enjoy ! ** To Disable Anything from shop or weapons Set its price To 0 Important Resources included : cashsave = To Save Players Money in Accounts. reward = Reward on Player Kill [ Edit Reward Price From meta.xml ] Admins Commands : - /cc = Clear The Chat - /al = Shoot Alarm - /bd = Disable The Supers in Shop - /cd = Chat Disable - /ce = Chat Enable - /hd = Disable Heavey Weapons [ Miniguns , grenades , satceh , ...etc] - /he = Enable Heavey Weapons - /sa = Send Money For All Players * This Version is For Publishing , i made first version at 30/8/2011 .. the lastest version now is v2.0, You Can Visit My Server To See It : 94.23.146.149:5600 Al3grab © - 11/11/11.
-
yes the last patch have problems , install the patch.0.2.9.3 http://scripteditor.beta.mtasa.com/files/patch.0.2.9.3.zip until the next update released
-
Edit Your settings.conf file and add the server folder .. example :
-
[EDITOR] TabSize=4 TabGuideColor=-2894893 SelectionFGColor=-16777216 SelectionBGColor=-5065537 LineNumBorderColor=-16744320 LineNumFGColor=-16744320 LineNumBGColor=-1 EOLColor=-65536 BracketFGColor=-16777216 BracketBorderColor=16777215 BracketBGColor=-5192482 BGColor=-1 [MAIN] MTAServerPath=C:\Program Files\MTA San Andreas\server MenusRenderer=0 Maximized=false Width=808 Height=604 Y=84 X=283 [EDITOR_COLORS] backcolor=-986896 highlightline=-5192482 [uPDATER] autoupdate=0
-
Hello , i am using this program .. its pretty awesome , i updated it to the 0.2.9.5 version [ For MTA 1.1 Resources Layout ] .. but it crashes if i open a file .. so i reinstalled the 0.2.9.3 ver. and now it works fine .. waiting for next update. Notes : * For Windows 7 Users , Run The Program as Administrator [ Right Click > Run as Administrator ] * Don't Forget To Extract The Program Before Running it ! * You Can Edit Your Resources Folder From [settings.conf] file .
-
i think i have to do executeCommandHandler =D
-
oh yes , outputConsole should be outputChatBox =D
-
here is where i edited : function cMarker (thePlayer, commandName) -- here if (thePlayer) then local x,y,z = getElementPosition (thePlayer) local theMarker = createMarker ( x,y,z, "arrow", 1.5, 255, 255, 0, 255,getRootElement()) -- here if (theMarker) then outputConsole ("Entry Marker Created", thePlayer) else outputConsole ("Failed to Create Marker", thePlayer) end end end addCommandHandler ("createentrymarker", cMarker ) -- here