Jump to content

طلب كود وحل مشكلة


Recommended Posts

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

ابي كود

لما احد يجي يقرب من منطقة معينة ينصك سلاب ويطلع في الأتشات ممتلكات خاصة

vip للـ

وعندي مشكلة في كود االأخ بين

حج السيارات الخاصة للأدمن

اول مشكلة

اني لو سويت مودين وغيرت الأحدثيات وغيرت اسم الجروب حج الأسل

اوقف في الماركر تطلعلي 2 للوحة

وذيه الأكواد

------ am_server ------ 
--[[  
  
* Script : 
    Admins Cars Marker | v1.0 
* Type : 
    server 
============ 
* Author : 
    #Pai_[N] 
  
--]] 
  
-------------------------------- 
Groups = { 'SWAT', 'ARMY' } 
-------------------------------- 
-- ! لآ تعـدل علـى شـيء بعـد هـذا السطـر, إالآ إذا متـأكد مـن إللـي تسـويـه 
-------------------------------- 
  
players = getElementsByType ( 'player' ) 
  
function getAllowed ( ) 
    for _,v in ipairs( Groups ) do 
        return v 
    end 
end 
  
addEventHandler ( 'onResourceStart', resourceRoot, function ( ) 
    for k,v in ipairs( players ) do 
        local acc = getPlayerAccount ( v ) 
        if isGuestAccount ( acc ) then 
            return 
        end 
        local accName = getAccountName ( acc ) 
        if isObjectInACLGroup ( 'user.'..accName, aclGetGroup ( getAllowed ( ) ) ) then 
            setElementData ( v, 'Admin', true ) 
        end 
    end 
end ) 
  
addEventHandler ( 'onPlayerLogin', root, function ( _, acc ) 
    if isGuestAccount ( acc ) then 
        return 
    end 
    local accName = getAccountName ( acc ) 
    if isObjectInACLGroup ( 'user.'..accName, aclGetGroup ( getAllowed ( ) ) ) then 
        setElementData ( source, 'Admin', true ) 
    end 
end ) 
  
addEventHandler ( 'onPlayerLogout', root, function ( ) 
    setElementData ( source, 'Admin', false ) 
end ) 
  
addEvent ( 'onVehicleCreate', true ) 
addEventHandler ( 'onVehicleCreate', root, function ( id ) 
    local x, y, z = getElementPosition ( source ) 
    for k,v in ipairs( getElementsByType ( 'vehicle' ) ) do 
        if getElementData ( v, 'fromMarker' ) then 
            if getPlayerSerial ( source ) == getElementData ( v, 'owner' ) then 
                destroyElement ( v ) 
            end 
        end 
    end 
    car = createVehicle ( id, x, y, z ) 
    warpPedIntoVehicle ( source, car ) 
    setVehicleDamageProof ( car, true ) 
    setElementData ( car, 'fromMarker', true ) 
    setElementData ( car, 'owner', getPlayerSerial ( source ) ) 
end ) 
  
addEventHandler ( 'onPlayerQuit', root, function ( ) 
    local veh = getPedOccupiedVehicle ( source ) 
    if veh then 
        destroyElement ( veh ) 
    end 
    for k,v in ipairs( getElementsByType ( 'vehicle' ) ) do 
        if getElementData ( v, 'fromMarker' ) then 
            if getPlayerSerial ( source ) == getElementData ( v, 'owner' ) then 
                destroyElement ( v ) 
            end 
        end 
    end 
end ) 
  
addEventHandler ( 'onVehicleStartEnter', root, function ( player, seat ) 
    if getElementData ( source, 'fromMarker' ) then 
        if seat == 0 then 
            local acc = getPlayerAccount ( player ) 
            if isGuestAccount ( acc ) then 
                cancelEvent ( ) 
                return outputChatBox ( '! للأدمن فقط', player ) 
            end 
            local accName = getAccountName ( acc ) 
            if not isObjectInACLGroup ( 'user.'..accName, aclGetGroup ( getAllowed ( ) ) ) then 
                cancelEvent ( ) 
                return outputChatBox ( '! للأدمن فقط', player ) 
            end 
        end 
    end 
end ) 

