Jump to content

طلب تصحيح كود [Solved]


Recommended Posts

السلام عليكم

عملت سكربت سباون وفيه خطأ

هذا هوا الكود

ملحوظة : انا لسه ما أنتهيت من كل التيمات أنا حالياً بجرب علي الـ (NoTeam)

-كلينت-

local table = {105,106,107,114,109,110,108,115,116,102,103,104,163,164,165,166,265,266,267,280,281,282,283,284,285,286,287,288,312,0,1,2,7,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,37,43,44,45,46,47,48,50,51,52,57,59,60,83,84,96,97,274,275,276} 
ped = createPed(105,428.39999389648, -56.700000762939, 1013.799987793,270) 
local var = 0 
  
    setCameraMatrix(434.94989013672, -56.703098297119, 1014.8275146484, 433.95333862305, -56.695301055908, 1014.7448120117) 
    bindKey("arrow_r", "down", 
    function() 
    var = var + 1 
    if var > #table then 
       var = 1 
    end 
    setElementModel(ped, table[var]) 
    end) 
    bindKey("arrow_l", "down", 
    function() 
    var = var - 1 
    if var < 1 then 
        var = #table 
    end 
    setElementModel(ped, table[var]) 
    end) 
    bindKey("enter", "down", 
    function() 
        if getElementModel(ped) == 0 or 1 or 2 or 7 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 32 or 33 or 34 or 35 or 37 or 43 or 44 or 45 or 46 or 47 or 48 or 50 or 51 or 52 or 57 or 59 or 60 or 83 or 84 or 96 or 97 then 
            local SkinID = table[getElementModel(ped)] 
            triggerServerEvent("spawnNT", getLocalPlayer(), SkinID ) 
        end 
    unbindKey("arrow_r", "down", hideLoginWindow) 
    unbindKey("arrow_l", "down", hideLoginWindow) 
    unbindKey("enter", "down", hideLoginWindow) 
    end) 

-سيرفر-

  
NoTeam = createTeam ("NoTeam", 255, 0, 0) 
  
function SpawnNoTe (SkinID) 
    setPlayerTeam(source,NoTeam) 
    setPlayerNametagColor ( source, 255, 0, 0 ) 
    spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0, SkinID, 0, 0) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root, "أنت  الأن في فريق  No Team" , 255, 0, 0) 
end 
addEvent("spawnNT", true) 
addEventHandler("spawnNT",root,SpawnNoTe) 

المشكلة هيا أني عندما أضغط

Enter

للسباون يعطيني شخصية غير الي أخترتها تماماً :v

أرجو الحل

وشكراً

Edited by Guest
Link to comment
local SkinID = table[getElementModel(ped)] 

بدله إالى

local SkinID = getElementModel(ped) 

+

        if getElementModel(ped) == 0 or 1 or 2 or 7 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 32 or 33 or 34 or 35 or 37 or 43 or 44 or 45 or 46 or 47 or 48 or 50 or 51 or 52 or 57 or 59 or 60 or 83 or 84 or 96 or 97 then 

احذف هذا

Link to comment
local SkinID = table[getElementModel(ped)] 

بدله إالى

local SkinID = getElementModel(ped) 

+

        if getElementModel(ped) == 0 or 1 or 2 or 7 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 32 or 33 or 34 or 35 or 37 or 43 or 44 or 45 or 46 or 47 or 48 or 50 or 51 or 52 or 57 or 59 or 60 or 83 or 84 or 96 or 97 then 

احذف هذا

الله أكبر

مشكووووووووووووور فحت

وكل سنة وانت طيب

الكود أشتغل تمام

Link to comment

سوي جدول للتميات مع الشخصيات

كذا

Teams = { 
    ["Police"] = {280, 281, 283, 284}, 
    ["Army"] = {285, 287}, 
    ["Other"] = {46, 29, 47} 
} 
SelectedTeam = "Police" 
  
for k,v in ipairs(Teams[SelectedTeam]) do 
    outputChatBox(v) 
end 

مثال بس

Link to comment

أنا سويت هيك وبعدين ؟؟

