Jump to content

...


Recommended Posts

ابي حل لهاذا الكود المنوب

  
كلينت 
GUIEditor = { 
    window = {}, 
    radiobutton = {} 
} 
GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
  
GUIEditor.radiobutton[1] = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[1], "NormalTextColour", "FF882BD0") 
GUIEditor.radiobutton[2] = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[2], "NormalTextColour", "FF0DEF0D") 
GUIEditor.radiobutton[3] = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[3], "NormalTextColour", "FFE95014") 
GUIEditor.radiobutton[4] = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[4], "NormalTextColour", "FF0813F6") 
  
function narotu() 
    if guiGetVisible(GUIEditor.window[1]) == false then 
        guiSetVisible(GUIEditor.window[1],true) 
        showCursor(true) 
    else 
        guiSetVisible(GUIEditor.window[1],false) 
        showCursor(false) 
    end 
end 
bindKey("F2","down",narotu) 
  
  
    if localPlayer == player then    
if guiRadioButtonSetSelected(GUIEditor.radiobutton[1], true) then  
triggerServerEvent('narotu', localPlayer) 
elseif guiRadioButtonSetSelected(GUIEditor.radiobutton[2], true) then 
triggerServerEvent('billal', localPlayer) 
end  
end 

  
سيرفر 
addEvent ('onPlayerSpawn',true) 
addEventHandler  ('onPlayerSpawn',root, 
function(narotu) 
  
    setTimer(setElementPosition, 500, 1, source,931.78,1564.12,16.96) 
    end       
 ) 
     
    addEvent ('onPlayerSpawn',true) 
addEventHandler  ('onPlayerSpawn',root, 
function(billal) 
    setTimer(setElementPosition, 500, 1, source,800.78,1564.12,16.96) 
 end 
 ) 

:mrgreen:

Edited by Guest
Link to comment

تقدر تسويها بجدول وتريح راسك

عموماً تفضل

Client

GUIEditor = { window = {}, radiobutton = {} } 
  
addEventHandler ( "onClientResourceStart", resourceRoot, function (    ) 
    GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) 
    guiWindowSetSizable(GUIEditor.window[1], false) 
    guiSetVisible(GUIEditor.window[1], false) 
    GUIEditor.radiobutton[1] = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) 
    guiSetProperty(GUIEditor.radiobutton[1], "NormalTextColour", "FF882BD0") 
    GUIEditor.radiobutton[2] = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) 
    guiSetProperty(GUIEditor.radiobutton[2], "NormalTextColour", "FF0DEF0D") 
    GUIEditor.radiobutton[3] = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) 
    guiSetProperty(GUIEditor.radiobutton[3], "NormalTextColour", "FFE95014") 
    GUIEditor.radiobutton[4] = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) 
    guiSetProperty(GUIEditor.radiobutton[4], "NormalTextColour", "FF0813F6") 
end ) 
  
bindKey ( "F2", "down", function (   ) 
      guiSetVisible ( GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) 
      showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) 
end ) 
  
addEventHandler ( "onClientGUIClick", resourceRoot, 
function (    ) 
    if ( guiRadioButtonGetSelected ( GUIEditor.radiobutton[1] ) == true ) then 
        triggerServerEvent ( "narotu", localPlayer ) 
elseif ( guiRadioButtonSetSelected ( GUIEditor.radiobutton[2] ) == true ) then 
        triggerServerEvent ( "billal", localPlayer ) 
        -- كمل الباقي نفس الطريقه 
    end 
end ) 

Server

addEvent ( "narotu",true ) 
addEventHandler  ( "narotu", root, 
function (    ) 
    setElementPosition ( source, 931.78, 1564.12, 16.96 ) 
end ) 
  
addEvent ( "billal",true ) 
addEventHandler  ( "billal", root, 
function (    ) 
    setElementPosition ( source, 800.78, 1564.12, 16.96 ) 
end ) 
Link to comment
تقدر تسويها بجدول وتريح راسك

عموماً تفضل

Client

GUIEditor = { window = {}, radiobutton = {} } 
  
addEventHandler ( "onClientResourceStart", resourceRoot, function (    ) 
    GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) 
    guiWindowSetSizable(GUIEditor.window[1], false) 
    guiSetVisible(GUIEditor.window[1], false) 
    GUIEditor.radiobutton[1] = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) 
    guiSetProperty(GUIEditor.radiobutton[1], "NormalTextColour", "FF882BD0") 
    GUIEditor.radiobutton[2] = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) 
    guiSetProperty(GUIEditor.radiobutton[2], "NormalTextColour", "FF0DEF0D") 
    GUIEditor.radiobutton[3] = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) 
    guiSetProperty(GUIEditor.radiobutton[3], "NormalTextColour", "FFE95014") 
    GUIEditor.radiobutton[4] = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) 
    guiSetProperty(GUIEditor.radiobutton[4], "NormalTextColour", "FF0813F6") 
end ) 
  
bindKey ( "F2", "down", function (   ) 
      guiSetVisible ( GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) 
      showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) 
end ) 
  
addEventHandler ( "onClientGUIClick", resourceRoot, 
function (    ) 
    if ( guiRadioButtonGetSelected ( GUIEditor.radiobutton[1] ) == true ) then 
        triggerServerEvent ( "narotu", localPlayer ) 
elseif ( guiRadioButtonSetSelected ( GUIEditor.radiobutton[2] ) == true ) then 
        triggerServerEvent ( "billal", localPlayer ) 
        -- كمل الباقي نفس الطريقه 
    end 
end ) 

Server

addEvent ( "narotu",true ) 
addEventHandler  ( "narotu", root, 
function (    ) 
    setElementPosition ( source, 931.78, 1564.12, 16.96 ) 
end ) 
  
addEvent ( "billal",true ) 
addEventHandler  ( "billal", root, 
function (    ) 
    setElementPosition ( source, 800.78, 1564.12, 16.96 ) 
end ) 

لا ليس هاذا ما اريد

انا لا اريد لوحة انتقال فتصميم لوحة الانتقالات سهلة جدا

انا اريد اختار في اللوحة المكان اللي ارسن اليه لما اموت

اتمنى تفهموني

:evil:

Link to comment

GUIEditor = { 
    window = {}, 
    radiobutton = {} 
} 
GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
 guiSetVisible(GUIEditor.window[1],false) 