---- am_client ----- 
  
-------------------------------- 
local spots = { 
    -- size   
    -- r, g, b  
    -- a  
    -- { x, y, z, _, size, r, g, b, a },  
    { 1218.8181152344, -1647.9377441406, 11.796875, _, 1.5, 255, 255, 255, 255 }, 
    { 1219.8000488281, -1655.8000488281, 11.800000190735, _, 1.5, 255, 0, 0, 255 } 
} 
--- 
Cars = {  
    -- ['Name'] = ID 
    ['Enforcer'] = 427, 
    ['FBI Rancher'] = 490, 
    ['S.W.A.T'] = 601, 
    ['FBI Truck'] = 528, 
    ['Cheetah'] = 415 
} 
-------------------------------- 
-------------------------------- 
  
  
for k,v in ipairs( spots ) do 
    createMarker ( v[1],v[2],v[3] - 1, 'cylinder', v[5], v[6], v[7], v[8], v[9] ) 
end 
  
for k,v in ipairs( getElementsByType ( 'marker', resourceRoot ) ) do 
    setElementData ( v, 'fromMode', true ) 
end 
  
function getIDFromName ( name ) 
    for k,v in pairs( Cars ) do 
        if name == k then 
            return v 
        end 
    end 
    return nil 
end 
  
GUIEditor = { 
    window = { }, 
    grid = { }, 
    button = { } 
} 
addEventHandler ( 'onClientResourceStart', resourceRoot, function ( ) 
    GUIEditor.window[1] = guiCreateWindow(0.3512,0.2567,0.2825,0.6233,"Car SWAT By Scorpio",true) 
    guiWindowSetSizable(GUIEditor.window[1], false) 
    guiSetVisible(GUIEditor.window[1], false) 
    ---- 
    GUIEditor.grid[1] = guiCreateGridList(0.0619,0.0615,0.8761,0.6471,true,GUIEditor.window[1]) 
    guiGridListAddColumn(GUIEditor.grid[1],"Name",0.9) 
    for k,v in pairs( Cars ) do 
        local row = guiGridListAddRow ( GUIEditor.grid[1] ) 
        guiGridListSetItemText ( GUIEditor.grid[1], row, 1, k, false, false ) 
    end 
    ---- 
    GUIEditor.button[1] = guiCreateButton(0.0664,0.7326,0.8628,0.1016,"Selection",true,GUIEditor.window[1]) 
    GUIEditor.button[2] = guiCreateButton(0.0664,0.869,0.8628,0.1016,"Close",true,GUIEditor.window[1]) 
end ) 
  
addEventHandler ( 'onClientMarkerHit', root, function ( element ) 
    if element == localPlayer then 
        if getElementData ( source, 'fromMode' ) then 
            if isPedInVehicle ( element ) then 
                return 
            end 
            if getElementData ( element, 'Admin' ) then 
                guiSetVisible ( GUIEditor.window[1], true ) 
                showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) 
            else 
                outputChatBox ( '* You must be SWAT !', 200, 0, 0, true ) 
            end 
        end 
    end 
end ) 
  
addEventHandler ( 'onClientGUIClick', root, function ( ) 
    if source == GUIEditor.button[1] then 
        local row, col = guiGridListGetSelectedItem ( GUIEditor.grid[1] ) 
        if row and col and row ~= -1 and col ~= -1 then 
            local name = guiGridListGetItemText ( GUIEditor.grid[1], row, col ) 
            local id = getIDFromName ( name ) 
            triggerServerEvent ( 'onVehicleCreate', localPlayer, id ); 
            guiSetVisible ( GUIEditor.window[1], false ) 
            showCursor ( false ) 
        else 
            outputChatBox ( 'Choose a car from painting', 0, 0, 255, true ); 
        end 
    elseif source == GUIEditor.button[2] then 
        guiSetVisible ( GUIEditor.window[1], false ) 
        showCursor ( false ) 
    end 
end ) 
  