local table = { 
Grove = {105, 106, 107},  
Aztecas = {109,110,108,115,116},  
Police = {283, 284, 285,163,164,165,166,265,266,267,280,281,282,283,284,285,286,287,288,312},  
Ballas = {102, 103, 104},  
NoTeam = {0,1,2,7,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,37,43,44,45,46,47,48,50,51,52,57,59,60,83,84,96,97},  
Medic = {274, 275, 276} 
} 

Link to comment
كود سيرفر حقك مافيه غير تيم واحد

اذا عدلته حط الي عدلته

أخي أنا ضايف تيمات ومخليه كدة تجريبياً .......

Grove = createTeam ("Grove", 0, 255, 0) 
Ballas = createTeam ("Ballas", 255, 0, 255) 
Medic = createTeam ("Medic", 0, 255, 255) 
Police = createTeam ("Police", 0, 0, 255) 
Aztecas = createTeam ("Aztecas", 0, 204, 204) 
NoTeam = createTeam ("NoTeam", 255, 0, 0) 
  
function SpawnNoTe (SkinID) 
    setPlayerTeam(source,NoTeam) 
    setPlayerNametagColor ( source, 255, 0, 0 ) 
    spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0, SkinID, 0, 0) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root, "أنت  الأن في فريق  No Team" , 255, 0, 0) 
end 
addEvent("spawnNT", true) 
addEventHandler("spawnNT",root,SpawnNoTe) 
  
  
function SpawnGro (SkinID) 
    setPlayerTeam(source,Grove) 
    setPlayerNametagColor ( source, 0, 255, 0 ) 
    spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0, SkinID, 0, 0) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root, "أنت  الأن في فريق  Grove Street" , 0, 255, 0) 
end 
addEvent("spawnGR", true) 
addEventHandler("spawnGR",root,SpawnGro) 
  
  
function SpawnAzt ( ) 
    setPlayerTeam(source,Aztecas) 
    setPlayerNametagColor ( source, 0, 204, 204 ) 
    spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0, ID, 0, 0) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root, "أنت  الأن في فريق  Aztecas" , 0, 204, 204) 
end 
addEvent("spawnAZ", true) 
addEventHandler("spawnAZ",root,SpawnAzt) 
  
  
function SpawnPol ( ) 
    setPlayerTeam(source,Police) 
    setPlayerNametagColor ( source, 0, 0, 255 ) 
    spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0, ID, 0, 0) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root, "أنت الأن شرطي" , 0, 0, 255) 
end 
addEvent("spawnPO", true) 
addEventHandler("spawnPO",root,SpawnPol) 
  
  
function SpawnMed ( ) 
    setPlayerTeam(source,Medic) 
    setPlayerNametagColor ( source, 0, 255, 255 ) 
    spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0, ID, 0, 0) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root, "أنت الأن طبيب" , 0, 255, 255) 
end 
addEvent("spawnME", true) 
addEventHandler("spawnME",root,SpawnMed) 
  
  
function SpawnBal ( ) 
    setPlayerTeam(source,Medic) 
    setPlayerNametagColor ( source, 255, 0, 255 ) 
    spawnPlayer (source, -2523.3408203125, -619.9560546875, 132.5625, 0, ID, 0, 0) 
        fadeCamera(source, true) 
        setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root, "أنت الأن في فريق Ballas" , 255, 0, 255) 
end 
addEvent("spawnBA", true) 
addEventHandler("spawnBA",root,SpawnBal) 

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

ويظهر للاعب عندما يدخل في الـ Guimessages

"أنت الان في فريق No Team "

مثل ما هوا واضح في إيفنت spawnNT

Link to comment
local table = {105,106,107,114,109,110,108,115,116,102,103,104,163,164,165,166,265,266,267,280,281,282,283,284,285,286,287,288,312,0,1,2,7,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,37,43,44,45,46,47,48,50,51,52,57,59,60,83,84,96,97,274,275,276} 
local teams = { 
["Grove"] = {105, 106, 107}, 
["Aztecas"] = {109,110,108,115,116}, 
["Police"] = {283, 284, 285,163,164,165,166,265,266,267,280,281,282,283,284,285,286,287,288,312}, 
["Ballas"] = {102, 103, 104}, 
["NoTeam"] = {0,1,2,7,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,37,43,44,45,46,47,48,50,51,52,57,59,60,83,84,96,97}, 
["Medic"] = {274, 275, 276} 
} 
ped = createPed(105,428.39999389648, -56.700000762939, 1013.799987793,270) 
local var = 0 
setCameraMatrix(434.94989013672, -56.703098297119, 1014.8275146484, 433.95333862305, -56.695301055908, 1014.7448120117) 
bindKey("arrow_r", "down", 
function() 
    var = var + 1 
    if var > #table then 
        var = 1 
    end 
    setElementModel(ped, table[var]) 
end 
) 
  