mshfa = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) 
guiSetProperty(mshfa, "NormalTextColour", "FF882BD0") 
mkr = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) 
guiSetProperty(mkr, "NormalTextColour", "FF0DEF0D") 
bet = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) 
guiSetProperty(bet, "NormalTextColour", "FFE95014") 
mrkz = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) 
guiSetProperty(mrkz, "NormalTextColour", "FF0813F6") 
  
function narotu() 
guiSetVisible (GUIEditor.window[1],not guiGetVisible (GUIEditor.window[1])) 
guiSetInputEnabled(guiGetVisible(GUIEditor.window[1])) 
showCursor (guiGetVisible(GUIEditor.window[1])) 
end 
bindKey("F2","down",narotu) 
  
addEventHandler ("onClientGUIClick",root, 
function () 
if source == mshfa then 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (bet,false) 
guiRadioButtonSetSelected (mrkz,false) 
triggerServerEvent ("sMshfa",localPlayer) 
elseif source == mkr then 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (bet,false) 
guiRadioButtonSetSelected (mrkz,false) 
triggerServerEvent ("sMkr",localPlayer) 
elseif source == bet then 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (mrkz,false) 
-- مش عندي معرفة في مود بيوتك 
elseif source == mrkz then 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (bet,false) 
triggerServerEvent ("sMrkz",localPlayer) 
end 
end) 
  

DTC12 = { 
groupName = "x,y,z", 
narutosGroup = "x,y,z", 
ok = "1,2,3", 
} 
 -- * ملحوظة : غير مجرب 
  
function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) 
if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then 
local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) 
if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then 
for i, v in ipairs( aAttachedFunctions ) do 
if v == func then 
return true 
end 
end 
end 
end 
return false 
end 
  
addEvent ("sMshfa",true) 
addEventHandler ("sMshfa",root, 
function () 
s = source 
function spawnToHos() 
setTimer(setElementPosition,5000,1,source,x,y,z) -- احداثياتك للمشفي 
end 
if not isEventHandlerAdded("onPlayerSpawn",s,spawnToHos) then 
addEventHandler ("onPlayerSpawn",s,spawnToHos) 
end 
end) 
  
addEvent ("sMrkz",true) 
addEventHandler ("sMrkz",root, 
function () 
d = source 
function spawnToCen() 
setTimer(setElementPosition,5000,1,source,x,y,z) -- احداثياتك للمركز 
end 
if not isEventHandlerAdded("onPlayerSpawn",d,spawnToCen) then addEventHandler ("onPlayerSpawn",d,spawnToCen) end 
end) 
  
lol={} 
addEvent ("sMkr",true) addEventHandler ("sMkr",root, 
function () 
x = source  
function spawnToBase() 
if not getElementData (x,"Group") then outputChatBox ("انت لست في مجموعة",x,255,5,5) end 
for i,k in pairs (DTC12) do 
if tostring(getElementData(x,"Group")) == tostring(i) then 
if not isTimer (lol[x]) then 
lol[x] = setTimer(setElementPosition,5000,1,source,k) 
end 
end 
end 
end 
if not isEventHandlerAdded("onPlayerSpawn",x,spawnToBase) then addEventHandler ("onPlayerSpawn",x,spawnToBase) end 
end) 
Link to comment
GUIEditor = { 
    window = {}, 
    radiobutton = {} 
} 
GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
 guiSetVisible(GUIEditor.window[1],false) 
mshfa = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) 
guiSetProperty(mshfa, "NormalTextColour", "FF882BD0") 
mkr = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) 
guiSetProperty(mkr, "NormalTextColour", "FF0DEF0D") 
bet = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) 
guiSetProperty(bet, "NormalTextColour", "FFE95014") 
mrkz = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) 
guiSetProperty(mrkz, "NormalTextColour", "FF0813F6") 
  
function narotu() 
guiSetVisible (GUIEditor.window[1],not guiGetVisible (GUIEditor.window[1])) 
guiSetInputEnabled(guiGetVisible(GUIEditor.window[1])) 
showCursor (guiGetVisible(GUIEditor.window[1])) 
end 
bindKey("F2","down",narotu) 
  
addEventHandler ("onClientGUIClick",root, 
function () 
if source == mshfa then 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (bet,false) 
guiRadioButtonSetSelected (mrkz,false) 
triggerServerEvent ("sMshfa",localPlayer) 
elseif source == mkr then 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (bet,false) 
guiRadioButtonSetSelected (mrkz,false) 
triggerServerEvent ("sMkr",localPlayer) 
elseif source == bet then 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (mrkz,false) 
-- مش عندي معرفة في مود بيوتك 
elseif source == mrkz then 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (bet,false) 
triggerServerEvent ("sMrkz",localPlayer) 
end 
end) 
  

DTC12 = { 
groupName = "x,y,z", 
narutosGroup = "x,y,z", 
ok = "1,2,3", 
} 
 -- * ملحوظة : غير مجرب 
  
function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) 
if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then 
local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) 
if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then 
for i, v in ipairs( aAttachedFunctions ) do 
if v == func then 
return true 
end 
end 
end 
end 
return false 
end 
  
addEvent ("sMshfa",true) 
addEventHandler ("sMshfa",root, 
function () 
s = source 
function spawnToHos() 
setTimer(setElementPosition,5000,1,source,x,y,z) -- احداثياتك للمشفي 
end 
if not isEventHandlerAdded("onPlayerSpawn",s,spawnToHos) then 
addEventHandler ("onPlayerSpawn",s,spawnToHos) 
end 
end) 
  
addEvent ("sMrkz",true) 
addEventHandler ("sMrkz",root, 
function () 
d = source 
function spawnToCen() 
setTimer(setElementPosition,5000,1,source,x,y,z) -- احداثياتك للمركز 
end 
if not isEventHandlerAdded("onPlayerSpawn",d,spawnToCen) then addEventHandler ("onPlayerSpawn",d,spawnToCen) end 
end) 
  
lol={} 
addEvent ("sMkr",true) addEventHandler ("sMkr",root, 
function () 
x = source  
function spawnToBase() 
if not getElementData (x,"Group") then outputChatBox ("انت لست في مجموعة",x,255,5,5) end 
for i,k in pairs (DTC12) do 
if tostring(getElementData(x,"Group")) == tostring(i) then 
if not isTimer (lol[x]) then 
lol[x] = setTimer(setElementPosition,5000,1,source,k) 
end 
end 
end 
end 
if not isEventHandlerAdded("onPlayerSpawn",x,spawnToBase) then addEventHandler ("onPlayerSpawn",x,spawnToBase) end 
end) 

