Jump to content

Deep thinker

Members
  • Posts

    218
  • Joined

  • Last visited

Everything posted by Deep thinker

  1. local Superman = {} -- Static global values local rootElement = getRootElement() local thisResource = getThisResource() -- Resource events addEvent("superman:start", true) addEvent("superman:stop", true) -- -- Start/stop functions -- -- server side function Superman.Start() local self = Superman addEventHandler("superman:start", rootElement, self.clientStart) addEventHandler("superman:stop", rootElement, self.clientStop) end addEventHandler("onResourceStart", getResourceRootElement(thisResource), Superman.Start, false) function Superman.clientStart() setElementData(client, "superman:flying", true) end function Superman.clientStop() setElementData(client, "superman:flying", false) end i think we should add getPlayerTeam or getTeamFromName ,but where to add it in the whole script
  2. You are a PRO scripting :3 thank you both for helping me but i got 1 last question .i wanted to make superman script for "Staff" team
  3. now they aren't in the same place they are next to each other just for a test ,i mean with stealing features is that the marker of the first one doesn't work anymore but in the new ped it works ,with the ped it deletes the "drug dealer" dxText on the first ped and put it on the new one. what i mean is the first marker and ped became useless,
  4. -- Client local aMyPositions = { { x,y,z }; { 1616.44446,-1506.94568,14.20866 }; { 1616.62317, -1503.23218, 14.22469 }; }; for _,aV in ipairs ( aMyPositions ) do marker = createMarker ( aV[1],aV[2],aV[3],'cylinder',1,255,0,0,0 ); ped = createPed ( 28,aV[1],aV[2],aV[3],90,0,0 ); setElementFrozen( ped,true ) end GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(0.3698,0.5208,0.2517,0.1863,"\"Drug Delivery Request\"",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(29,114,92,31,"Cancel",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(158,114,92,31,"Accept",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(11,26,264,79,"If you Pressed \"Accept\"Follow The Blip in the radar and you will gain 10000$ .If you Pressed Cancel or Leaved the Vehicle in the Delivery then your mission failed.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) function ToggleDDMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == 'onClientMarkerHit' then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) elseif eventName == 'onClientMarkerLeave' then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end end end addEventHandler("onClientMarkerHit",marker,ToggleDDMenu) addEventHandler("onClientMarkerLeave",marker,ToggleDDMenu) addEventHandler("onClientRender", getRootElement(), function() local x, y, z = getElementPosition(ped) local x2, y2, z2 = getElementPosition(localPlayer) if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then local sx, sy = getScreenFromWorldPosition(x, y, z+1.1) if(sx) and (sy) then local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distance < 30) then dxDrawText("Drugs Dealer", sx+2, sy+2, sx, sy, tocolor(0,0,0), 2-(distance/20), "arial", "center", "center") dxDrawText("Drugs Dealer", sx, sy, sx, sy, tocolor(255,0,0), 2-(distance/20), "arial", "center", "center") end end end end ) addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end,false ) addEventHandler ('onClientGUIClick',GUIEditor_Button[2], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) triggerServerEvent ("MyEvent",localPlayer) end,false ) addEventHandler ( 'onClientPedDamage',ped,cancelEvent ) --On delivered function aOnDraw ( ) dxDrawText ( 'Good Job ,Here is 10000$',247.0,332.0,917.0,373.0,tocolor(150,0,0,255),2.0,'pricedown','left','top',false,false,false ) setTimer ( function ( ) if getElementData ( localPlayer,'aOnDraw' ) == true then removeEventHandler ( 'onClientRender',root,aOnDraw ) setElementData ( localPlayer,'aOnDraw',false ) end end,3000,1 ) end addEvent ( 'onDelivered',true ) addEventHandler ( 'onDelivered',root, function ( ) local aDraw = getElementData ( localPlayer,'aOnDraw' ) if not aDraw or aDraw ~= true then addEventHandler ( 'onClientRender',root,aOnDraw ) setElementData ( localPlayer,'aOnDraw',true ) end end ) if you can add it into the server side it would be better -- Server Side local newVehicle = { } local myBlip = { } local marker = { } addEvent('MyEvent',true) addEventHandler('MyEvent',root, function ( ) if not getPlayerTeam(source) or getPlayerTeam(source) ~= getTeamFromName("Criminal") then return outputChatBox( 'You are not a criminal to deliver drugs',source,255,0,0 ) end if newVehicle [ source ] and isElement ( newVehicle [ source ] ) then outPutChatBox("You must be a criminal to deliver drugs",255,0,0) return false end newVehicle [ source ] = createVehicle ( 482,1603.34717,-1459.95898,13.68424 ) warpPedIntoVehicle ( source,newVehicle [ source ] ) myBlip [ source ] = createBlip( 1019.93677,2373.41040,10.93885,51,10,255,0,0,255,0 ) setElementVisibleTo( myBlip [ source ],root,false ) setElementVisibleTo( myBlip [ source ],source,true ) marker [ source ] = createMarker ( 1019.93677,2373.41040,9.93885,'cylinder',5,255,53,53,53,source ) end ) addEventHandler ( 'onMarkerHit',resourceRoot, function ( hit ) if ( hit and getElementType ( hit ) == 'vehicle' ) then local player = getVehicleController ( hit ) if ( source == marker [ player ] )then if isElement ( newVehicle [ player ] ) then if ( hit == newVehicle [ player ] ) then triggerClientEvent ( 'onDelivered',player ) destroyElement ( newVehicle [ player ] ) destroyElement ( myBlip [ player ] ) destroyElement ( marker [ player ] ) newVehicle [ player ] = nil myBlip [ player ] = nil marker [ player ] = nil givePlayerMoney ( player,10000 ) end end end end end ) addEventHandler ( 'onPlayerVehicleExit',root, function ( vehicle ) if ( vehicle == newVehicle [ source ] ) then if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end end ) addEventHandler ( 'onPlayerQuit',root, function ( ) if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end )
  5. it worked but, the marker table isn't working well . i have added 2 locations but the second ped stole the features of the first ped instead of sharing it fix it please.
  6. it still doesn't work for both codes . also i noticed that i knew that i tiggered the event twice as you can see but thanks for the marker table
  7. والله بستحق الف لايك و النقطة اللي ذكرها عبد الكريم صح
  8. i knew where is triggerServerEvent ( 'onDelivered',player ) if ( hit == newVehicle [ player ] ) then triggerServerEvent ( 'onDelivered',player ) -- it should be triggerClientEvent ( 'onDelivered',player ) if ( hit == newVehicle [ player ] ) then the bug that hides the marker which is the tiggerServerEvent but i still can't see the DX that i have drawn :3
  9. -- Server Side local newVehicle = { } local myBlip = { } local marker = { } addEvent('MyEvent',true) addEventHandler('MyEvent',root, function ( ) if not getPlayerTeam(source) or getPlayerTeam(source) ~= getTeamFromName("Criminal") then return outputChatBox( 'You are not a criminal to deliver drugs',source,255,0,0 ) end if newVehicle [ source ] and isElement ( newVehicle [ source ] ) then outPutChatBox("You must be a criminal to deliver drugs",255,0,0) return false end newVehicle [ source ] = createVehicle ( 482,1603.34717,-1459.95898,13.68424 ) warpPedIntoVehicle ( source,newVehicle [ source ] ) myBlip [ source ] = createBlip( 1019.93677,2373.41040,10.93885,51,10,255,0,0,255,0 ) setElementVisibleTo( myBlip [ source ],root,false ) setElementVisibleTo( myBlip [ source ],source,true ) marker [ source ] = createMarker ( 1019.93677,2373.41040,9.93885,'cylinder',5,255,53,53,53,source ) end ) addEventHandler ( 'onMarkerHit',resourceRoot, function ( hit ) if ( hit and getElementType ( hit ) == 'vehicle' ) then local player = getVehicleController ( hit ) if ( source == marker [ player ] )then if isElement ( newVehicle [ player ] ) then triggerServerEvent ( 'onDelivered',player ) if ( hit == newVehicle [ player ] ) then triggerServerEvent ( 'onDelivered',player ) destroyElement ( newVehicle [ player ] ) destroyElement ( myBlip [ player ] ) destroyElement ( marker [ player ] ) newVehicle [ player ] = nil myBlip [ player ] = nil marker [ player ] = nil givePlayerMoney ( player,10000 ) end end end end end ) addEventHandler ( 'onPlayerVehicleExit',root, function ( vehicle ) if ( vehicle == newVehicle [ source ] ) then if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end end ) addEventHandler ( 'onPlayerQuit',root, function ( ) if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end ) -- Client local marker = createMarker ( 1616.44446,-1506.94568,13.20866,"cylinder",1,255,0,0,0 ) local ped = createPed ( 28,1616.44446, -1506.94568, 14.2066,90,0,0 ) setElementFrozen( ped,true ) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(0.3698,0.5208,0.2517,0.1863,"\"Drug Delivery Request\"",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(29,114,92,31,"Cancel",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(158,114,92,31,"Accept",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(11,26,264,79,"If you Pressed \"Accept\"Follow The Blip in the radar and you will gain 10000$ .If you Pressed Cancel or Leaved the Vehicle in the Delivery then your mission failed.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) function ToggleDDMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == 'onClientMarkerHit' then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) elseif eventName == 'onClientMarkerLeave' then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end end end addEventHandler("onClientMarkerHit",marker,ToggleDDMenu) addEventHandler("onClientMarkerLeave",marker,ToggleDDMenu) addEventHandler("onClientRender", getRootElement(), function() local x, y, z = getElementPosition(ped) local x2, y2, z2 = getElementPosition(localPlayer) if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then local sx, sy = getScreenFromWorldPosition(x, y, z+1.1) if(sx) and (sy) then local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distance < 30) then dxDrawText("Drugs Dealer", sx+2, sy+2, sx, sy, tocolor(0,0,0), 2-(distance/20), "arial", "center", "center") dxDrawText("Drugs Dealer", sx, sy, sx, sy, tocolor(255,0,0), 2-(distance/20), "arial", "center", "center") end end end end ) addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end,false ) addEventHandler ('onClientGUIClick',GUIEditor_Button[2], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) triggerServerEvent ("MyEvent",localPlayer) end,false ) addEventHandler ( 'onClientPedDamage',ped,cancelEvent ) --On delivered addEvent("onDelivered",true) addEventHandler("onDelivered",root function drawStaticBar() setTimer( function () dxDrawText("Good Job ,Here is 10000$",247.0,332.0,917.0,373.0,tocolor(150,0,0,255),2.0,"pricedown","left","top",false,false,false) end,false,3000,1 ) end,false ) hello ,i wanted to add a dxText in the end of the mission that Says " Good Job ,Here is 10000$" but i have added it .the bug is it hides the marker.also i wanted to make a table of markers instead of 1 marker . thank you
  10. that's what i am talking about ,YOU ARE GREAT .i will stay in touch with you in pm thank you a lot
  11. what about this, i think the bug is over here function drawStaticBar() dxDrawRectangle((sx/2)-270, (sy/2)-22, 540.0, 44.0, tocolor(255,197,0,150), false) dxDrawRectangle((sx/2)-265, (sy/2)-16, 530.0, 33.0, tocolor(0,0,0,250), false) end function drawLoadingBar() if (tonumber(createPercent) >= 100) then removeEventHandler("onClientRender", root, drawStaticBar) removeEventHandler("onClientRender", root, drawLoadingBar) showCursor(false) guiSetInputEnabled(false) else dxDrawRectangle((sx/2)-261, (sy/2)-12, tonumber(createPercent)*5.22, 25.0, tocolor(0,0,235,255), true) end dxDrawBorderedText("Creating... "..tostring(createPercent).."%", (sx/2)-145, (sy/2)-15, (sy/2)-1, (sx/2)-5, tocolor(0,255,0,255),1.0,"bankgothic","left","top",false,false,true) end
  12. it's perfect after editing expect 1 thing i can't see the progress bar :#
  13. |1| ')' expected near '31' |2| '<eof>' expected near 'else' |3| '<eof>' expected near 'end' |4| '<eof>' expected near 'end' |5| unexpected symbol near ')' Here you are :3
  14. when i learn to make M4 then i will know how to make the rest ":3 this part has a lot of bugs in debugscript log not working
  15. the progress bar didn't get shown also i didn't get the weapon .it takes the money only .
  16. this isn't about the hud and radar ,it's about the Button and the Progress bar.
  17. actually the part of the hiding has worked instead of the progress bar if you have even edited it ?
  18. i will explain deeper than this.when i press the button the progress bar start counting when it's done of counting i want it to give the player his weapon.(HUD and RADAR when he hits the marker and leave it only )
  19. well ,when i press the button the ( setTimer should work but it isn't ,i want to make it work while the progress bar is counting ,get it ?
  20. well thanks ,but i want the progress bar in the first place :3
  21. i have scripting a illegal weapon factory marker but i want to show a loading progress while creating a weapon ,i have scripted it and i have checked the debugscript log and there isn't something wrong ,also i wanna hide the hud and the radar --client cwm = createMarker( 1983.65601, -2413.86963, 12.54688, "cylinder", 2, 150, 0, 75, 255 ) --this creates the marker GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Window[1] = guiCreateWindow(0.2726,0.3275,0.3186,0.4537,"(Weapon Factory)",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Memo[1] = guiCreateMemo(151,51,199,46,"On button click you will w\nait for 20 second to create M4",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(151,99,202,46,"On button click you will wait for 20 second to create AK-47",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Button[1] = guiCreateButton(16,59,130,41,"100M4 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(15,105,130,41,"100AK-47 for 150$",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(17,152,130,41,"18 Gernades for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[3] = guiCreateMemo(150,148,202,46,"On button click you will wait for 20 second to create Gernade",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Memo[4] = guiCreateMemo(150,195,202,46,"On button click you will wait for 20 second to create Rifle",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[4],true) GUIEditor_Button[4] = guiCreateButton(17,197,130,41,"75 Rifle for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[5] = guiCreateMemo(150,243,202,46,"On button click you will wait for 20 second to create Sniper",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[5],true) GUIEditor_Button[5] = guiCreateButton(18,246,130,41,"75 Sniper for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[6] = guiCreateMemo(151,290,202,46,"On button click you will wait for 20 second to create UZI",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[6],true) GUIEditor_Button[6] = guiCreateButton(20,293,130,41,"200 UZI for 150$",false,GUIEditor_Window[1]) GUIEditor_Memo[7] = guiCreateMemo(150,337,202,46,"On button click you will wait for 20 second to create C.shotgun",false,GUIEditor_Window[1]) GUIEditor_Button[7] = guiCreateButton(18,340,130,41,"200 C.shotgun for 150$",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(24,30,324,20,"Regards,(T-RPG)ProMax",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],150,0,150) GUIEditor_Button[11] = guiCreateButton(298,20,55,26,"Close",false,GUIEditor_Window[1]) --creates the GUI function ToggleCWMMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == "onClientMarkerHit" then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) showChat ( false ) showHud ( false ) showRadar ( false ) elseif eventName == "onClientMarkerLeave" then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showHud ( true ) showRadar ( true ) -- shows the chat and i don't know what about the hud end end end addEventHandler("onClientMarkerHit",cwm,ToggleCWMMenu) addEventHandler("onClientMarkerLeave",cwm,ToggleCWMMenu) addEventHandler ('onClientGUIClick',GUIEditor_Button[11], -- that was the closing button function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) showRadar ( true ) showHud ( true ) end,false ) --rest of buttons addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function () guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) showChat ( true ) triggerServerEvent ("GiveM4",localPlayer) end,false ) --then the second part function drawStaticBar() dxDrawRectangle((sx/2)-270, (sy/2)-22, 540.0, 44.0, tocolor(255,197,0,150), false) dxDrawRectangle((sx/2)-265, (sy/2)-16, 530.0, 33.0, tocolor(0,0,0,250), false) end function drawLoadingBar() if (tonumber(createPercent) >= 100) then removeEventHandler("onClientRender", root, drawStaticBar) removeEventHandler("onClientRender", root, drawLoadingBar) showCursor(false) guiSetInputEnabled(false) else dxDrawRectangle((sx/2)-261, (sy/2)-12, tonumber(createPercent)*5.22, 25.0, tocolor(0,0,235,255), true) end dxDrawBorderedText("Creating... "..tostring(createPercent).."%", (sx/2)-145, (sy/2)-15, (sy/2)-1, (sx/2)-5, tocolor(0,255,0,255),1.0,"bankgothic","left","top",false,false,true) end addEvent("creating",true) addEventHandler("creating",root, function (weaponName) name = tostring(weaponName) if isTimer(createTimer) then killTimer(createTimer) end trainPercent = 0 showCursor(true) guiSetInputEnabled(true) trainTimer = setTimer(function () createPercent = createPercent +1 end, 100, 100) addEventHandler("onClientRender",getRootElement(),drawLoadingBar) addEventHandler("onClientRender",getRootElement(),drawStaticBar) end) --Server -- starting with the Event that i tiggered in the Client side addEvent ('GiveM4',true) addEventHandler ('GiveM4',root, -- then i don;t know what to do:3 function () if not getPlayerTeam(source) or getPlayerTeam(source) ~= getTeamFromName("Criminal") then return outputChatBox( 'You are not a criminal to create weapons',source,255,0,0 ) end if getPlayerMoney(source) or getPlayerMoney(source) >= 150 then triggerClientEvent(player,"creating",player,weaponName) setTimer( function () giveWeapon(client,31,100) end,false ,1000,1,client ) takePlayerMoney(client,150) else outputChatBox('You do not have enough money to create this weapon', 255, 0, 0 ) end end ) please answer as soon as possible ,I am on fire :3.
  22. اللي بيخلي الكريمنال تيم هو بس اللي يستعمل الماركر انا كل مرة بحط ال فنشن الماركر بتختفي ممكن حد يعدل السكريبت ويخلي التيم اللي انا عملتو هو بس اللي يستعمل الماركر -- Client local marker = createMarker ( 1616.44446,-1506.94568,13.20866,"cylinder",1,255,0,0,0 ) local ped = createPed ( 28,1616.44446, -1506.94568, 14.2066,90,0,0 ) setElementFrozen( ped,true ) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(0.3698,0.5208,0.2517,0.1863,"\"Drug Delivery Request\"",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(29,114,92,31,"Cancel",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(158,114,92,31,"Accept",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(11,26,264,79,"If you Pressed \"Accept\"Follow The Blip in the radar and you will gain 10000$ .If you Pressed Cancel or Leaved the Vehicle in the Delivery then your mission failed.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) function ToggleDDMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == 'onClientMarkerHit' then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) elseif eventName == 'onClientMarkerLeave' then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end end end addEventHandler("onClientMarkerHit",marker,ToggleDDMenu) addEventHandler("onClientMarkerLeave",marker,ToggleDDMenu) addEventHandler("onClientRender", getRootElement(), function() local x, y, z = getElementPosition(ped) local x2, y2, z2 = getElementPosition(localPlayer) if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then local sx, sy = getScreenFromWorldPosition(x, y, z+1.1) if(sx) and (sy) then local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distance < 30) then dxDrawText("Drugs Dealer", sx+2, sy+2, sx, sy, tocolor(0,0,0), 2-(distance/20), "arial", "center", "center") dxDrawText("Drugs Dealer", sx, sy, sx, sy, tocolor(255,0,0), 2-(distance/20), "arial", "center", "center") end end end end ) addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end,false ) addEventHandler ('onClientGUIClick',GUIEditor_Button[2], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) triggerServerEvent ("MyEvent",localPlayer) end,false ) addEventHandler ( 'onClientPedDamage',ped,cancelEvent ) addEvent("dshow",true) addEventHandler("dshow",marker, function () guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) if getPlayerTeam = ( Criminals ) then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) elseif outPutChatBox("You Aren't a criminal to deliver drugs",150,0,0) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end end end ) -- Server Side local criminalsTeam = createTeam("Criminals",150,0,0) local newVehicle = { } local myBlip = { } local marker = { } addEvent('MyEvent',true) addEventHandler('MyEvent',root, function ( ) if newVehicle [ source ] and isElement ( newVehicle [ source ] ) then return false end newVehicle [ source ] = createVehicle ( 413,1603.34717,-1459.95898,13.68424 ) warpPedIntoVehicle ( source,newVehicle [ source ] ) myBlip [ source ] = createBlip( 1019.93677,2373.41040,10.93885,51,2,255,0,0,255,0 ) setElementVisibleTo( myBlip [ source ],root,false ) setElementVisibleTo( myBlip [ source ],source,true ) marker [ source ] = createMarker ( 1019.93677,2373.41040,9.93885,'cylinder',2,0,255,0,255,source ) end ) addEventHandler ( 'onMarkerHit',resourceRoot, function ( hit ) if ( hit and getElementType ( hit ) == 'vehicle' ) then local player = getVehicleController ( hit ) if ( source == marker [ player ] )then if isElement ( newVehicle [ player ] ) then if ( hit == newVehicle [ player ] ) then destroyElement ( newVehicle [ player ] ) destroyElement ( myBlip [ player ] ) destroyElement ( marker [ player ] ) newVehicle [ player ] = nil myBlip [ player ] = nil marker [ player ] = nil givePlayerMoney ( player,10000 ) end end end end end ) addEventHandler ( 'onPlayerVehicleExit',root, function ( vehicle ) if ( vehicle == newVehicle [ source ] ) then if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end end ) addEventHandler ( 'onPlayerQuit',root, function ( ) if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end ) function tiggerClientEvent( thePlayer,"dshow",thePlayer,root ) end شكرا
  23. i made it like this -- Server Side local criminalsTeam = createTeam("Criminals",150,0,0) local newVehicle = { } local myBlip = { } local marker = { } addEvent('MyEvent',true) addEventHandler('MyEvent',root, function ( ) if newVehicle [ source ] and isElement ( newVehicle [ source ] ) then return false end newVehicle [ source ] = createVehicle ( 413,1603.34717,-1459.95898,13.68424 ) warpPedIntoVehicle ( source,newVehicle [ source ] ) myBlip [ source ] = createBlip( 1019.93677,2373.41040,10.93885,51,2,255,0,0,255,0 ) setElementVisibleTo( myBlip [ source ],root,false ) setElementVisibleTo( myBlip [ source ],source,true ) marker [ source ] = createMarker ( 1019.93677,2373.41040,9.93885,'cylinder',2,0,255,0,255,source ) end ) addEventHandler ( 'onMarkerHit',resourceRoot, function ( hit ) if ( hit and getElementType ( hit ) == 'vehicle' ) then local player = getVehicleController ( hit ) if ( source == marker [ player ] )then if isElement ( newVehicle [ player ] ) then if ( hit == newVehicle [ player ] ) then destroyElement ( newVehicle [ player ] ) destroyElement ( myBlip [ player ] ) destroyElement ( marker [ player ] ) newVehicle [ player ] = nil myBlip [ player ] = nil marker [ player ] = nil givePlayerMoney ( player,10000 ) end end end end end ) addEventHandler ( 'onPlayerVehicleExit',root, function ( vehicle ) if ( vehicle == newVehicle [ source ] ) then if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end end ) addEventHandler ( 'onPlayerQuit',root, function ( ) if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end ) function local allowteam = getTeamFromName("Criminals") tiggerClientEvent( thePlayer,"dshow",thePlayer,root ) end -- Client local marker = createMarker ( 1616.44446,-1506.94568,13.20866,"cylinder",1,255,0,0,0 ) local ped = createPed ( 28,1616.44446, -1506.94568, 14.2066,90,0,0 ) setElementFrozen( ped,true ) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(0.3698,0.5208,0.2517,0.1863,"\"Drug Delivery Request\"",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(29,114,92,31,"Cancel",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(158,114,92,31,"Accept",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(11,26,264,79,"If you Pressed \"Accept\"Follow The Blip in the radar and you will gain 10000$ .If you Pressed Cancel or Leaved the Vehicle in the Delivery then your mission failed.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) function ToggleDDMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == 'onClientMarkerHit' then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) elseif eventName == 'onClientMarkerLeave' then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end end end addEventHandler("onClientMarkerHit",marker,ToggleDDMenu) addEventHandler("onClientMarkerLeave",marker,ToggleDDMenu) addEventHandler("onClientRender", getRootElement(), function() local x, y, z = getElementPosition(ped) local x2, y2, z2 = getElementPosition(localPlayer) if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then local sx, sy = getScreenFromWorldPosition(x, y, z+1.1) if(sx) and (sy) then local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distance < 30) then dxDrawText("Drugs Dealer", sx+2, sy+2, sx, sy, tocolor(0,0,0), 2-(distance/20), "arial", "center", "center") dxDrawText("Drugs Dealer", sx, sy, sx, sy, tocolor(255,0,0), 2-(distance/20), "arial", "center", "center") end end end end ) addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end,false ) addEventHandler ('onClientGUIClick',GUIEditor_Button[2], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) triggerServerEvent ("MyEvent",localPlayer) end,false ) addEventHandler ( 'onClientPedDamage',ped,cancelEvent ) addEvent("dshow",true) addEventHandler("dshow",marker, function dontshow guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) if getPlayerTeam = ( Criminals ) then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) else outPutChatBox("You Aren't a criminal to deliver drugs",150,0,0) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end end end ) i still can't see the markers ,can you edit it to work?
  24. hi all i have made a simple script but i have added a part to the script which allows only a team to use this marker but i can't see the marker ,here you are the script : -- Server Side local criminalsTeam = createTeam("Criminals",150,0,0) local newVehicle = { } local myBlip = { } local marker = { } addEvent('MyEvent',true) addEventHandler('MyEvent',root, function ( ) if newVehicle [ source ] and isElement ( newVehicle [ source ] ) then return false end newVehicle [ source ] = createVehicle ( 413,1603.34717,-1459.95898,13.68424 ) warpPedIntoVehicle ( source,newVehicle [ source ] ) myBlip [ source ] = createBlip( 1019.93677,2373.41040,10.93885,51,2,255,0,0,255,0 ) setElementVisibleTo( myBlip [ source ],root,false ) setElementVisibleTo( myBlip [ source ],source,true ) marker [ source ] = createMarker ( 1019.93677,2373.41040,9.93885,'cylinder',2,0,255,0,255,source ) end ) addEventHandler ( 'onMarkerHit',resourceRoot, function ( hit ) if ( hit and getElementType ( hit ) == 'vehicle' ) then local player = getVehicleController ( hit ) if ( source == marker [ player ] )then if isElement ( newVehicle [ player ] ) then if ( hit == newVehicle [ player ] ) then destroyElement ( newVehicle [ player ] ) destroyElement ( myBlip [ player ] ) destroyElement ( marker [ player ] ) newVehicle [ player ] = nil myBlip [ player ] = nil marker [ player ] = nil givePlayerMoney ( player,10000 ) end end end end end ) addEventHandler ( 'onPlayerVehicleExit',root, function ( vehicle ) if ( vehicle == newVehicle [ source ] ) then if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end end ) addEventHandler ( 'onPlayerQuit',root, function ( ) if isElement ( newVehicle [ source ] ) then destroyElement( newVehicle [ source ] ) newVehicle [ source ] = nil end if isElement ( myBlip [ source ] ) then destroyElement( myBlip [ source ] ) myBlip [ source ] = nil end if isElement ( marker [ source ] ) then destroyElement( marker [ source ] ) marker [ source ] = nil end end ) function local allowteam = getTeamFromName("Criminals") if (allowteam) then tiggerClientEvent( thePlayer,"show",thePlayer,root ) else then tiggerClientEvent( thePlayer,"dshow",thePlayer,root ) end Client: -- Client local marker = createMarker ( 1616.44446,-1506.94568,13.20866,"cylinder",1,255,0,0,0 ) local ped = createPed ( 28,1616.44446, -1506.94568, 14.2066,90,0,0 ) setElementFrozen( ped,true ) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(0.3698,0.5208,0.2517,0.1863,"\"Drug Delivery Request\"",true) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) guiSetAlpha(GUIEditor_Window[1],1) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Button[1] = guiCreateButton(29,114,92,31,"Cancel",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(158,114,92,31,"Accept",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(11,26,264,79,"If you Pressed \"Accept\"Follow The Blip in the radar and you will gain 10000$ .If you Pressed Cancel or Leaved the Vehicle in the Delivery then your mission failed.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) addEvent( "show",true ) addEventHandler("show",marker, function ToggleDDMenu ( hit ) if ( hit and hit == localPlayer ) then if eventName == 'onClientMarkerHit' then guiSetVisible ( GUIEditor_Window[1],true ) showCursor ( true ) elseif eventName == 'onClientMarkerLeave' then guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end end end addEventHandler("onClientMarkerHit",marker,ToggleDDMenu) addEventHandler("onClientMarkerLeave",marker,ToggleDDMenu) addEventHandler("onClientRender", getRootElement(), function() local x, y, z = getElementPosition(ped) local x2, y2, z2 = getElementPosition(localPlayer) if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then local sx, sy = getScreenFromWorldPosition(x, y, z+1.1) if(sx) and (sy) then local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distance < 30) then dxDrawText("Drugs Dealer", sx+2, sy+2, sx, sy, tocolor(0,0,0), 2-(distance/20), "arial", "center", "center") dxDrawText("Drugs Dealer", sx, sy, sx, sy, tocolor(255,0,0), 2-(distance/20), "arial", "center", "center") end end end end ) addEventHandler ('onClientGUIClick',GUIEditor_Button[1], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) end,false ) addEventHandler ('onClientGUIClick',GUIEditor_Button[2], function ( ) guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) triggerServerEvent ("MyEvent",localPlayer) end,false ) addEventHandler ( 'onClientPedDamage',ped,cancelEvent ) addEvent("dshow",true) addEventHandler("dshow",marker, function dontshow guiSetVisible ( GUIEditor_Window[1],false ) showCursor ( false ) outPutChatBox("You Aren't a criminal to deliver drugs",150,0,0) end end end ) please answer as soon as possible ,thank you.
×
×
  • Create New...