bindKey("arrow_l", "down", 
function() 
    var = var - 1 
    if var < 1 then 
        var = #table 
    end 
    setElementModel(ped, table[var]) 
end 
) 
  
bindKey("enter", "down", 
function() 
    local SkinID = getElementModel(ped) 
    table.foreach(teams, 
    function(teamName,sTable) 
        table.foreach(sTable, 
        function(_,id) 
            if id == skin then 
                local Team = teamName 
            end 
        end) 
    end) 
    triggerServerEvent("Client:Spawn", getLocalPlayer(), SkinID,Team) 
    unbindKey("arrow_r", "down", hideLoginWindow) 
    unbindKey("arrow_l", "down", hideLoginWindow) 
    unbindKey("enter", "down", hideLoginWindow) 
end 
) 

Grove = createTeam ("Grove", 0, 255, 0) 
Ballas = createTeam ("Ballas", 255, 0, 255) 
Medic = createTeam ("Medic", 0, 255, 255) 
Police = createTeam ("Police", 0, 0, 255) 
Aztecas = createTeam ("Aztecas", 0, 204, 204) 
NoTeam = createTeam ("NoTeam", 255, 0, 0) 
  
local teamSpawn = { 
["Grove"] = {x, y, z}, 
["Aztecas"] = {x,y,z,}, 
["Police"] = {x, y, z}, 
["Ballas"] = {x, y, z}, 
["NoTeam"] = {x, y, z}, 
["Medic"] = {x, y, z}, 
} 
  
function SpawnNoTe (SkinID,team) 
    setPlayerTeam(source,getTeamFromName(team)) 
    setPlayerNametagColor ( source, 255, 0, 0 ) 
    local x,y,z = unpack(teamSpawn[team]) 
    spawnPlayer (source, x,y,z, 0, SkinID, 0, 0) 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root,"أنت  الأن في فريق "..team, 255, 0, 0) 
end 
addEvent("Client:Spawn", true) 
addEventHandler("Client:Spawn",root,SpawnNoTe) 

Link to comment

أخي الكود لا يعمل سباون

وهذه صورة من الدي بق

hwy0cXe.png

الكود من السطر 246

table.foreach(teams, 
    function(teamName,sTable) 
        table.foreach(sTable, 
            function(_,id) 
            if id == skin then 
                local Team = teamName 
            end 
        end) 
    end) 

أرجو حل المشكلة

وشكراً

Link to comment
local sTable = {105,106,107,114,109,110,108,115,116,102,103,104,163,164,165,166,265,266,267,280,281,282,283,284,285,286,287,288,312,0,1,2,7,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,37,43,44,45,46,47,48,50,51,52,57,59,60,83,84,96,97,274,275,276} 
local teams = { 
    ["Grove"] = {105, 106, 107}, 
    ["Aztecas"] = {109,110,108,115,116}, 
    ["Police"] = {283, 284, 285,163,164,165,166,265,266,267,280,281,282,283,284,285,286,287,288,312}, 
    ["Ballas"] = {102, 103, 104}, 
    ["NoTeam"] = {0,1,2,7,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,37,43,44,45,46,47,48,50,51,52,57,59,60,83,84,96,97}, 
    ["Medic"] = {274, 275, 276} 
} 
  
ped = createPed(105,428.39999389648, -56.700000762939, 1013.799987793,270) 
local var = 0 
setCameraMatrix(434.94989013672, -56.703098297119, 1014.8275146484, 433.95333862305, -56.695301055908, 1014.7448120117) 
  
bindKey("arrow_r", "down", 
function() 
    var = var + 1 
    if var > #sTable then 
        var = 1 
    end 
    setElementModel(ped, sTable[var]) 
end) 
  