شكرا عمل رائع

لم يعمل كما اردت بالضبط لكني استفدت كثيرا اضن انني الحين اقدر اعدل علىيه شوية يمكن انجح

Link to comment
GUIEditor = { 
    window = {}, 
    radiobutton = {} 
} 
GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
 guiSetVisible(GUIEditor.window[1],false) 
mshfa = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) 
guiSetProperty(mshfa, "NormalTextColour", "FF882BD0") 
mkr = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) 
guiSetProperty(mkr, "NormalTextColour", "FF0DEF0D") 
bet = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) 
guiSetProperty(bet, "NormalTextColour", "FFE95014") 
mrkz = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) 
guiSetProperty(mrkz, "NormalTextColour", "FF0813F6") 
  
function narotu() 
guiSetVisible (GUIEditor.window[1],not guiGetVisible (GUIEditor.window[1])) 
guiSetInputEnabled(guiGetVisible(GUIEditor.window[1])) 
showCursor (guiGetVisible(GUIEditor.window[1])) 
end 
bindKey("F2","down",narotu) 
  
addEventHandler ("onClientGUIClick",root, 
function () 
if source == mshfa then 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (bet,false) 
guiRadioButtonSetSelected (mrkz,false) 
triggerServerEvent ("sMshfa",localPlayer) 
elseif source == mkr then 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (bet,false) 
guiRadioButtonSetSelected (mrkz,false) 
triggerServerEvent ("sMkr",localPlayer) 
elseif source == bet then 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (mrkz,false) 
-- مش عندي معرفة في مود بيوتك 
elseif source == mrkz then 
guiRadioButtonSetSelected (mshfa,false) 
guiRadioButtonSetSelected (mkr,false) 
guiRadioButtonSetSelected (bet,false) 
triggerServerEvent ("sMrkz",localPlayer) 
end 
end) 
  

DTC12 = { 
groupName = "x,y,z", 
narutosGroup = "x,y,z", 
ok = "1,2,3", 
} 
 -- * ملحوظة : غير مجرب 
  
function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) 
if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then 
local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) 
if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then 
for i, v in ipairs( aAttachedFunctions ) do 
if v == func then 
return true 
end 
end 
end 
end 
return false 
end 
  
addEvent ("sMshfa",true) 
addEventHandler ("sMshfa",root, 
function () 
s = source 
function spawnToHos() 
setTimer(setElementPosition,5000,1,source,x,y,z) -- احداثياتك للمشفي 
end 
if not isEventHandlerAdded("onPlayerSpawn",s,spawnToHos) then 
addEventHandler ("onPlayerSpawn",s,spawnToHos) 
end 
end) 
  
addEvent ("sMrkz",true) 
addEventHandler ("sMrkz",root, 
function () 
d = source 
function spawnToCen() 
setTimer(setElementPosition,5000,1,source,x,y,z) -- احداثياتك للمركز 
end 
if not isEventHandlerAdded("onPlayerSpawn",d,spawnToCen) then addEventHandler ("onPlayerSpawn",d,spawnToCen) end 
end) 
  
lol={} 
addEvent ("sMkr",true) addEventHandler ("sMkr",root, 
function () 
x = source  
function spawnToBase() 
if not getElementData (x,"Group") then outputChatBox ("انت لست في مجموعة",x,255,5,5) end 
for i,k in pairs (DTC12) do 
if tostring(getElementData(x,"Group")) == tostring(i) then 
if not isTimer (lol[x]) then 
lol[x] = setTimer(setElementPosition,5000,1,source,k) 
end 
end 
end 
end 
if not isEventHandlerAdded("onPlayerSpawn",x,spawnToBase) then addEventHandler ("onPlayerSpawn",x,spawnToBase) end 
end) 

شكرا عمل رائع

لم يعمل كما اردت بالضبط لكني استفدت كثيرا اضن انني الحين اقدر اعدل علىيه شوية يمكن انجح

جرب

  
DTC12 = { 
groupName = "x,y,z", 
narutosGroup = "x,y,z", 
ok = "1,2,3", 
} 
 -- * ملحوظة : غير مجرب 
  
function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) 
if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then 
local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) 
if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then 
for i, v in ipairs( aAttachedFunctions ) do 
if v == func then 
return true 
end 
end 
end 
end 
return false 
end 
  
addEvent ("sMshfa",true) 
addEventHandler ("sMshfa",root, 
function () 
s = source 
function spawnToHos() 
setTimer(setElementPosition,5000,1,source,x,y,z) -- احداثياتك للمشفي 
end 
if not isEventHandlerAdded("onPlayerSpawn",s,spawnToHos) then 
addEventHandler ("onPlayerSpawn",s,spawnToHos) 
end 
end) 
  
addEvent ("sMrkz",true) 
addEventHandler ("sMrkz",root, 
function () 
d = source 
function spawnToCen() 
setTimer(setElementPosition,5000,1,source,x,y,z) -- احداثياتك للمركز 
end 
if not isEventHandlerAdded("onPlayerSpawn",d,spawnToCen) then addEventHandler ("onPlayerSpawn",d,spawnToCen) end 
end) 
  
lol={} 
addEvent ("sMkr",true) addEventHandler ("sMkr",root, 
function () 
x = source  
function spawnToBase() 
if not getElementData (x,"Group") then outputChatBox ("انت لست في مجموعة",x,255,5,5) end 
for i,k in pairs (DTC12) do 
if tostring(getElementData(x,"Group")) == tostring(i) then 
if not isTimer (lol[x]) then 
local naruto = split (k,",") 
local xx,y,z = naruto[1],naruto[2],naruto[3] 
lol[x] = setTimer(function () 
setElementPosition (x,xx,y,z) 
end,5000,1) 
end 
end 
end 
end 
if not isEventHandlerAdded("onPlayerSpawn",x,spawnToBase) then addEventHandler ("onPlayerSpawn",x,spawnToBase) end 
end) 
Link to comment
لو تبي لكل اللاعبين فى طريقه اسهل

