Jump to content

Problem with this spawn panel


Dannz0r

Recommended Posts

I dont know whats wront with this spawn panel but it only works with 2 teams i tryed to add more i couldnt here is the codes

Spawn-panel-client

SkinsID = {["Male 1"] = 46, ["Male 2"] = 47, ["Male 3"] = 48, ["Female"] = 216, ["Cop 1"] = 280, ["Cop 2"] = 281, ["SWAT"] = 285, ["FBI"] = 286 } 
Weapons = {["Pistol"] = 22, ["Desert Eagle"] = 24, ["Hunting Shotgun"]= 25, ["Micro-Uzi"] = 28, ["Knife"] = 4, ["Baseball Bat"] = 5} 
      
--//Ïîíåëü èãðîêà, ïîñëå çàõîäà â àêàóíò.     
--//Ìåíþ âûáîðà áàíäû.  
function step1gangs() 
if (source == getLocalPlayer()) then 
 if (not isCursorShowing()) then 
  showCursor(true) 
 end 
  
--if not lol then 
--lol = true 
GUIEditor_Window = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
GUIEditor_Column = {} 
SkinRow = {} 
WeaponRow = {} 
GUIEditor_Button = {} 
  
GUIEditor_Window[1] = guiCreateWindow(11,127,142,242,"Step 1",false) 
guiWindowSetSizable(GUIEditor_Window[1], false) 
guiWindowSetMovable(GUIEditor_Window[1], false) 
GUIEditor_Label[1] = guiCreateLabel(34,16,69,37,"Teams",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) 
guiSetFont(GUIEditor_Label[1],"sa-header") 
  