bindKey("arrow_l", "down", 
function() 
    var = var - 1 
    if var < 1 then 
        var = #sTable 
    end 
    setElementModel(ped, sTable[var]) 
end) 
  
bindKey("enter", "down", 
function() 
    local SkinID = getElementModel(ped) 
    local Team 
    table.foreach(teams, 
    function(teamName, sTable) 
        table.foreach(sTable, 
        function(_,id) 
            if id == SkinID then 
                Team = teamName 
            end 
        end) 
    end) 
    triggerServerEvent("Client:Spawn", getLocalPlayer(), SkinID, Team) 
    unbindKey("arrow_r", "down", hideLoginWindow) 
    unbindKey("arrow_l", "down", hideLoginWindow) 
    unbindKey("enter", "down", hideLoginWindow) 
end) 

Link to comment

أخواني طيب سؤال تاني ما رضيت أضيفه في موضوضع جديد لأنه نفس السكربت :D

الكود هذا

Grove = createTeam ("Grove", 0, 255, 0) 
Ballas = createTeam ("Ballas", 255, 0, 255) 
Medic = createTeam ("Medic", 0, 255, 255) 
Police = createTeam ("Police", 0, 0, 255) 
Aztecas = createTeam ("Aztecas", 0, 204, 204) 
NoTeam = createTeam ("NoTeam", 255, 0, 0) 
  