المشفى لكل اللاعبين

مركز الشرطة للشرطين فقط

المقر كل قروب مقر خاص

البيت كل لاعب بيته الخاص

الامر معقد شوية

Link to comment

سهل جداً ياراجل :D

بس اعذرنيي عشان بعد 20 دقيقة بالظبط هاقفل الكمبيوتر عشان ورايا امتحانات لازم اخف شوية من الكمبيوتر

حاول و اطرح محاولتك بسرعة

Link to comment

GUIEditor = { 
window = {}, 
radiobutton = {}} 
GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
  
GUIEditor.radiobutton[1] = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[1], "NormalTextColour", "FF882BD0") 
GUIEditor.radiobutton[2] = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[2], "NormalTextColour", "FF0DEF0D") 
GUIEditor.radiobutton[3] = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[3], "NormalTextColour", "FFE95014") 
GUIEditor.radiobutton[4] = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[4], "NormalTextColour", "FF0813F6") 
      
function narotu() 
if guiGetVisible(GUIEditor.window[1]) == false then 
guiSetVisible(GUIEditor.window[1],true) 
showCursor(true) 
else 
guiSetVisible(GUIEditor.window[1],false) 
showCursor(false) 
end 
end 
bindKey("F2","down",narotu) 
--/////////////////////////////////////////// 
-- تعديلك كله هنا حط الاحداثيات ورقم الانترو ورقم العالم واسم القروب 
-- Syntax  triggerServerEvent("spawn",localPlayer,x,y,z,interior,Dimension) 
-- x,y,z الاحداثيات 
-- interior رقم البيت 
-- Dimension رقم العالم 
--/////////////////////////////////////////// 
addEventHandler ("onClientGUIClick",root,function () 
if source == GUIEditor.radiobutton[1] then 
triggerServerEvent("spawn",localPlayer,1057,1402,6,0,0) -- المستشفى 
elseif source == GUIEditor.radiobutton[2] then 
if getElementData (localPlayer, "Group" ) == "army" then  --- غير اسم القروب الى قروبك 
triggerServerEvent("spawn",localPlayer,203,1911,18,0,0) -- مقر الجيش 
end 
elseif source == GUIEditor.radiobutton[3] then 
triggerServerEvent("spawn",localPlayer,2367,-1127,1051,8,0) -- البيت 
elseif source == GUIEditor.radiobutton[4] then 
if getElementData (localPlayer, "Group" ) == "police" then --- غير اسم القروب الى قروبك 
triggerServerEvent("spawn",localPlayer,1543,-1675,14,0,0) -- مركز الشرطه 
end 
end 
end) 

------ لاتعدل شئ هنا 
function spawn(Element,x,y,z,int,dim) 
setElementPosition (Element,x,y,z) 
setElementInterior(Element,int)  
setElementDimension (Element, dim ) 
end 
------ لاتعدل شئ هنا 
addEvent ( "spawn",true ) 
addEventHandler  ( "spawn", root,function (x,y,z,int,dim) 
setElementData (source,"x",x) 
setElementData (source,"y",y) 
setElementData (source,"z",z) 
setElementData (source,"int",int) 
setElementData (source,"dim",dim) 
spawn(source,x,y,z,int,dim) 
end) 
------ لاتعدل شئ هنا 
timer = {} 
addEventHandler ("onPlayerSpawn",root,function () 
local x,y,z,int,dim = getElementData (source,"x"),getElementData (source,"y"),getElementData (source,"z"), 
getElementData (source,"int"),getElementData (source,"dim") 
timer[source] = setTimer(spawn,1500, 1,source,x,y,z,int,dim) --- بس عدل ع الوقت حق الريسباون 
outputChatBox("Area: "..getZoneName ( x, y, z).." ("..getZoneName ( x, y, z, true )..")" ,source,190,0,0,true) 
end) 

بالنسبه للبيت سويه انت لاني مااعندي معلومات عنه وطريقته

Link to comment
GUIEditor = { 
window = {}, 
radiobutton = {}} 
GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
  
GUIEditor.radiobutton[1] = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[1], "NormalTextColour", "FF882BD0") 
GUIEditor.radiobutton[2] = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[2], "NormalTextColour", "FF0DEF0D") 
GUIEditor.radiobutton[3] = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[3], "NormalTextColour", "FFE95014") 
GUIEditor.radiobutton[4] = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.radiobutton[4], "NormalTextColour", "FF0813F6") 
      
function narotu() 
if guiGetVisible(GUIEditor.window[1]) == false then 
guiSetVisible(GUIEditor.window[1],true) 
showCursor(true) 
else 
guiSetVisible(GUIEditor.window[1],false) 
showCursor(false) 
end 
end 
bindKey("F2","down",narotu) 
--/////////////////////////////////////////// 
-- تعديلك كله هنا حط الاحداثيات ورقم الانترو ورقم العالم واسم القروب 
-- Syntax  triggerServerEvent("spawn",localPlayer,x,y,z,interior,Dimension) 
-- x,y,z الاحداثيات 
-- interior رقم البيت 
-- Dimension رقم العالم 
--/////////////////////////////////////////// 
addEventHandler ("onClientGUIClick",root,function () 
if source == GUIEditor.radiobutton[1] then 
triggerServerEvent("spawn",localPlayer,1057,1402,6,0,0) -- المستشفى 
elseif source == GUIEditor.radiobutton[2] then 
if getElementData (localPlayer, "Group" ) == "army" then  --- غير اسم القروب الى قروبك 
triggerServerEvent("spawn",localPlayer,203,1911,18,0,0) -- مقر الجيش 
end 
elseif source == GUIEditor.radiobutton[3] then 
triggerServerEvent("spawn",localPlayer,2367,-1127,1051,8,0) -- البيت 
elseif source == GUIEditor.radiobutton[4] then 
if getElementData (localPlayer, "Group" ) == "police" then --- غير اسم القروب الى قروبك 
triggerServerEvent("spawn",localPlayer,1543,-1675,14,0,0) -- مركز الشرطه 
end 
end 
end) 