addEventHandler ( 'onClientGUIDoubleClick', root, function ( ) 
    if source == GUIEditor.grid[1] then 
        local row, col = guiGridListGetSelectedItem ( GUIEditor.grid[1] ) 
        if row and col and row ~= -1 and col ~= -1 then 
            local name = guiGridListGetItemText ( GUIEditor.grid[1], row, col ) 
            local id = getIDFromName ( name ) 
            triggerServerEvent ( 'onVehicleCreate', localPlayer, id ); 
            guiSetVisible ( GUIEditor.window[1], false ) 
            showCursor ( false ) 
        else 
            outputChatBox ( 'Choose a car from painting', 0, 0, 255, true ); 
        end 
    end 
end ) 
  

والحمد لله وشكراً

Link to comment
addEventHandler ( 'onClientMarkerHit',getResourceRootElement ( getThisResource ( ) ), function ( element ) 

createMarker 
"onMarkerHit" 
getElementType 
isObjectInACLGroup 
getPlayerAccount 
getAccountName 
killPed 

مشكور جاري التجربة

لكن الكود الول

كذا احطو

؟

--[[  
  
* Script : 
    Admins Cars Marker | v1.0 
* Type : 
    server 
============ 
* Author : 
    #Pai_[N] 
  
--]] 
  
-------------------------------- 
Groups = { 'SWAT', 'ARMY' } 
-------------------------------- 
-- ! لآ تعـدل علـى شـيء بعـد هـذا السطـر, إالآ إذا متـأكد مـن إللـي تسـويـه 
-------------------------------- 
  
players = getElementsByType ( 'player' ) 
  
function getAllowed ( ) 
    for _,v in ipairs( Groups ) do 
        return v 
    end 
end 
  
addEventHandler ( 'onResourceStart', resourceRoot, function ( ) 
    for k,v in ipairs( players ) do 
        local acc = getPlayerAccount ( v ) 
        if isGuestAccount ( acc ) then 
            return 
        end 
        local accName = getAccountName ( acc ) 
        if isObjectInACLGroup ( 'user.'..accName, aclGetGroup ( getAllowed ( ) ) ) then 
            setElementData ( v, 'Admin', true ) 
        end 
    end 
end ) 
  
addEventHandler ( 'onPlayerLogin', root, function ( _, acc ) 
    if isGuestAccount ( acc ) then 
        return 
    end 
    local accName = getAccountName ( acc ) 
    if isObjectInACLGroup ( 'user.'..accName, aclGetGroup ( getAllowed ( ) ) ) then 
        setElementData ( source, 'Admin', true ) 
    end 
end ) 
  
addEventHandler ( 'onPlayerLogout', root, function ( ) 
    setElementData ( source, 'Admin', false ) 
end ) 
  
addEvent ( 'onVehicleCreate', true ) 
addEventHandler ( 'onVehicleCreate', root, function ( id ) 
    local x, y, z = getElementPosition ( source ) 
    for k,v in ipairs( getElementsByType ( 'vehicle' ) ) do 
        if getElementData ( v, 'fromMarker' ) then 
            if getPlayerSerial ( source ) == getElementData ( v, 'owner' ) then 
                destroyElement ( v ) 
            end 
        end 
    end 
    car = createVehicle ( id, x, y, z ) 
    warpPedIntoVehicle ( source, car ) 
    setVehicleDamageProof ( car, true ) 
    setElementData ( car, 'fromMarker', true ) 
    setElementData ( car, 'owner', getPlayerSerial ( source ) ) 
    addEventHandler ( 'onClientMarkerHit',getResourceRootElement ( getThisResource ( ) ), function ( element ) 
end ) 
  
addEventHandler ( 'onPlayerQuit', root, function ( ) 
    local veh = getPedOccupiedVehicle ( source ) 
    if veh then 
        destroyElement ( veh ) 
    end 
    for k,v in ipairs( getElementsByType ( 'vehicle' ) ) do 
        if getElementData ( v, 'fromMarker' ) then 
            if getPlayerSerial ( source ) == getElementData ( v, 'owner' ) then 
                destroyElement ( v ) 
            end 
        end 
    end 
end ) 
  
addEventHandler ( 'onVehicleStartEnter', root, function ( player, seat ) 
    if getElementData ( source, 'fromMarker' ) then 
        if seat == 0 then 
            local acc = getPlayerAccount ( player ) 
            if isGuestAccount ( acc ) then 
                cancelEvent ( ) 
                return outputChatBox ( '! للأدمن فقط', player ) 
            end 
            local accName = getAccountName ( acc ) 
            if not isObjectInACLGroup ( 'user.'..accName, aclGetGroup ( getAllowed ( ) ) ) then 
                cancelEvent ( ) 
                return outputChatBox ( '! للأدمن فقط', player ) 
            end 
        end 
    end 
end ) 

Link to comment
يا حبي ليه تسوي مودين ؟؟

! زود ماركرات في نفس المود, لو سويت مودين ما راح يضبط لأنه نفس الأكواد

انا ابي الماركر يكون له سيارات مختلفة + جروب مختلف

Link to comment

يجب ربط مع مودك

مود لوحه سياره شرطه

كلنت

  
Markers = { 
    [1] = { x, y, z }, 
    [2] = {  x, y, z }, 
    [3] = {  x, y, z }, 
    [4] = {  x, y, z }, 
} 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        for _, TheMarkers in ipairs ( Markers ) do 
            TheMarker = createMarker ( TheMarkers[1], TheMarkers[2], TheMarkers[3] - 1, "cylinder", 2, 25, 205, 100, 150 ) 
        end 
    end 
) 
  
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
  
GUIEditor_Window[1] = guiCreateWindow(258,129,228,368,"By yaZan",false) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Button[1] = guiCreateButton(32,66,173,70,"LS",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(17,25,197,36,"police car",false,GUIEditor_Window[1]) 
GUIEditor_Button[6] = guiCreateButton(34,138,173,70,"HPv1000",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(34,209,173,70,"Enforcer",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(34,280,173,70,"ranger",false,GUIEditor_Window[1]) 
  
addEventHandler ( "onClientMarkerHit", resourceRoot, 
    function ( hitPlayer ) 
        if hitPlayer == localPlayer then 
            local team = getPlayerTeam ( hitPlayer ) 
            if team and getTeamName ( team ) == "police" then 
                guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
                showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) 
                guiSetInputEnabled ( guiGetVisible ( GUIEditor_Window[1] ) ) 
            end 
        end 
    end 
) 
  
function givecar ( id ) 
    triggerServerEvent ( "givecar", localPlayer, id ) 
    guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
    showCursor ( guiGetVisible(GUIEditor_Window[1] ) ) 
    guiSetInputEnabled ( guiGetVisible ( GUIEditor_Window[1] ) ) 
end 
  
addEventHandler( "onClientGUIClick", root, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            givecar(596) 
        elseif ( source == GUIEditor_Button[6] ) then 
            givecar(523) 
        elseif ( source == GUIEditor_Button[3] ) then 
            givecar(427) 
        elseif ( source == GUIEditor_Button[4] ) then 
            givecar(599) 
        end 
    end 
) 

سيرفر

  
Vehicles = {} 
  
addEvent ( "givecar", true ) 
addEventHandler ( "givecar", root, 
    function ( id ) 
        if Vehicles [ source ] then 
            destroyElement ( Vehicles [ source ] ) 
        end 
        if tonumber( id ) then 
            local x, y, z = getElementPosition ( source ) 
            Vehicles [ source ] = createVehicle ( tonumber( id ), x, y, z ) 
            if Vehicles [ source ] then 
                warpPedIntoVehicle ( source, Vehicles [ source ] ) 
            end 
        end 
    end 
) 

مود القتل اذا لمس المارك

marker = createMarker ( 1943.099975585, -2469.1999511719, 13.5, "cylinder", 4, 0, 0, 0, 0)   
function kill(thePlayer) 
local accName = getAccountName (getPlayerAccount(thePlayer)) 
if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "yazan" ) ) 
then 
killPed ( thePlayer ) 
   end 
end 
addEventHandler( "onMarkerHit", marker, kill ) 

Link to comment
يجب ربط مع مودك

مود لوحه سياره شرطه

كلنت

  
Markers = { 
    [1] = { x, y, z }, 
    [2] = {  x, y, z }, 
    [3] = {  x, y, z }, 
    [4] = {  x, y, z }, 
} 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        for _, TheMarkers in ipairs ( Markers ) do 
            TheMarker = createMarker ( TheMarkers[1], TheMarkers[2], TheMarkers[3] - 1, "cylinder", 2, 25, 205, 100, 150 ) 
        end 
    end 
) 
  
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
  
