-
Posts
215 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Z4Zy
-
In line 9 and 10, you have added root element to the event, means, when this for loop run it's first time, event already added to all players. So no need to add that event again to other. So I suggest to change the argument 2 of event handlers in line 9 and 10 to plrs. And what about the using of local variable called "executed" ?? local executed = false -- executed is false when resource starts -- Timer10 = setTimer( function () time0 = 1 for _,plrs in ipairs(getElementsByType("player")) do if ( getElementDimension (plrs) == 0 ) then if ( executed == false ) then addCommandHandler("usemedkit", usethemedkit) addCommandHandler("acceptmedkit", healOthers) addEventHandler("meds.giveMedKit", root, giveMedKit) addEventHandler("meds.useMedKitOnOther", root, usemedkitanother) executed = true end if ( executed ) then killTimer(Timer10) end if ( getElementDimension (plrs) == 336 ) then if ( executed ) then killTimer(Timer10) end if ( executed == false ) then resetTimer(Timer10) end if ( executed ) then killTimer(Timer10) end timer0 = timer0 - 1 if ( timer0 < 0 ) then killTimer(Timer10) end end end end end, 1000, 0)
-
what did you trying to do ?? if player in dimension 0 then he allowed to use the functions else he can not use that functions. Isn't it ??
-
Thnx A Lot Mr.Tasty
-
My code is not detects that player clicked on the world map. It detects that player clicked on screen and then it get screen position related to world and sent player to that position. It looks, whether player's map shown or not. So I think, source element of the event "onClientClick" should be the map. Then the code can find the location of the clicked position of the map. But how to insert it ??
-
Client Side timers are destroyed, when client / player disconnect from server. But if you set this timer to Server Side, it doesn't destroyed. I think this problem will fix if, you change the 2nd argument of event handler in line 16 to localPlayer, instead of root.
-
As I understand below is code created by me, addEventHandler("onClientClick",root, function () local a,b,u,v,w = getCursorPosition() local x,y,z = getWorldFromScreenPosition(u,v,w) if isPlayerMapVisible() then setElementPosition(localPlayer,x,y,z+1) end end ) Here, if map showing, when player click, he will go to the clicked position near living environment. But not the position that was clicked on map. How to fix this, to go player to the position that was clicked on map ?
-
what should be the source name to the event "onClientClick" related to the map ??
-
If this message (ACL: Acces denied for restart) appear, when you are trying to restart a resource, then you should be in the admin acl to do that. Meanwhile, you should be an administrator of the server. Else if this message (ACL: Acces denied for restart) appear, as a result of a resource's function, then you should give that resource acl access to restart resource. Else if you talking about how to change the out put message "ACL: Acces denied for restart" to different one like "You Are Not An Admin", then I think you should have a help from another member.
-
I haven't know about "isPlayerMapVisible" function, until you mentioned it to me And how to find is player clicked on that map ??
-
Hellow again ! Can you help me to find the answer to the simple question , How to find, Is player clicked on the map in F11 ?? And how to get the clicked position according to the world ??
-
Hellow Friends ! I think you've heard / experienced / saw an execute command field with the text "For Advanced Users Only" , that we can see inside the resource tab of admin-panel As far as I know, we can insert commands, for example, outputChatBox("Hellow Mates!",root,255,255,0) and hit the server button will output text to everyone. Okay..!!?? setElementHealth(source,100) killPed(source) setDevelopmentMode(true) ,are some examples that can be executed using admin-panel's execute field. But I have a problem. How did I execute a code like bellow, using above admin-panel's execute field ?? Is it possible ?? local vehicle = getPedOccupiedVehicle(localPlayer) setElementVelocity(vehicle,0,0,5) and what occasions did you using this execute command field ??
-
Suggestion :- Refer multi theft auto wiki, for acquire better knowledge about scripting scripting intro :- https://wiki.multitheftauto.com/wiki/Scripting_Introduction Main Page :- https://wiki.multitheftauto.com/wiki/Main_Page
-
Your Code..., RX7_sound = { {"001.wav",494}, } function replacesound(player) for i,OBJ in ipairs(RX7_sound) do vehicle = getPedOccupiedVehicle (OBJ[2]) if vehicle then sound = playSound (OBJ[1],looped = true) setSoundVolume(sound, 0.5) setSoundMaxDistance(sound,25) end end end addEventHandler("onClientResourceStart",root,replacesound) in line 8, playsound argument 2 is given as looped = true. Try to remove the word looped= and remain it as true only.
-
try to add below code into the existing script , Client Side :- local controlTable = { "fire", "next_weapon", "previous_weapon", "forwards", "backwards", "left", "right", "zoom_in", "zoom_out", "change_camera", "jump", "sprint", "look_behind", "crouch", "action", "walk", "aim_weapon", "conversation_yes", "conversation_no", "group_control_forwards", "group_control_back", "enter_exit", "vehicle_fire", "vehicle_secondary_fire", "vehicle_left", "vehicle_right", "steer_forward", "steer_back", "accelerate", "brake_reverse", "radio_next", "radio_previous", "radio_user_track_skip", "horn", "sub_mission", "handbrake", "vehicle_look_left", "vehicle_look_right", "vehicle_look_behind", "vehicle_mouse_look", "special_control_left", "special_control_right", "special_control_down", "special_control_up" } function getBoundControls (key) local controls = {} for _,control in ipairs(controlTable) do for k in pairs(getBoundKeys(control)) do if (k == key) then controls[control] = true end end end return controls end
-
Did you play a song from a URL path ?? if so, you can use a song file instead of using a URL to play song.
-
Tasks shown in Primary task 3 of above is appear when pressing F or enter near vehicle. I've got them from the code in, https://wiki.multitheftauto.com/wiki/GetPedTask
-
Did you parse this script in client side ??
-
What about this ? any problem ?? radio Works fine Client Side :- function turnRadio () playSound("http://listen.181fm.com/181-power_128k.mp3?listenerid=4721ecee868b8ca5206a2a09d59329fe&esPlayer&cb=924945.mp3") end addCommandHandler("radio",turnRadio)
-
Quoted :- https://wiki.multitheftauto.com/wiki/GuiCreateButton --create our button button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) --Create an edit box and define it as "editBox". editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "Type your message here!", true ) -- and attach our button to the outputEditBox function addEventHandler ( "onClientGUIClick", editBox, outputEditBox ) guiEditSetMaxLength ( editBox, 128 ) --the max chatbox length is 128, so force this --setup our function to output the message to the chatbox function outputEditBox () local text = guiGetText ( editBox )--get the text from the edit box outputChatBox ( text ) --output that text end addEventHandler ( "onClientGUIClick", button, outputEditBox ) MTA:Wiki also guide that...!! Well Well as you said Compatibility may issues if we put the GUI element in the event handler.
-
Hi There ! Below code draw a DX text with Real World Time. function time () local time = getRealTime() local hours = time.hour local minutes = time.minute dxDrawRectangle (112, 468, 134, 47, tocolor(0, 0, 0, 150)) dxDrawText (hours..":"..minutes, 146, 476, 304, 536, tocolor(255,255,255), 2) end addEventHandler ( "onClientRender", root, time ) This time is in digital clock [ ex :- 1.30 PM ==> 13:30 , 6.00 PM ==> 18:00 ] And how to convert it to analog clock ?? [ ex :- 13:30 ==> 1.30 PM , 18:00 ==> 6.00 PM ]
-
i gave you a Client Side Code You changed it to Server Side
-
function getposition () local x, y, z = getElementPosition(localPlayer) outputChatBox("ur position is "..x..","..y..","..z.." LOL ",0,255,0) end addCommandHandler("pos", getposition)