------ لاتعدل شئ هنا 
function spawn(Element,x,y,z,int,dim) 
setElementPosition (Element,x,y,z) 
setElementInterior(Element,int)  
setElementDimension (Element, dim ) 
end 
------ لاتعدل شئ هنا 
addEvent ( "spawn",true ) 
addEventHandler  ( "spawn", root,function (x,y,z,int,dim) 
setElementData (source,"x",x) 
setElementData (source,"y",y) 
setElementData (source,"z",z) 
setElementData (source,"int",int) 
setElementData (source,"dim",dim) 
spawn(source,x,y,z,int,dim) 
end) 
------ لاتعدل شئ هنا 
timer = {} 
addEventHandler ("onPlayerSpawn",root,function () 
local x,y,z,int,dim = getElementData (source,"x"),getElementData (source,"y"),getElementData (source,"z"), 
getElementData (source,"int"),getElementData (source,"dim") 
timer[source] = setTimer(spawn,1500, 1,source,x,y,z,int,dim) --- بس عدل ع الوقت حق الريسباون 
outputChatBox("Area: "..getZoneName ( x, y, z).." ("..getZoneName ( x, y, z, true )..")" ,source,190,0,0,true) 
end) 

بالنسبه للبيت سويه انت لاني مااعندي معلومات عنه وطريقته

شكرا اوسكار لكن في مشكلة بالكود حقك

هو صحيح يرسن في الاحداثيات اللي تختارها كل ما يموت لكن المشكلة لما تختار من اللوحة يعمل انتقال

Link to comment
احذف سطر 15 سيرفر

حلو سفاح هيك مب مب ينتقل

ابي اعرف كيف اجيب الاحداثيات من مود تاني يعني

مثلا عندي مود مشفى كل مدينة حطيت فيها احداثيات لما لالاعب يموت يروح لمشفى المدينة اللي مات فيها

هل ينفع استعمل الكودexports

وكمان نفس الكود استعمل لكي يجيب احداثيات البيت من مود البيوت

الخ....

Link to comment

الصراحـة ما فهـمتك زين

أعتقـد قصـدك أنك تبي تجيب احداثيات من سكربت ثاني؟

عندك أكثر من طريقـة ومنـها الاكسـبورت سوي وظيفة جديدة بالسكربت الي فيه الاحداثيات

function getThePosition() 
   return x, y, z 
end 

x, y, z = احداثياتك

وطبعاً لازم نضيف بملف الميتا الوظيفة الي نبي نسوي لها اكسبورت من السكربت حقك

function="getThePosition" type="server"/> 

type="server" = "client" اذا كانت الوظيفـة بجـانب سيرفر اما اذا كانت كلنت فـيصير

ونروح للسكربت حقك ونسوي اكسبورت عشان نجيب الاحداثيات

x, y, z = exports.resourceName:getThePosition() 

resourceName = اسم السكربت الي سوينا فيه وظيفة إحضار الاحداثيات

Link to comment
سوي الاحداثيات مع المود نفسه افضل

او اطرح كود السباون حق المستشفي اسويها لك

-- C 
is_spawn_protected  = nil 
  
--[[ Get spawn protection ]]-- 
function set_spawn_protection(time_s) 
        is_spawn_protected = setTimer(function() end, time_s*1000, 1) 
end 
addEvent("GTWhospital.setSpawnProtection", true) 
addEventHandler("GTWhospital.setSpawnProtection", localPlayer, set_spawn_protection) 
  
--[[ Protect players from taking damage on spawn]]-- 
function protect_spawn(attacker, weapon, bodypart) 
    if not isTimer(is_spawn_protected) then return end 
    cancelEvent() 
end 
addEventHandler("onClientPlayerDamage", localPlayer, protect_spawn) 
  
--[[ Protect players from being choked upon spawn ]]-- 
function protect_spawn_choke(weaponID, responsiblePed) 
    if not isTimer(is_spawn_protected) then return end 
    cancelEvent() 
end 
addEventHandler("onClientPlayerChoke", localPlayer, protect_spawn_choke) 
  
--[[ Global spawn sound handler ]]-- 
function onSoundEvent(cmd, sound) 
        playSoundFrontEnd(tonumber(sound)) 
end 
addCommandHandler("sound", onSoundEvent) 

-- S 
timers          = { } 
awaiting_spawn      = { } 
weapon_list         = {{ }} 
ammo_list       = {{ }} 
  
-- List of available hospitals 
hs_table = {  -- x  y   z           rot view x          view y          view z 
    [1]={ 1177, -1320,  14.137756347656,    270,    1200.6923828125,    -1324.9873046875,   20.398437   }, 
    [2]={ -2666,    630,    13.567041397095,    180,    -2664.4501953125,   611.0771484375,     20.454549789429 }, 
    [3]={ 1607, 1818,   10.8203125,         0,  1607.3310546875,    1839.7470703125,    16.8203125  }, 
    [4]={ 2040,     -1420,  16.9921875,         90,     2031.8486328125,    -1419.5927734375,   22.9921875  }, 
    [5]={ -2200,    -2308,  30.625,         -45,    -2193.5888671875,   -2301.6630859375,   36.625      }, 
    [6]={ 208,  -65.3,  1.4357746839523,    180,    208.310546875,      -75.525390625,      7.4357746839523 }, 
    [7]={ 1245.8,   336.9,  19.40625,       -20,    1250.3759765625,    346.681640625,      25.40625    }, 
    [8]={ -317.4,   1056.4, 19.59375,       0,  -316.8125,      1066.306640625,     25.59375    }, 
    [9]={ -1514.8,  2527.9, 55.6875,        1.790,  -1514.283203125,    2536.412109375,     61.6875     }, 
} 
  
-- Cost of the healthcare 
hs_charge           = 500 
hs_respawn_time         = 10    -- Check GTWjail respawn times if you decide to change this value! 
hs_spawn_protection_time    = 20 
  
--[[ Load all the hospitals from the table ]]-- 
function load_hospitals() 
    for i=1, #hs_table do 
        createBlip(hs_table[i][1], hs_table[i][2], hs_table[i][3], 22, 1, 0, 0, 0, 255, 2, 180) 
        local h_marker = createMarker(hs_table[i][1], hs_table[i][2], hs_table[i][3]-1, "cylinder", 2, 0, 200, 0, 30) 
        addEventHandler("onMarkerHit", h_marker, hs_start_heal) 
        addEventHandler("onMarkerLeave", h_marker, hs_stop_heal) 
    end 
end 
addEventHandler("onResourceStart", resourceRoot, load_hospitals) 
  