GUIEditor_Grid[1] = guiCreateGridList(9,54,124,179,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
GUIEditor_Column[1] = guiGridListAddColumn(GUIEditor_Grid[1],"Name:",1) 
  
--//Çîïàëíÿåì ëèñò íàçâàíèåì áàíä. 
Gang_Groov_Street = guiGridListAddRow(GUIEditor_Grid[1]) 
guiGridListSetItemText(GUIEditor_Grid[1], Gang_Groov_Street, GUIEditor_Column[1], "Civillian", false, false) 
Gang_Ballas  = guiGridListAddRow(GUIEditor_Grid[1]) 
guiGridListSetItemText(GUIEditor_Grid[1], Gang_Ballas, GUIEditor_Column[1], "Police", false, false) 
--//Êíîïêà äëÿ ñïàâíà 
GUIEditor_Button[1] = guiCreateButton(12,555,288,34,"SPAWN",false) 
guiSetFont(GUIEditor_Button[1],"sa-header") 
guiSetEnabled(GUIEditor_Button[1], false) 
addEventHandler("onClientGUIClick", GUIEditor_Button[1], playerSpawn) 
addEventHandler("onClientGUIClick", GUIEditor_Button[1], desWindow) 
addEventHandler("onClientGUIClick", GUIEditor_Grid[1], step2Skins) 
end 
--end 
end 
addEvent("step1gangs", true) 
addEventHandler("step1gangs", getRootElement(), step1gangs) 
  
--//Øàã 2 âûáîð ñêèíà ïîä áàíäó. 
function step2Skins() 
row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
if row and col and row ~= -1 and col ~= -1 then 
if (not GUIEditor_Window[2]) then 
GUIEditor_Window[2] = guiCreateWindow(11,372,142,179,"Step 2",false) 
guiWindowSetSizable(GUIEditor_Window[2], false) 
guiWindowSetMovable(GUIEditor_Window[2], false) 
GUIEditor_Label[2] = guiCreateLabel(36,17,66,30,"Skins",false,GUIEditor_Window[2]) 
guiLabelSetColor(GUIEditor_Label[2],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) 
guiSetFont(GUIEditor_Label[2],"sa-header") 
GUIEditor_Grid[2] = guiCreateGridList(9,50,124,120,false,GUIEditor_Window[2]) 
guiGridListSetSelectionMode(GUIEditor_Grid[2],2) 
GUIEditor_Column[2] = guiGridListAddColumn(GUIEditor_Grid[2],"Name:",1) 
  
SkinRow[1] = guiGridListAddRow(GUIEditor_Grid[2]) 
SkinRow[2]  = guiGridListAddRow(GUIEditor_Grid[2]) 
SkinRow[3] = guiGridListAddRow(GUIEditor_Grid[2]) 
SkinRow[4] = guiGridListAddRow(GUIEditor_Grid[2]) 
  
addEventHandler("onClientGUIClick", GUIEditor_Grid[2], step3weapons) 
end 
  
 if ped then 
 destroyElement(ped) 
 end 
 if (guiGridListGetItemText(GUIEditor_Grid[1], row, col) == "Civillian") then 
  guiGridListSetItemText(GUIEditor_Grid[2], SkinRow[1], GUIEditor_Column[2], "Male 1", false, false) 
  guiGridListSetItemText(GUIEditor_Grid[2], SkinRow[2], GUIEditor_Column[2], "Male 2", false, false) 
  guiGridListSetItemText(GUIEditor_Grid[2], SkinRow[3], GUIEditor_Column[2], "Male 3", false, false) 
  guiGridListSetItemText(GUIEditor_Grid[2], SkinRow[4], GUIEditor_Column[2], "Female", false, false) 
  AddCameraMatrixAndPedGangZone(guiGridListGetItemText(GUIEditor_Grid[1], row, col)) 
  elseif (guiGridListGetItemText(GUIEditor_Grid[1], row, col) == "Police") then 
  guiGridListSetItemText(GUIEditor_Grid[2], SkinRow[1], GUIEditor_Column[2], "Cop 1", false, false) 
  guiGridListSetItemText(GUIEditor_Grid[2], SkinRow[2], GUIEditor_Column[2], "Cop 2", false, false) 
  guiGridListSetItemText(GUIEditor_Grid[2], SkinRow[3], GUIEditor_Column[2], "SWAT", false, false) 
  guiGridListSetItemText(GUIEditor_Grid[2], SkinRow[4], GUIEditor_Column[2], "FBI", false, false) 
  AddCameraMatrixAndPedGangZone(guiGridListGetItemText(GUIEditor_Grid[1], row, col))    
 end 
end 
end 
  
  
--//3 øàã, âûáîð îðóæåÿ. 
function step3weapons() 
row,col = guiGridListGetSelectedItem(GUIEditor_Grid[2]) 
if row and col and row ~= -1 and col ~= -1 then 
  
setElementModel(ped, SkinsID[guiGridListGetItemText(GUIEditor_Grid[2], row, col)]) 
  
 if (not GUIEditor_Window[3]) then 
 addEventHandler("onClientRender", getRootElement(), renderSpawnButton) 
  
 GUIEditor_Window[3] = guiCreateWindow(157,127,142,424,"Step 3",false) 
 guiWindowSetSizable(GUIEditor_Window[3], false) 
 guiWindowSetMovable(GUIEditor_Window[3], false) 
 GUIEditor_Label[3] = guiCreateLabel(23,17,99,32,"Weapons",false,GUIEditor_Window[3]) 
 guiLabelSetColor(GUIEditor_Label[3],255,255,255) 
 guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") 
 guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) 
 guiSetFont(GUIEditor_Label[3],"sa-header") 
 --//Îðóæèÿ 1 ñëîòà 
 GUIEditor_Grid[3] = guiCreateGridList(9,67,124,113,false,GUIEditor_Window[3]) 
 guiGridListSetSelectionMode(GUIEditor_Grid[3],2) 
 GUIEditor_Column[3] = guiGridListAddColumn(GUIEditor_Grid[3],"Name",1) 
 GUIEditor_Label[4] = guiCreateLabel(16,53,37,14,"Slot 1:",false,GUIEditor_Window[3]) 
 guiLabelSetColor(GUIEditor_Label[4],255,255,255) 
 guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") 
 guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) 
 guiSetFont(GUIEditor_Label[4],"default-bold-small") 
 WeaponRow[1] = guiGridListAddRow(GUIEditor_Grid[3]) 
 WeaponRow[2] = guiGridListAddRow(GUIEditor_Grid[3]) 
 guiGridListSetItemText(GUIEditor_Grid[3], WeaponRow[1], GUIEditor_Column[3], "Pistol", false, false) 
 guiGridListSetItemText(GUIEditor_Grid[3], WeaponRow[2], GUIEditor_Column[3], "Desert Eagle", false, false)   
 --//Îðóæèÿ 2 ñëîòà  
 GUIEditor_Grid[4] = guiCreateGridList(9,195,124,113,false,GUIEditor_Window[3]) 
 guiGridListSetSelectionMode(GUIEditor_Grid[4],2) 
 GUIEditor_Column[4] = guiGridListAddColumn(GUIEditor_Grid[4],"Name",1) 
 GUIEditor_Label[5] = guiCreateLabel(16,181,37,14,"Slot 2:",false,GUIEditor_Window[3]) 
 guiLabelSetColor(GUIEditor_Label[5],255,255,255) 
 guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") 
 guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false) 
 guiSetFont(GUIEditor_Label[5],"default-bold-small") 
 WeaponRow[3] = guiGridListAddRow(GUIEditor_Grid[4]) 
 WeaponRow[4] = guiGridListAddRow(GUIEditor_Grid[4]) 
 guiGridListSetItemText(GUIEditor_Grid[4], WeaponRow[3], GUIEditor_Column[4], "Hunting Shotgun", false, false) 
 guiGridListSetItemText(GUIEditor_Grid[4], WeaponRow[4], GUIEditor_Column[4], "Micro-Uzi", false, false)  
 --//Îðóæèÿ 3 ñëîòà  
 GUIEditor_Grid[5] = guiCreateGridList(9,321,124,93,false,GUIEditor_Window[3]) 
 guiGridListSetSelectionMode(GUIEditor_Grid[5],2) 
 GUIEditor_Column[5] = guiGridListAddColumn(GUIEditor_Grid[5],"Name",1) 
 GUIEditor_Label[6] = guiCreateLabel(16,307,37,14,"Slot 3:",false,GUIEditor_Window[3]) 
 guiLabelSetColor(GUIEditor_Label[6],255,255,255) 
 guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") 
 guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) 
 guiSetFont(GUIEditor_Label[6],"default-bold-small") 
 WeaponRow[5] = guiGridListAddRow(GUIEditor_Grid[5]) 
 WeaponRow[6] = guiGridListAddRow(GUIEditor_Grid[5]) 
 guiGridListSetItemText(GUIEditor_Grid[5], WeaponRow[5], GUIEditor_Column[5], "Knife", false, false) 
 guiGridListSetItemText(GUIEditor_Grid[5], WeaponRow[6], GUIEditor_Column[5], "Baseball Bat", false, false) 
 end 