GUIEditor_Window[1] = guiCreateWindow(258,129,228,368,"By yaZan",false) 
guiSetVisible(GUIEditor_Window[1],false) 
GUIEditor_Button[1] = guiCreateButton(32,66,173,70,"LS",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(17,25,197,36,"police car",false,GUIEditor_Window[1]) 
GUIEditor_Button[6] = guiCreateButton(34,138,173,70,"HPv1000",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(34,209,173,70,"Enforcer",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(34,280,173,70,"ranger",false,GUIEditor_Window[1]) 
  
addEventHandler ( "onClientMarkerHit", resourceRoot, 
    function ( hitPlayer ) 
        if hitPlayer == localPlayer then 
            local team = getPlayerTeam ( hitPlayer ) 
            if team and getTeamName ( team ) == "police" then 
                guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
                showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) 
                guiSetInputEnabled ( guiGetVisible ( GUIEditor_Window[1] ) ) 
            end 
        end 
    end 
) 
  
function givecar ( id ) 
    triggerServerEvent ( "givecar", localPlayer, id ) 
    guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
    showCursor ( guiGetVisible(GUIEditor_Window[1] ) ) 
    guiSetInputEnabled ( guiGetVisible ( GUIEditor_Window[1] ) ) 
end 
  
addEventHandler( "onClientGUIClick", root, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            givecar(596) 
        elseif ( source == GUIEditor_Button[6] ) then 
            givecar(523) 
        elseif ( source == GUIEditor_Button[3] ) then 
            givecar(427) 
        elseif ( source == GUIEditor_Button[4] ) then 
            givecar(599) 
        end 
    end 
) 

سيرفر

  
Vehicles = {} 
  
addEvent ( "givecar", true ) 
addEventHandler ( "givecar", root, 
    function ( id ) 
        if Vehicles [ source ] then 
            destroyElement ( Vehicles [ source ] ) 
        end 
        if tonumber( id ) then 
            local x, y, z = getElementPosition ( source ) 
            Vehicles [ source ] = createVehicle ( tonumber( id ), x, y, z ) 
            if Vehicles [ source ] then 
                warpPedIntoVehicle ( source, Vehicles [ source ] ) 
            end 
        end 
    end 
) 

مود القتل اذا لمس المارك

marker = createMarker ( 1943.099975585, -2469.1999511719, 13.5, "cylinder", 4, 0, 0, 0, 0)   
function kill(thePlayer) 
local accName = getAccountName (getPlayerAccount(thePlayer)) 
if not isObjectInACLGroup ("user."..accName, aclGetGroup ( "yazan" ) ) 
then 
killPed ( thePlayer ) 
   end 
end 
addEventHandler( "onMarkerHit", marker, kill ) 

مشكور اخوي يعطيك العافية

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...