--[[ Return the nearest hospital depending on a players location ]]-- 
function get_nearest_hospital(plr) 
    if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end 
    local n_loc,min = nil,9999 
    for k,v in ipairs(hs_table) do 
        -- Get the distance for each point 
        local px,py,pz=getElementPosition(plr) 
            local dist = getDistanceBetweenPoints2D(px,py,v[1],v[2]) 
  
        -- Update coordinates if distance is smaller 
        if dist < min then 
            n_loc = v 
            min = dist 
        end 
  
        -- 2015-03-01 Dead in interior? respawn at LS hospital 
        if getElementInterior(plr) > 0 then break end 
    end 
  
    -- Check if jailed or not and return either hospital or jail 
    local isJailed = exports.GTWjail:isJailed(thePlayer) 
    if not isJailed then 
        return n_loc[1]+math.random(-1,1),n_loc[2]+math.random(-1,1),n_loc[3],n_loc[4],n_loc[5],n_loc[6],n_loc[7] 
    else 
        return -2965+math.random(-5,5),2305+math.random(-5,5),9,270 
    end 
end 
  
--[[ Toggle controls for a player ]]-- 
function toggle_controls(plr, n_state) 
    if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end 
    toggleControl(plr, "jump", n_state) 
    toggleControl(plr, "sprint", n_state) 
        toggleControl(plr, "crouch", n_state) 
        toggleControl(plr, "fire", n_state) 
        toggleControl(plr, "aim_weapon", n_state) 
        toggleControl(plr, "enter_exit", n_state) 
        toggleControl(plr, "enter_passenger", n_state) 
        toggleControl(plr, "forwards", n_state) 
    toggleControl(plr, "walk", n_state) 
    toggleControl(plr, "backwards", n_state) 
    toggleControl(plr, "left", n_state) 
    toggleControl(plr, "right", n_state) 
    toggleControl(plr, "vehicle_fire", n_state) 
end 
  
--[[ Respawn after death "onPlayerSpawn" ]]-- 
function player_Spawn(x,y,z, r, team_name, skin_id, int,dim) 
    -- Check if a player is picked up by an ambulance 
    if not awaiting_spawn[source] then return end 
  
    -- Restore weapons 
    if weapon_list[source] and ammo_list[source] then 
        for k,wep in ipairs(weapon_list[source]) do 
            if weapon_list[source][k] and ammo_list[source][k] then 
                -- Return ammo to the player 
                giveWeapon(source, weapon_list[source][k], ammo_list[source][k], false) 
  
                -- Clean up used space 
                weapon_list[source][k] = nil 
                ammo_list[source][k] = nil 
            end 
        end 
    end 
  
    -- Check if jailed 
    local isJailed = exports.GTWjail:isJailed(source) 
    if isJailed then return end 
  
    -- Set camera view target 
    local x,y,z, r, vx,vy,vz = get_nearest_hospital(source) 
    setCameraMatrix(source, vx,vy,vz, x,y,z, 0,75) 
  
    -- Fade in the camera and set it's target 
    fadeCamera(source, true, 6,255,255,255) 
  
    -- Make sure the player is not frozen 
    setElementFrozen(source, false) 
    toggle_controls(source, false) 
    setTimer(finish_spawn, 8000, 1, source) 
  
    -- Set health to 30 
    setElementHealth(source, 30) 
  
    -- Reset ambulance data 
    awaiting_spawn[source] = nil 
  
    -- Infom the player about his respawn 
    exports.GTWtopbar:dm("Hospital: You have been healed at "..getZoneName(x,y,z)..", for a cost of $"..hs_charge, source, 255, 100, 0) 
end 
addEventHandler("onPlayerSpawn", root, player_Spawn) 
  
--[[ Helper function for spawn triggers and style ]]-- 
function finish_spawn(plr) 
    if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end 
    setCameraTarget(plr, plr) 
  
    -- Enable controls 
    toggle_controls(plr, true) 
  
    -- Play a spawn sound 
    playSoundFrontEnd(plr, 11) 
  
    -- Enable spawn protection 
    triggerClientEvent(plr, "GTWhospital.setSpawnProtection", plr, hs_spawn_protection_time) 
end 
  
--[[ On player wasted, fade out and send to hospital ]]-- 
function on_death(ammo, attacker, weapon, bodypart) 
    -- Save all weapons currently hold by a player 
    weapon_list[source]     = { 0,0,0,0,0,0,0,0,0,0,0,0 } 
    ammo_list[source]   = { 0,0,0,0,0,0,0,0,0,0,0,0 } 
  
    -- Check all weapon slots and save their ammo 
    for k,v in ipairs(weapon_list[source]) do 
        weapon_list[source][k] = getPedWeapon(source, k) 
        setPedWeaponSlot(source, k) 
        ammo_list[source][k] = getPedTotalAmmo(source, k) 
    end 
  
    -- Check if jailed or not 
    local isJailed = exports.GTWjail:isJailed(source) 
    if isJailed then return end 
  
    -- Make sure warp to hospital is possible 
    if getPedOccupiedVehicle(source) then removePedFromVehicle(source) end 
  
    -- Take some of the money 
    takePlayerMoney(source, hs_charge) 
    fadeCamera(source, false, 8, 0, 0, 0) 
  
    -- Respawn player after "hs_respawn_time" seconds 
    setTimer(plr_respawn, hs_respawn_time*1000, 1, source) 
  
    -- Add to respawn 
    awaiting_spawn[source] = true 
  
    -- Notify player about his death 
    exports.GTWtopbar:dm("Hospital: You are dead! an ambulance will pick you up soon", source, 255, 100, 0) 
end 
addEventHandler("onPlayerWasted", root, on_death) 
  
--[[ Helper function to spawn player ]]-- 
function plr_respawn(plr) 
    if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end 
    local x,y,z, r, vx,vy,vz = get_nearest_hospital(plr) 
    spawnPlayer(plr, x,y,z+1, r, getElementModel(plr), 0,0, getPlayerTeam(plr)) 
end 
  