end 
end 
--//Ñîçäàíèå áîòà è íàïðîâëåíèÿ êàìåðû çîíû áàíä. 
function AddCameraMatrixAndPedGangZone(gangName) 
if ped then 
 destroyElement(ped) 
end 
if (gangName == "Civillian") then 
setCameraMatrix(2009.6099853516, 1800.4509277344, 23.755895614624, 2009.6099853516, 1800.4509277344, 23.755895614624) 
ped = createPed(46, 2009.1154785156, 1810.5543212891, 22.852224349976) 
setPedRotation(ped, 180) 
setPedAnimation(ped, "ped", "roadcross_gang") 
elseif (gangName == "Police") then 
setCameraMatrix(-329.6953125, 1530.2965087891, 77.23804473877,  -329.6953125, 1530.2965087891, 77.23804473877) 
ped = createPed(285, -329.50927734375, 1536.6655273438, 76.233581542969) 
setPedRotation(ped, 181.52386474609) 
setPedAnimation(ped, "ped", "roadcross_gang") 
end 
end 
  
function renderSpawnButton() 
local row, col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
local row2, col2 = guiGridListGetSelectedItem(GUIEditor_Grid[2]) 
 if row ~= -1 and col ~= -1 and row2 ~= -1 and col2 ~= -1 then 
  if (guiGetEnabled(GUIEditor_Button[1]) == false) then 
  guiSetEnabled(GUIEditor_Button[1], true) 
  end 
 else 
  if (guiGetEnabled(GUIEditor_Button[1]) == true) then 
  guiSetEnabled(GUIEditor_Button[1], false) 
  end 
 end 
end 
  