local rnd = { 
n1 = {2047.8000488281, -1899.8000488281, 13.5}, 
n2 = {958.09997558594, -1356.6999511719, 13.300000190735}, 
n3 = {1128.6999511719, -1490.5, 22.799999237061}, 
n4 = {2144.1000976563, -1803.1999511719, 16.10000038147}, 
n5 = {1716.9000244141, -1682.0999755859, 20.200000762939}, 
n6 = {1975.5999755859, -1284.6999511719, 28.5}, 
n7 = {2027, 1916.6999511719, 12.300000190735}, 
n8 = {2565.1000976563, 1212.8000488281, 14.300000190735}, 
n9 = {2535.5, 997.79998779297, 14.300000190735}, 
n10 = {2542.3000488281, 2213.5, 14.10000038147}, 
n11 = {2261.3999023438, 2333.3000488281, 10.800000190735}, 
n12 = {1954.1999511719, 2323.8999023438, 10.800000190735}, 
} 
  
  
local teamSpawn = { 
["Grove"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, 
["Aztecas"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, 
["Police"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, 
["Ballas"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, 
["NoTeam"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, 
["Medic"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, 
} 
  
  
function SpawnNoTe (SkinID,team) 
    setPlayerTeam(source,getTeamFromName(team)) 
    setPlayerNametagColor ( source, 255, 0, 0 ) 
    if (team == "NoTeam") then 
        local xn,yn,zn = unpack ( rnd [ math.random ( 1, 12 ) ] ) 
        spawnPlayer (source, xn,yn,zn, 0, SkinID, 0, 0) 
    else 
    local x,y,z = unpack(teamSpawn[team]) 
    spawnPlayer (source, x,y,z, 0, SkinID, 0, 0) 
    end 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    exports ["guimessages"] : outputServer (root,"أنت  الأن في فريق "..team, 255, 0, 0) 
end 
addEvent("Client:Spawn", true) 
addEventHandler("Client:Spawn",root,SpawnNoTe) 
  

عندما أشغله الكود وأختار شخصية من فريق NoTeam

ما يعمل سباون

ولما جربت الدي بق طلعلي هيك ....

PhNJOdG.png

أرجو الحل

Link to comment
Grove = createTeam("Grove", 0, 255, 0) 
Ballas = createTeam("Ballas", 255, 0, 255) 
Medic = createTeam("Medic", 0, 255, 255) 
Police = createTeam("Police", 0, 0, 255) 
Aztecas = createTeam("Aztecas", 0, 204, 204) 
NoTeam = createTeam("NoTeam", 255, 0, 0) 
  
local rnd = { 
    {2047.8, -1899.8, 13.5}, 
    {958.1, -1356.7, 13.3}, 
    {1128.7, -1490.5, 22.8}, 
    {2144.1, -1803.2, 16.1}, 
    {1716.9, -1682.1, 20.2}, 
    {1975.6, -1284.7, 28.5}, 
    {2027, 1916.7, 12.3}, 
    {2565.1, 1212.8, 14.3}, 
    {2535.5, 997.8, 14.3}, 
    {2542.3, 2213.5, 14.1}, 
    {2261.4, 2333.3, 10.8}, 
    {1954.2, 2323.9, 10.8}, 
} 
  
local teamSpawn = { 
    ["Grove"] = {2498.670, -1684.575, 13.416}, 
    ["Aztecas"] = {2498.670, -1684.575, 13.416}, 
    ["Police"] = {2498.670, -1684.575, 13.416}, 
    ["Ballas"] = {2498.670, -1684.575, 13.416}, 
    ["NoTeam"] = {2498.670, -1684.575, 13.416}, 
    ["Medic"] = {2498.670, -1684.575, 13.416}, 
} 
  
function SpawnNoTe (SkinID, team) 
    setPlayerTeam(source, getTeamFromName(team)) 
    setPlayerNametagColor(source, 255, 0, 0) 
    if (team == "NoTeam") then 
        local xn, yn, zn = unpack(rnd[math.random(#rnd)]) 
        spawnPlayer(source, xn, yn, zn, 0, SkinID, 0, 0) 
    else 
        local x, y, z = unpack(teamSpawn[team]) 
        spawnPlayer(source, x, y, z, 0, SkinID, 0, 0) 
    end 
    fadeCamera(source, true) 
    setCameraTarget(source) 
    exports["guimessages"]:outputServer(source, "أنت  الأن في فريق "..team, 255, 0, 0) 
end 
addEvent("Client:Spawn", true) 
addEventHandler("Client:Spawn", root, SpawnNoTe) 

Link to comment
Grove = createTeam("Grove", 0, 255, 0) 
Ballas = createTeam("Ballas", 255, 0, 255) 
Medic = createTeam("Medic", 0, 255, 255) 
Police = createTeam("Police", 0, 0, 255) 
Aztecas = createTeam("Aztecas", 0, 204, 204) 
NoTeam = createTeam("NoTeam", 255, 0, 0) 
  
local rnd = { 
    {2047.8, -1899.8, 13.5}, 
    {958.1, -1356.7, 13.3}, 
    {1128.7, -1490.5, 22.8}, 
    {2144.1, -1803.2, 16.1}, 
    {1716.9, -1682.1, 20.2}, 
    {1975.6, -1284.7, 28.5}, 
    {2027, 1916.7, 12.3}, 
    {2565.1, 1212.8, 14.3}, 
    {2535.5, 997.8, 14.3}, 
    {2542.3, 2213.5, 14.1}, 
    {2261.4, 2333.3, 10.8}, 
    {1954.2, 2323.9, 10.8}, 
} 
  
local teamSpawn = { 
    ["Grove"] = {2498.670, -1684.575, 13.416}, 
    ["Aztecas"] = {2498.670, -1684.575, 13.416}, 
    ["Police"] = {2498.670, -1684.575, 13.416}, 
    ["Ballas"] = {2498.670, -1684.575, 13.416}, 
    ["NoTeam"] = {2498.670, -1684.575, 13.416}, 
    ["Medic"] = {2498.670, -1684.575, 13.416}, 
} 
  
function SpawnNoTe (SkinID, team) 
    setPlayerTeam(source, getTeamFromName(team)) 
    setPlayerNametagColor(source, 255, 0, 0) 
    if (team == "NoTeam") then 
        local xn, yn, zn = unpack(rnd[math.random(#rnd)]) 
        spawnPlayer(source, xn, yn, zn, 0, SkinID, 0, 0) 
    else 
        local x, y, z = unpack(teamSpawn[team]) 
        spawnPlayer(source, x, y, z, 0, SkinID, 0, 0) 
    end 
    fadeCamera(source, true) 
    setCameraTarget(source) 
    exports["guimessages"]:outputServer(source, "أنت  الأن في فريق "..team, 255, 0, 0) 
end 
addEvent("Client:Spawn", true) 
addEventHandler("Client:Spawn", root, SpawnNoTe) 

مشكوووووووووووووور تم حل المشكلة

أسف علي كل التعب هذا :D

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