--[[ Dump weapons into users database on quit ]]-- 
function dump_weapons() 
    -- Get player account 
    local acc = getPlayerAccount(source) 
  
    -- Reset ambulance data 
    awaiting_spawn[source] = nil 
  
    -- Check if there is any weapons in memory 
    if not weapon_list[source] then return end 
  
    -- Save the weapons and ammo stored in memory 
    for k,w in ipairs(weapon_list[source]) do 
        if weapon_list[source][k] and ammo_list[source][k] then 
            setAccountData(acc, "acorp.weapon."..tostring(k), weapon_list[source][k]) 
            setAccountData(acc, "acorp.ammo."..tostring(k), ammo_list[source][k]) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, dump_weapons) 
  
--[[ Heal player once in a health marker ]]-- 
function hospital_heal(plr) 
    if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end 
    local health = getElementHealth(plr) 
    local charge = math.floor(hs_charge/10) 
        if health < 90 and getPlayerMoney(plr) >= charge then 
            setElementHealth(plr, health+10) 
            takePlayerMoney(plr, charge) 
        elseif getPlayerMoney(plr) >= charge then 
            setElementHealth(plr, 100) 
            takePlayerMoney(plr, charge) 
            exports.GTWtopbar:dm("Hospital: Go away, you're fine!", plr, 255, 100, 0) 
            if isTimer(timers[plr]) then 
            killTimer(timers[plr]) 
        end 
        elseif getPlayerMoney(plr) < charge then 
            exports.GTWtopbar:dm("Hospital: You can't afford the healthcare!", plr, 255, 0, 0) 
        end 
end 
  
addCommandHandler("gtwinfo", function(plr, cmd) 
    outputChatBox("[GTW-RPG] "..getResourceName( 
    getThisResource())..", by: "..getResourceInfo( 
        getThisResource(), "author")..", v-"..getResourceInfo( 
        getThisResource(), "version")..", is represented", plr) 
end) 
  
--[[ Start an healing timer, increasing the health of a player ]]-- 
function hs_start_heal(hitElement, matchingDimension) 
    if isTimer(timers[hitElement]) then killTimer(timers[hitElement]) end 
    if getElementHealth(hitElement) < 90 then 
        exports.GTWtopbar:dm("Stay in the marker to get healed!", hitElement, 255, 100, 0) 
            timers[hitElement] = setTimer(hospital_heal, 1400, 0, hitElement) 
        end 
end 
  
--[[ Stop and kill the heal timers ]]-- 
function hs_stop_heal(plr, matchingDimension) 
    if isTimer(timers[plr]) then killTimer(timers[plr]) end 
end 

Link to comment

تفضل

gme = getLocalPlayer() 
Gui = {} 
Gui.window = GuiWindow(290, 132, 210, 315, "spawn", false) 
Gui.window:setSizable(false) 
Gui.window:setVisible(false) 
Gui.radioButton1 = GuiRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, Gui.window) 
Gui.radioButton1:setProperty("NormalTextColour", "FFE95014") 
Gui.radioButton2 = GuiRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, Gui.window) 
Gui.radioButton2:setProperty("NormalTextColour", "FF0DEF0D") 
Gui.radioButton3 = GuiRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, Gui.window) 
Gui.radioButton3:setProperty("NormalTextColour", "FFE95014") 
Gui.radioButton4 = GuiRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, Gui.window) 
Gui.radioButton4:setProperty( "NormalTextColour", "FF0813F6") 
---//////////////// 
bindKey("F2","down",function () 
if Gui.window:getVisible() == false then 
Gui.window:setVisible(true) 
showCursor(true) 
else 
Gui.window:setVisible(false) 
showCursor(false) 
end 
end) 
---//////////////// 
Taple_Groups = { 
-- {Name=button Name,group=Group Name,x,y,z,interior=interior ID,Dimension=Dimension ID} 
{Name=Gui.radioButton2,group='army', 203,1911,18 ,interior=0,Dimension=0}, -- المقر 
{Name=Gui.radioButton4,group='police', 1542,-1676,14 ,interior=0,Dimension=0} -- مركز الشرطه 
} 
---//////////////// 
addEventHandler ("onClientGUIClick",root,function () 
for _,v in pairs(Taple_Groups) do 
if gme:getData("Group") == v.group then 
if source == v.Name then 
triggerServerEvent("Respawn",gme,v[1],v[2],v[3],v.interior,v.Dimension)  
outputChatBox(v[1]..','..v[2]..','..v[3]..','..v.interior..','..v.Dimension) 
return  
end 
end 
end 
end) 
---//////////////// 
hs_table = {  -- x  y   z           rot view x          view y          view z 
[1]={ 1177, -1320,  14.137756347656,    270,    1200.6923828125,    -1324.9873046875,   20.398437   }, 
[2]={ -2666,    630,    13.567041397095,    180,    -2664.4501953125,   611.0771484375,     20.454549789429 }, 
[3]={ 1607, 1818,   10.8203125,         0,  1607.3310546875,    1839.7470703125,    16.8203125  }, 
[4]={ 2040,     -1420,  16.9921875,         90,     2031.8486328125,    -1419.5927734375,   22.9921875  }, 
[5]={ -2200,    -2308,  30.625,         -45,    -2193.5888671875,   -2301.6630859375,   36.625      }, 
[6]={ 208,  -65.3,  1.4357746839523,    180,    208.310546875,      -75.525390625,      7.4357746839523 }, 
[7]={ 1245.8,   336.9,  19.40625,       -20,    1250.3759765625,    346.681640625,      25.40625    }, 
[8]={ -317.4,   1056.4, 19.59375,       0,  -316.8125,      1066.306640625,     25.59375    }, 
[9]={ -1514.8,  2527.9, 55.6875,        1.790,  -1514.283203125,    2536.412109375,     61.6875     },} 
---//////////////// 
function get_nearest_hospital() 
local n_loc,min = nil,9999 
for k,v in ipairs(hs_table) do 
local px,py= getElementPosition(gme) 
local dist = getDistanceBetweenPoints2D(px,py,v[1],v[2]) 
if dist < min then 
n_loc = v 
min = dist 
end 
if gme:getInterior() > 0 then break end 
end 
local isJailed = exports.GTWjail:isJailed(gme) 
if not isJailed then 
return n_loc[1]+math.random(-1,1),n_loc[2]+math.random(-1,1),n_loc[3],n_loc[4],n_loc[5],n_loc[6],n_loc[7] 
else 
return -2965+math.random(-5,5),2305+math.random(-5,5),9,270 
end 
end 
---//////////////// 
addEventHandler ("onClientGUIClick",root,function () 
if source == Gui.radioButton1 then 
local x,y,z = get_nearest_hospital(gme) 
triggerServerEvent("Respawn",gme,x,y,z,0,0)  
outputChatBox(getZoneName ( x, y, z)..")" ) 
end 
end) 