function playerSpawn() 
local row, col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
local GangName = guiGridListGetItemText(GUIEditor_Grid[1], row, col) 
  
local row, col = guiGridListGetSelectedItem(GUIEditor_Grid[2]) 
local SkinID = SkinsID[guiGridListGetItemText(GUIEditor_Grid[2], row, col)] 
  
if guiGridListGetSelectedItem(GUIEditor_Grid[3]) then 
local row, col = guiGridListGetSelectedItem(GUIEditor_Grid[3]) 
WeaponSlot1 = Weapons[guiGridListGetItemText(GUIEditor_Grid[3], row, col)] 
end 
  
if guiGridListGetSelectedItem(GUIEditor_Grid[4]) then 
local row, col = guiGridListGetSelectedItem(GUIEditor_Grid[4]) 
WeaponSlot2 = Weapons[guiGridListGetItemText(GUIEditor_Grid[4], row, col)] 
end 
  
if guiGridListGetSelectedItem(GUIEditor_Grid[5]) then 
local row, col = guiGridListGetSelectedItem(GUIEditor_Grid[5]) 
WeaponSlot3 = Weapons[guiGridListGetItemText(GUIEditor_Grid[5], row, col)] 
end 
triggerServerEvent("playerSpawn", getLocalPlayer(), GangName, SkinID, WeaponSlot1, WeaponSlot2, WeaponSlot3) 
end 
  
function desWindow() 
 if (source == GUIEditor_Button[1]) then 
  removeEventHandler("onClientRender", getRootElement(), renderSpawnButton) 
  destroyElement(GUIEditor_Button[1]) 
  destroyElement(GUIEditor_Window[1]) 
  destroyElement(GUIEditor_Window[2]) 
  destroyElement(GUIEditor_Window[3]) 
  showCursor(false) 
   if ped then 
    destroyElement(ped) 
   end     
 end 
end 

Spawn-panel-server

--//Ñîçäà¸ì êîìàíäû áàíä 
Groov_Street = createTeam("Civillian", 0, 179, 4) 
setTeamFriendlyFire(Groov_Street , false) 
Ballas = createTeam("Police", 0, 1000, 0) 
setTeamFriendlyFire(Ballas , false) 
  
--//Òàáëèöà ðåñïàâíîâ. 
Respawns = {["Civillian"] = {2494.3540039063, -1685.6320800781, 13.511992454529}, ["Police"] = {2252.7224121094, 2491.8293457031, 10.990804672241}} 
Weapons1 = {}     
Weapons2 = {}     
Weapons3 = {}     
blipPlayers = {}  
--//Ñïàâí èãðîêà. 
function playerSpawn(GangName, SkinID, WeaponSlot1, WeaponSlot2, WeaponSlot3)      
spawnPlayer(source, Respawns[GangName][1],Respawns[GangName][2],Respawns[GangName][3], 0, SkinID, 0, 0) 
setPlayerTeam(source, getTeamFromName(GangName)) 
fadeCamera(source, true) 
setCameraTarget(source, source) 
  
if WeaponSlot1 then 
giveWeapon(source, WeaponSlot1, 90, true) 
Weapons1[getPlayerName(source)] = WeaponSlot1  
end 
  
if WeaponSlot2 then 
giveWeapon(source, WeaponSlot2, 70, true) 
Weapons2[getPlayerName(source)] = WeaponSlot2 
end 
  
if WeaponSlot3 then 
giveWeapon(source, WeaponSlot3, 1, false) 
Weapons3[getPlayerName(source)] = WeaponSlot3 
end 
  
  
end 
addEvent("playerSpawn", true) 
addEventHandler("playerSpawn", getRootElement(), playerSpawn) 
  
--//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. 
function RespawnPlayer(source, skin) 
local teamNeme = getTeamName(getPlayerTeam(source)) 
spawnPlayer(source, Respawns[teamNeme][1],Respawns[teamNeme][2],Respawns[teamNeme][3], 0, skin, 0, 0)     
  
if Weapons1[getPlayerName(source)] then 
giveWeapon(source, Weapons1[getPlayerName(source)], 90, true) 
end 
  
if Weapons2[getPlayerName(source)] then 
giveWeapon(source, Weapons2[getPlayerName(source)], 70, true) 
end 
  
