Jump to content

TheMaysTRo

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by TheMaysTRo

  1. لا انا اعرف facepalm , قصدي انت ما فهمت ولا حاجة ملي كتبتو فوق ؟
  2. ما فهمت ولا حاجة ؟ هههههههههه
  3. ما عملتها ب else لأنو لو انت عملت فريز للكل ودخل لاعب جديد للسرفر وكان يتحرك عادي ، لما تعمل الفريز تاني هو بيصير ما يقدر يتحرك والباقي يقدرو يتحركو إتمنى تكون فهمت السبب ، لو عاوزها بكومند واحدة اقدر اعملك طريقة ثانية ، اطلبها وبس
  4. الي انا كتبتو الإثنين سيرفر .
  5. function freezeall() for i,player in ipairs(getElementsByType("player")) do if not isElementFrozen(player) then setElementFrozen(player, true) outputChatBox("All players are frozen!!",root, 0,255,0, true) end end end addCommandHandler("freeze-all", freezeall) الكود الي فوق عشان تعمل فريز للكل والمفروض شغال (ما جربتو) والكود الي تحت عشان تشيل الفريز للكل والمفروض شغال (ما جربتو) function unfreezeall() for i,player in ipairs(getElementsByType("player")) do if isElementFrozen(player) then setElementFrozen(player, false) outputChatBox("All players are unfrozen!!",root, 0,255,0, true) end end end addCommandHandler("unfreeze-all", unfreezeall)
  6. Tried to do that , its very complicated , to much lines and lua files , Couldn't find the right part . Thanks for your advice
  7. Hello there ,Im working on my own gamemode , and I want to create a timer when the map start and I will change the map when it ends. My problem is each player have his own timer . Maybe Because im working on client side ? I tried server side and it didn't work . This is my code (client sided ) : theTimer = setTimer(function() end, 60000, 1) -- A timer that does nothing. screenX,screenY = guiGetScreenSize() function createText () remaining, executesRemaining, totalExecutes = getTimerDetails(theTimer) -- Get the timers details if (remaining) then dxDrawRectangle (screenX *.40, screenY * .09, 250, 50, tocolor(0,0,0,150)) text = dxDrawText (remaining/1000, screenX * .48, screenY * .1, screenX, screenY, tocolor(255,255,255), 2) else outputChatBox("Timer no longer exists") end end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText ) -- keep the text visible with onClientRender. end HandleTheRendering ( ) Wish you help me , Thanks .
  8. Hello . I making a casino script that let you bet with other players on money . So , the player "A" use /roll name amount then the player"B" get a message that he can accept or refuse to bet on that money . My problem is that when i send the bet to other player , what i have to do to make him check if he got an invitation from other player ? and how he can accept ? Here is my code . he can use the command /roll to invite someone and the other one can recive it then i didn't know how to make him accept or refuse the bet ? function dice (player,command,giveplayername,ammount) if isElementWithinMarker (player,isincasino) then local moneytogive = tonumber(ammount) local givenplayer = getPlayerFromName ( giveplayername ) local playername = getPlayerName ( player ) local playername2 = getPlayerName ( givenplayer ) if moneytogive >= 2000 then if getPlayerMoney (player) >= moneytogive then outputChatBox("use /accept to accept the bet",givenplayer,255,0,0) outputChatBox("sent",player,255,0,0) setElementData (player,playername2,"sent") setElementData (givenplayer,playername,"accept") else outputChatBox("You don't have enough money",player,255,0,0) end else outputChatBox("You need more than 2000$ ",player,255,0,0) end end end addCommandHandler("roll",dice) function accepto (player,command,giveplayername) if (player and getElementType(player) == "player" ) then local givenplayer = getPlayerFromName ( giveplayername ) local playername = getPlayerName ( player ) local playername2 = getPlayerName ( giveplayername ) if getElementData (givenplayer,playername,"accept") then onaccept() end end end addCommandHandler ("accept",accepto) function onaccept (player,givenplayer) takePlayerMoney(player,moneytogive) takePlayerMoney(givenplayer,moneytogive) x = math.random(1,12) y = math.random(1,12) if x > y then outputChatBox("You Won ".. moneytogive*2 .."$ you rolled "..x.." and the computer rolled "..y,player,1,172,45) setTimer (givePlayerMoney,2000,1,player,moneytogive*2) end if x == y then outputChatBox("Its Draw!!! , You got your Money back , you rolled "..x.." and the computer rolled "..y,player,255,0,0) givePlayerMoney(player,moneytogive) end if xthen outputChatBox("You lost , you rolled "..x.." and the computer rolled "..y,player,255,0,0) end end
  9. hey guys. i created 2 markers local trademarker2 = createMarker(-1576.8345947266,674.15686035156,6.1901206970215, "cylinder", 2,0,255,255,180) local trademarker1 = createMarker(-1633.9525146484,651.51391601563,6.1875, "cylinder", 2,0,255,255,180) then i added a command handler for each one . command2 = addCommandHandler ( "accept1", player1 ) command1 = addCommandHandler ( "accept2", player2 ) the problem is i want the function player1 only works if the 2 command are used and the function player2 also. more details: player A and Player B each one enter marker i want to check when they 2 use the commands .then i will warp them or i do what i want . thanks for help.
  10. Delete your second code and replace it with: function fixandpay(player) setPedAnimation( player, "BD_FIRE", "wash_up ",-1,false,false,nil,false) outputChatBox (".............",player,255,0,0,false) end function commandon (player) if (player and isElement (player) and getElementType (player) == "player") and (not isPedInVehicle (player)) then if (source == attachedmarker) then if (isElementWithinMarker(player)) then outputChatBox (".................",player,255,0,0,false) fixandpay() else return end end end end addCommandHandler ( "fix", commandon ) Then tell me your response. Basically what I've did is, cleared up the code a bit as yours was kinda messy, replaced 'hitElement' with player, as player was defined in your function, removed those useless command/event handlers and added a function to check whether the player is within the marker or not. What you did, you created a marker attached to a vehicle and added an event handler that when you enter the marker a command handler is initiated and then removed, which makes no sense. You've used an un-defined definition, 'hitElement' and most of your code was useless :3 I've left scripting and MTA for a while due to exams, so I'm sorry if my code didn't help.. thanks for trying to help me you have fault if (isElementWithinMarker(player,attachedmarker)) then but i got an error says "Expected marker at argument 2 got nill."
  11. local attachedmarker = createMarker (0,0,0,"cylinder",1.2,0,255,255,180) attachElements ( attachedmarker, car, 0, 3, -1 ) function fixandpay(player) setPedAnimation( player, "BD_FIRE", "wash_up ",-1,false,false,nil,false) outputChatBox (".............",player,255,0,0,false) end function commandon (player) if hitElement and isElement (hitElement) and getElementType (hitElement) == "player" and not isPedInVehicle (hitElement) then if source == attachedmarker then outputChatBox (".................",player,255,0,0,false) addCommandHandler ( "fix", fixandpay ) end end end addEventHandler ("onMarkerHit",getRootElement(),commandon) function commandoff(player) if source == attachedmarker then removeCommandHandler ( "fix" ) end end addEventHandler ("onMarkerHit",getRootElement(),commandoff)
  12. hey guys . i used attachElements to attach a marker to a vehicle but it appeard that i can't use onMarkerHit on an attached marker . any idea what i must do to make it work ? explination : I want the marker to be attached to the vehicle and when i enter it outputchatbox .
  13. Thanks guys Worked . Special Thanks to TAPL and Bonsai
  14. i tried all your ideas , ican't do it right ._. TAPL idea function plant2 (player) if getElementData( player,"tempdata.farmer", true ) then outputChatBox ("you Entred the farm use /plant .",player,0,255,50,false) if isElementWithinColShape (player,Cls) then addCommandHandler ( "plant", plant ) end end end addEventHandler ("onColShapeHit", Cls, plant2) function dontplant (player) if getElementData( player,"tempdata.farmer", true ) then outputChatBox ("you left the farm you can't /plant anymore .",player,0,255,50,false) end end addEventHandler ("onColShapeLeave", Cls, dontplant) what's wrong ? (i can /plant when i leave the colshape =
  15. what do you mean ? i get the type and if its player then what ?
  16. function plant2 (player) if getElementData( player,"tempdata.farmer", true ) then addCommandHandler ( "plant", plant ) outputChatBox ("you Entred the farm use /plant .",player,0,255,50,false) end end addEventHandler ("onColShapeHit", Cls, plant2) function dontplant (player) if getElementData( player,"tempdata.farmer", true ) then removeCommandHandler ( "plant") outputChatBox ("you left the farm you can't /plant anymore .",player,0,255,50,false) end end addEventHandler ("onColShapeLeave", Cls, dontplant) when someone enter the colshape he can use plant normaly. and when he left he can't . but if 2 players entred the colshape and one of them left the command handler will be removed for both of them so the one who is in the colshape can't use plant anymore cause the other guy left . any soloution ?
  17. TheMaysTRo

    animation

    hi. if someone is doing an animaton and he jumped the animation will cancel . i want to make the player can't cancel the animation . any idea ?
  18. TheMaysTRo

    save ?

    Hello I created a jail ystem for Killing in sf . but when someone reconnect his time will not continue so he will stuck in the jail . any idea how to save his time so when he login again he will find his self in jail with his time . ? maybe a save by serial or ip ? anyway here is my code : function player_Wasted ( ammo, attacker, weapon, bodypart ) --jail the killer if ( attacker ) then if ( getElementType ( attacker ) == "player" ) then if isElementWithinColShape (attacker,tempCol) then setElementInterior ( attacker, 6 ) setElementPosition (attacker, 265.21185302734, 77.63591003418, 1001.0390625) toggleControl(attacker,"fire",false) setTimer ( setElementInterior ,120000,1, attacker, 0 ) -- let him go setTimer ( setElementPosition, 120000, 1, attacker, -1572.1206054688,662.33032226563,7.1875) setTimer (toggleControl,120000,1,attacker,"fire",true) outputChatBox ("#00D5FF["..getPlayerName(attacker).."] #FF0000Has Been Jailed For Killing in SF (2minutes) ",client,255,0,0,true) end end end end addEventHandler ( "onPlayerWasted", getRootElement(), player_Wasted )
  19. No . This is not my problem , iwanted to know how to set a timer for each attacker , i mean if 2 entred jail and the timer end they will leave the jail the 2 not 1 . And how to make the timer work only when he entred not all time , cause if it work always he will leave in less of 2 min maybe 1sec or more.
  20. oh sorry my fault . but its the same problem
  21. Hello. i created a script that jail the attacker when he kill in sf . here is the code -----> local tempCol = createColCuboid (-3465.8273925781,-883.77850341797,-9.0344648361206, 2500.0, 2500.0, 600.0 ) function player_Wasted ( ammo, attacker, weapon, bodypart ) if ( attacker ) then if ( getElementType ( attacker ) == "player" ) then if isElementWithinColShape (attacker,tempCol) then setElementPosition (attacker, 1178.6125488281,-1325.0550537109,14.128685951233 ) outputChatBox ("#00D5FF["..getPlayerName(attacker).."] #FF0000Has Been Jailed For Killing in SF (2minutes) ",client,255,0,0,true) end end end end and i want to let the attacker go after 2 min by setting his position . but ididn't know how . this is what i tried setTimer (setElementPosition,120000,1 ,attacker,-1616.7896728516,678.30163574219,7.1875) but if he went to the jail at the last seconds he will be on the position at some seconds ... or if there is 2 person jailed they will be warped together when someone time end . any idea how i can make it ?
  22. i want to detrmines the whole SF is there is any idea ? should i start creating a big col shape on San fierro ? or a big marker ? or any other way ?
×
×
  • Create New...