------ لاتعدل شئ هنا 
addEvent ('Respawn',true ) 
addEventHandler('Respawn', root,function (x,y,z,interior,Dimension) 
source:setData('Respawn',table.concat({x,y,z,interior,Dimension},',')) 
end) 
------ لاتعدل شئ هنا 
timer = {} 
addEventHandler ('onPlayerWasted',root,function () 
local x,y,z,interior,Dimension = unpack(split(source:getData('Respawn'),',')) 
timer[source] = Timer(function (source) 
if isElement(source) then 
source:spawn(x,y,z,0,source:getModel(),interior,Dimension) 
outputChatBox('Area: '..getZoneName (x,y,z)..' ('..getZoneName (x,y,z, true )..')' ,source,190,0,0,true) 
end 
end,1800,1,source) --- وقت الريسباون تقدر تعدل عليه 
end) 

وحط بالميتا السطر دا

<oop>true</oop> 

Link to comment
شكرا يا اوسكار لكن في مشكلة يرسن بالمشفى فقط

الكود مجرب وشغال

لو انت اخترت الانتحار بالمسشتفي وانت بالمدينه الاولي يرسبنك بالمستشفي بالمدينه الاولي

ولو بالمدينه الثانيه يرسبك بمستشفي المدينه الثانيه

بس اهم شئ تضغظ ع الزر عشان يتحقق ب اي مدينه انت ويرسبنك بالمستشفي اللى فيها

Link to comment

الحين فهمتك يا اوسكار يعني كل مرة تختار رسباون

انا كنت ابي تختار مرة واحدة يبقى يشتغل تلقائي كل ماتموت ياخذك لمشفى المدينة اللي انت فيها

Link to comment

جرب كدا

gme = getLocalPlayer() 
Gui = {} 
Gui.window = GuiWindow(290, 132, 210, 315, "spawn", false) 
Gui.window:setSizable(false) 
Gui.window:setVisible(false) 
Gui.radioButton1 = GuiRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, Gui.window) 
Gui.radioButton1:setProperty("NormalTextColour", "FFE95014") 
Gui.radioButton2 = GuiRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, Gui.window) 
Gui.radioButton2:setProperty("NormalTextColour", "FF0DEF0D") 
Gui.radioButton3 = GuiRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, Gui.window) 
Gui.radioButton3:setProperty("NormalTextColour", "FFE95014") 
Gui.radioButton4 = GuiRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, Gui.window) 
Gui.radioButton4:setProperty( "NormalTextColour", "FF0813F6") 
---//////////////// 
bindKey("F2","down",function () 
if Gui.window:getVisible() == false then 
Gui.window:setVisible(true) 
showCursor(true) 
else 
Gui.window:setVisible(false) 
showCursor(false) 
end 
end) 
---//////////////// 
Taple_Groups = { 
-- {Name=button Name,group=Group Name,x,y,z,interior=interior ID,Dimension=Dimension ID} 
{Name=Gui.radioButton2,group='army', 203,1911,18 ,interior=0,Dimension=0}, -- المقر 
{Name=Gui.radioButton4,group='police', 1542,-1676,14 ,interior=0,Dimension=0} -- مركز الشرطه 
} 
---//////////////// 
addEventHandler ("onClientGUIClick",root,function () 
for _,v in pairs(Taple_Groups) do 
if gme:getData("Group") == v.group then 
if source == v.Name then 
if isTimer (timer) then killTimer (timer) end 
triggerServerEvent("Respawn",gme,v[1],v[2],v[3],v.interior,v.Dimension) 
outputChatBox(v[1]..','..v[2]..','..v[3]..','..v.interior..','..v.Dimension) 
return 
end 
end 
end 
end) 
---//////////////// 
hs_table = {  -- x  y   z           rot view x          view y          view z 
[1]={ 1177, -1320,  14.137756347656,    270,    1200.6923828125,    -1324.9873046875,   20.398437   }, 
[2]={ -2666,    630,    13.567041397095,    180,    -2664.4501953125,   611.0771484375,     20.454549789429 }, 
[3]={ 1607, 1818,   10.8203125,         0,  1607.3310546875,    1839.7470703125,    16.8203125  }, 
[4]={ 2040,     -1420,  16.9921875,         90,     2031.8486328125,    -1419.5927734375,   22.9921875  }, 
[5]={ -2200,    -2308,  30.625,         -45,    -2193.5888671875,   -2301.6630859375,   36.625      }, 
[6]={ 208,  -65.3,  1.4357746839523,    180,    208.310546875,      -75.525390625,      7.4357746839523 }, 
[7]={ 1245.8,   336.9,  19.40625,       -20,    1250.3759765625,    346.681640625,      25.40625    }, 
[8]={ -317.4,   1056.4, 19.59375,       0,  -316.8125,      1066.306640625,     25.59375    }, 
[9]={ -1514.8,  2527.9, 55.6875,        1.790,  -1514.283203125,    2536.412109375,     61.6875     },} 
---//////////////// 
function get_nearest_hospital() 
local n_loc,min = nil,9999 
for k,v in ipairs(hs_table) do 
local px,py= getElementPosition(gme) 
local dist = getDistanceBetweenPoints2D(px,py,v[1],v[2]) 
if dist < min then 
n_loc = v 
min = dist 
end 
if gme:getInterior() > 0 then break end 
end 
local isJailed = exports.GTWjail:isJailed(gme) 
if not isJailed then 
return n_loc[1]+math.random(-1,1),n_loc[2]+math.random(-1,1),n_loc[3],n_loc[4],n_loc[5],n_loc[6],n_loc[7] 
else 
return -2965+math.random(-5,5),2305+math.random(-5,5),9,270 
end 
end 
---//////////////// 
addEventHandler ("onClientGUIClick",root,function () 
if source == Gui.radioButton1 then 
timer = setTimer(function () 
local x,y,z = get_nearest_hospital(gme) 
triggerServerEvent("Respawn",gme,x,y,z,0,0) 
end,100,0)  
outputChatBox(getZoneName ( x, y, z)..")" ) 
end 
end) 
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...