if Weapons3[getPlayerName(source)] then 
giveWeapon(source, Weapons3[getPlayerName(source)], 1, false) 
end 
  
if (isPedHeadless(source) == true) then--//Äîáîâëÿåì èãðîêó ãîëîâó åñëå å¸ íåò. 
setPedHeadless(source, false) 
end   
end         
  
--//Ðåñïàâí èãðîêà ïîñëå ñìåðòè.  
function respawnDead(ammo, attacker, weapon, bodypart) 
if attacker then 
 if (getElementType(attacker) == "player") then 
  setPlayersStatsIFattackerPlayer(source, attacker) 
 elseif (getElementType(attacker) == "vehicle") then 
  setPlayersStatsIFattackerVehicle(source, attacker) 
 end 
end  
  
if (getElementData(source,"F4") == false) then 
 setTimer(RespawnPlayer, 5000, 1, source, getElementModel(source)) 
elseif (getElementData(source,"F4") == true) then 
 setTimer(triggerClientEvent, 5000, 1, "step1gangs", source) 
 setElementData(source,"F4", false) 
end 
end 
addEventHandler("onPlayerWasted", getRootElement(), respawnDead) 
  
--//Óäîëÿåì ïðè ðåñïàâíå àâòîìîáèëÿ, äàííóþ î òîì êòî â íå¸ ñòðåëÿë, â ðåçóëüòàòå ÷åãî îíà âçîðâàëàñü. 
playersDamageVihecle = {}--//Òàáëèöà Àòàêóåùèõ àâòîìîáèëåé (åñëå ïîñëå íèõ òà÷êà çàãàðåëàñü). 
function onVehicleRespawn(exploded) 
if (getElementType(source) == "vehicle") then 
 if playersDamageVihecle[source] then 
  playersDamageVihecle[source] = nil 
   
  if not playersDamageVihecle[source] then 
   outputChatBox("", getRootElement(), 0, 0, 0,true) 
  end 
   
 end 
end  
end 
addEventHandler("onVehicleRespawn", getRootElement(), onVehicleRespawn) 
  
function quitPlayer() 
local playername = getPlayerName(source) 
  destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. 
local theAccount = getPlayerAccount(source) 
setAccountData(theAccount, "money", getPlayerMoney(source))   
end 
addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) 
  
--//Áèíäèì êëàâèøó F4 
function joinplayerBindkey() 
bindKey(source,"F4", "down", nextGang) 
end 
addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) 
  
--//F4 ñìåíà êîìàíäû. Ïîñëå ñìåðòè. 
function nextGang(player, key, keyState) 
 if (getElementData(player,"F4") == false) or (not getElementData(player,"F4")) then 
  outputChatBox("#CC0033[F4]:  #339933Is Disabled!", player, 0, 0, 0,true) 
  setElementData(player,"F4", true) 
 elseif (getElementData(player,"F4") == true) then 
  outputChatBox("#CC0033[F4]: #339933Is disabled", player, 0, 0, 0,true) 
  setElementData(player,"F4", false) 
 end  
end 

what do i have to do to add more teams ? here is the details of the other teams that i want to add

[TEAMS]

Team 1: Army Force

Team 2: Demilitarized Zone

Team 3: The Mafia

[WEAPONS ID] [sKIN]

Slot 1:24,27,28,31,15 1:73,179,287

Slot 2:30,34,32,26,23,4,5 2:114,115,116

Slot 3:30,34,32,26,23,4,5 3:125,126,127

[sPAWN COORDINATES]

Team 1: posX 206.1700592041 posY 1860.0698242188 posZ 13.140625

Team 2: posX 2494.3540039063 posY -1685.6320800781 posZ 13.511992454529

Team 3: posX -1895.2487792969 posY -1681.8607177734 posZ 23.015625

Link to comment

Well, the code is fine, the only problem is that all teams, weapons, etc are hard-coded into script, and you have to modify it all to achieve such changes.

So if the code is fine, and you want us to rewrite the code - this is a request. And we are not fullfilling requests.

AFAIK - you got this script from somebody, and it was written upon request - ask creator to add such features you need then. If I'm wrong - you have to learn lua a bit.

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