Jump to content

Alen141

Members
  • Posts

    105
  • Joined

  • Last visited

Everything posted by Alen141

  1. Hey guys, recently I got a spawn script, but as player joins the server the GUI dosen't show up.. and i have to slap myself to show it script : local localPlayer = getLocalPlayer() local resX, resY = guiGetScreenSize() local centerX = resX / 2 local centerY = resY / 2 local windowX = 400 local windowY = 410 local leftX = 20 local bottomY = resY - windowY - 20 local xml = xmlLoadFile("spawns.xml") -- open the XML file local cityNodes = xmlNodeGetChildren(xml) -- get all child nodes of the root node () local cities = {} -- create a new global variable to store the welcome messages for i,node in ipairs(cityNodes) do cityname = xmlNodeGetAttribute(node, "name") local classnodes = xmlNodeGetChildren(node) cities[cityname] = {} for i2,node2 in ipairs(classnodes) do classname = xmlNodeGetAttribute(node2, "name") local spawnnodes = xmlNodeGetChildren(node2) cities[cityname][classname] = {} for i3, node3 in ipairs(spawnnodes) do skinName = xmlNodeGetAttribute(node3, "name") cities[cityname][classname][skinName] = {} cities[cityname][classname][skinName]["spawnX"] = xmlNodeGetAttribute(node3, "spawnX") cities[cityname][classname][skinName]["spawnY"] = xmlNodeGetAttribute(node3, "spawnY") cities[cityname][classname][skinName]["spawnZ"] = xmlNodeGetAttribute(node3, "spawnZ") cities[cityname][classname][skinName]["skin"] = xmlNodeGetAttribute(node3, "skin") cities[cityname][classname][skinName]["permission"] = xmlNodeGetAttribute(node3, "permission") cities[cityname][classname][skinName]["information"] = xmlNodeGetAttribute(node3, "information") cities[cityname][classname][skinName]["weapons"] = xmlNodeGetAttribute(node3, "weapons") end end end xmlUnloadFile(xml) addEventHandler("onClientResourceStart", resourceRoot, client ) function drawSpawnScreen() spawnWindow = guiCreateWindow(55, 140, 503, 430, "Spawn Menu", false) guiWindowSetMovable(spawnWindow, false) guiWindowSetSizable(spawnWindow, false) infoMemo = guiCreateMemo(20, 19, 474, 90, "", false, spawnWindow) guiMemoSetReadOnly(infoMemo, true) cityGridList = guiCreateGridList(20, 127, 173, 284, false, spawnWindow) guiGridListAddColumn(cityGridList, "City's", 0.9) classGridList = guiCreateGridList(194, 127, 145, 183, false, spawnWindow) guiGridListAddColumn(classGridList, "Classe's", 0.9) skinGridList = guiCreateGridList(349, 127, 132, 184, false, spawnWindow) guiGridListAddColumn(skinGridList, "Skin's", 0.9) spawnScreenOKButton = guiCreateButton(277, 320, 128, 67, "Spawn", false, spawnWindow) for n, v in pairs(cities) do local row = guiGridListAddRow(cityGridList) guiGridListSetItemText(cityGridList, row, 1, n, false, false) end guiSetVisible(spawnWindow, false) addEventHandler("onClientGUIClick", cityGridList, onCityClick) addEventHandler("onClientGUIClick", classGridList, onClassClick) addEventHandler("onClientGUIClick", skinGridList, onSkinClick) addEventHandler("onClientGUIClick", spawnScreenOKButton, onSpawnButtonClick) fadeCamera(true) guiSetVisible(spawnWindow, true) guiGridListSetSelectedItem(skinGridList, -1, 0) showCursor(true) showPlayerHudComponent ("all",false) end function onCityClick(button) if source == cityGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 then guiGridListClear(classGridList) local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local cityClasses = cities[cityName] for x, y in pairs(cityClasses) do local row = guiGridListAddRow(classGridList) guiGridListSetItemText(classGridList, row, 1, x, false, false) end guiSetProperty(spawnScreenOKButton, "Disabled", "True") end end end function onClassClick(button) if source == classGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 0 then guiGridListClear(skinGridList) local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, selectedRow, selectedCol ) -- get its text local classSkins = cities[cityName][className] for x, y in pairs(classSkins) do local row = guiGridListAddRow(skinGridList) guiGridListSetItemText(skinGridList, row, 1, x, false, false) end guiSetProperty(spawnScreenOKButton, "Disabled", "True") end end end function onSkinClick(button) if source == skinGridList and button == "left" then if guiGridListGetSelectedCount(cityGridList) > 0 and guiGridListGetSelectedCount(classGridList) > 0 and guiGridListGetSelectedCount( skinGridList ) > 0 then local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( skinGridList ); -- get double clicked item in the gridlist local skinName = guiGridListGetItemText( skinGridList, selectedRow, selectedCol ) -- get its text guiSetProperty(spawnScreenOKButton, "Disabled", "False") guiSetText(infoMemo, cities[cityName][className][skinName]["information"]) end end end function onSpawnButtonClick(button) if source == spawnScreenOKButton and button == "left" then if guiGridListGetSelectedCount( cityGridList ) > 0 and guiGridListGetSelectedCount( classGridList ) > 0 and guiGridListGetSelectedCount( skinGridList ) > 0 then local selectedRow, selectedCol = guiGridListGetSelectedItem( cityGridList ); -- get double clicked item in the gridlist local cityName = guiGridListGetItemText( cityGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( classGridList ); -- get double clicked item in the gridlist local className = guiGridListGetItemText( classGridList, selectedRow, selectedCol ) -- get its text local selectedRow, selectedCol = guiGridListGetSelectedItem( skinGridList ); -- get double clicked item in the gridlist local skinName = guiGridListGetItemText( skinGridList, selectedRow, selectedCol ) -- get its text local spawninfo = cities[cityName][className][skinName] setElementData ( client, "Class", skinName ) triggerServerEvent("onPlayerSpawnButton", getLocalPlayer(), spawninfo["spawnX"] , spawninfo["spawnY"], spawninfo["spawnZ"], className, spawninfo['permission'], spawninfo['skin'],spawninfo['weapons'], getLocalPlayer(), skinName) else displayError("Please make a selection!") end end end function hideSpawnScreen() if spawnWindow then guiSetVisible(spawnWindow, false) showCursor(false) if errorWindow then guiSetVisible(errorWindow, false) end guiSetText(infoMemo, "") currentSpawn = false currentWeapons = false currentColors = {} currentLocation = {} end showPlayerHudComponent ("all",true) end addEvent("onSpawnSuccessful", true) addEventHandler("onSpawnSuccessful", getRootElement(), hideSpawnScreen) function createMessageBox() errorWindow = guiCreateWindow(resX / 2 - 150, resY / 2 - 100, 300, 200, "Spawn Error", false) errorLabel = guiCreateMemo(5, 25, 295, 125, "", false, errorWindow) guiMemoSetReadOnly(errorLabel, true) errorWindowButton = guiCreateButton(110, 160, 80, 25, "OK", false, errorWindow) guiWindowSetMovable(errorWindow, false) guiWindowSetSizable(errorWindow, false) guiSetVisible(errorWindow, false) addEventHandler("onClientGUIClick", errorWindowButton, function() guiSetVisible(errorWindow, false) guiSetProperty(errorWindow, "AlwaysOnTop", "False") end, false) end function displayError(error) if not errorWindow then createMessageBox() end guiSetText(errorLabel, error) guiSetProperty(errorWindow, "AlwaysOnTop", "True") guiSetVisible(errorWindow, true) end addEvent("onSpawnError", true) addEventHandler("onSpawnError", getRootElement(), displayError) addCommandHandler( "spawnerror",displayError) function checkPlayerAlive() triggerServerEvent("wasPlayerAliveEvent", getLocalPlayer()) end addEvent("onPlayerLoginSuccess", true) addEventHandler("onPlayerLoginSuccess", getRootElement(), checkPlayerAlive) addEventHandler("onClientPlayerLoginSucces", getLocalPlayer(), drawSpawnScreen) addEventHandler("onClientPlayerWasted", getLocalPlayer(), drawSpawnScreen) addEvent("onPlayerWasntAlive", true) addEventHandler("onPlayerWasntAlive", getRootElement(), drawSpawnScreen) function stopMinigunDamage ( attacker, weapon, bodypart ) if ( getTeamName(getPlayerTeam(source)) == "PanAm Trainers" ) then if ( getTeamName(getPlayerTeam(attacker)) ~= "PanAm Trainers" ) then cancelEvent() end end end addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), stopMinigunDamage ) fileDelete("spawn_client.lua")
  2. Alen141

    Need help,

    will this be ok too? robber1 = createVehicle ( 413, 755.619140625,1980.3388671875,5.3359375, 0,0,84.406494140625 ) robber2 = createVehicle ( 413, 756.6923828125,1985.634765625,5.3359375, 0,0,88.817565917969 ) function lockRob ( player, seat, jacked ) if ( source == robber1 or source == robber2 ) then local team = getPlayerTeam ( player ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName ~= "Robber" ) then cancelEvent ( ) outputChatBox ( "Only Robbers are allowed to use this vehicle!", player, 255, 0, 0, true ) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockRob )
  3. Alen141

    Need help,

    I know that, but I know to do it only this way car1 = createvehicle (...) car2 = createvehicle (...) if ( source == car1 or source == car2 ) then ----CHECK IF TEAM and so on can u tell me how to make idk, maybe like table and then if source == tablename
  4. Alen141

    Need help,

    hey guys I wanted to know how to set a new data name in the .map file called "team" and then using script check for team, if not in team he gets some message!
  5. you have to change type of script in meta file,add this after your file name type="client"
  6. I'm trying to make teams(you called them classes) classes(etc. Police>"FBI"- class or subtype), and I don't like password acces too much( cuz let's be honest nobody will keep their mouth shut ) I tried doing it for teams and it worked, it checked if acl group is equal to class.name, but then i tried replacing it with skin.name and i got an error WARNING: spawnsystem\s_main.lua:22: Bad argument @ 'aclGetGroup' NO OFFENCE! - you are great scripter
  7. It works for me --server side -- Setting water properties. height = 0 SizeVal = 2998 -- Defining variables. southWest_X = -SizeVal southWest_Y = -SizeVal southEast_X = SizeVal southEast_Y = -SizeVal northWest_X = -SizeVal northWest_Y = SizeVal northEast_X = SizeVal northEast_Y = SizeVal -- OnClientResourceStart function that creates the water. function thaResourceStarting( ) setWaterLevel ( -500, false, false ) water = createWater ( southWest_X, southWest_Y, height, southEast_X, southEast_Y, height, northWest_X, northWest_Y, height, northEast_X, northEast_Y, height ) setWaterLevel ( water, height ) end addEventHandler("onClientResourceStart", resourceRoot, thaResourceStarting) local maxLevel = 35 -- max level local untilW = 120 -- sec local raising,level = (maxLevel/untilW)/10,0 untilW = nil local runningTimer function editSomeWater() level = level + raising -- level raising setWaterLevel ( water, level ) -- set the level if level >= maxLevel then -- compare values of level and max level setWaterLevel ( water, maxLevel ) -- set it back to max level for perfection if isTimer(runningTimer) then -- check if the timer exist killTimer(runningTimer) -- stop the timer end runningTimer,level,maxLevel = nil,nil,nil -- delete data (ram) end end setTimer (function () -- set a timer for 15000 millisec (15 sec), runs one time "1" runningTimer = setTimer ( editSomeWater, 100, 0 ) -- set an invinity timer to set the water level, (0 = invinity) (only stops when you stop him with killTimer) end,30000,1) outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true ) outputChatBox ( "#FF0000Water starts to rise in 30sec! Be fast^^", getRootElement(), 255, 255, 255, true )
  8. addEvent("buyGodMode", true) addEventHandler("buyGodMode", rootElement, function() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if ( getPlayerMoney (source) >= 70000 ) then takePlayerMoney(source, 70000) outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else takePlayerMoney(source, 70000) outputChatBox("Only for Admins, but you loose money for trying to buy", source, 255, 0, 0, true) end end end ) Try this ( if the player has 100 dolars his money will turn red( -69900 ).. is that ok? )
  9. so if normal player tries to buy it he only loses money and dosen't get one and admins lose money and get one? is that right?
  10. this is going to take player money and then tell him that he's not an admin EDIT : Try this code addEvent("buyGodMode", true) addEventHandler("buyGodMode", rootElement, function() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then if ( getPlayerMoney (source) >= 70000 ) then takePlayerMoney(source, 70000) outputChatBox("Godmode Successfully activated", source, 255, 255, 0, true) setVehicleDamageProof(getPedOccupiedVehicle(source),true) setTimer( setVehicleDamageProof, 60000, 1, getPedOccupiedVehicle(source), false) else outputChatBox("Not enough money or you're not an admin!", source, 255, 0, 0, true) end end end )
  11. Hey guys I just need a bit of help with script. Original script : https://community.multitheftauto.com/in ... ls&id=1152 What I want to do here is ask server to check if skin name is equal to acl group. If not then tell player to chose other spawn and if it is continue to spawn process!
  12. dxDrawImage(size*SIZEHERE+v[1]-x,size*SIZEHERE+v[2]-y,v[3],v[4],v[5],v[6],0,0,tocolor(255,255,255),false) play with this a bit elemData[v][1]=getElementData(v,'blipText') elemData[v][2]=getElementData(v,'customBlipPath')
  13. Alen141

    Help me

    why would you cancel explosion?
  14. Group = { }; Group.__index = { }; function Group: New( groupElement ) local group = { name = "", classes = { }, }; if getElementType( groupElement ) == "category" then setmetatable( group, self ); self.__index = self; group.name = getElementData( groupElement, "id" ); local children = getElementChildren( groupElement ); for _, child in ipairs( children ) do table.insert( group.classes, Class:New( child ) ); end return group; end return false; end --[[================================================================================]]-- --[[================================================================================]]-- Class = { }; Class.__index = Class; function Class: New( classElement ) local class = { name = "", info = "", color = { red = 255, green = 255, blue = 255 }, skinMngr = SkinManager:New( ), weaponMngr = WeaponManager:New( ), cameraMngr = CameraManager:New( ), } if getElementType( classElement ) == "class" then setmetatable( class, self ); self.__index = self; class.weaponMngr.__index = class.weaponMngr; class.name = getElementData( classElement, "name" ); local classData = getElementChildren( classElement ); for _, data in ipairs( classData ) do if getElementType( data ) == "info" then class.info = getElementData( data, "text" ); elseif getElementType( data ) == "color" then class.color.red = tonumber( 0 and getElementData( data, "red" ) or 255 ); class.color.green = tonumber( 0 and getElementData( data, "green" ) or 255 ); class.color.blue = tonumber( 0 and getElementData( data, "blue" ) or 255 ); elseif getElementType( data ) == "skin" then class.skinMngr:AddSkin( data ); elseif getElementType( data ) == "weapon" then class.weaponMngr:AddWeapon( data ); elseif getElementType( data ) == "camera" then local camChildren = getElementChildren( data ); for _, camInfo in ipairs( camChildren ) do if getElementType( camInfo ) == "position" then class.cameraMngr:Position( camInfo ); elseif getElementType( camInfo ) == "lookAt" then class.cameraMngr:LookAt( camInfo ); end end end end return class; end return false; end --[[================================================================================]]-- --[[================================================================================]]-- CameraManager = { }; CameraManager.__index = CameraManager; function CameraManager: New( ) local cameramngr = { pos = { }, lookAt = { }, }; setmetatable( cameramngr, self ); self.__index = self; return cameramngr; end function CameraManager: Position( cameraPosElement ) if cameraPosElement then self.pos.x = tonumber( getElementData( cameraPosElement, "x" ) ); self.pos.y = tonumber( getElementData( cameraPosElement, "y" ) ); self.pos.z = tonumber( getElementData( cameraPosElement, "z" ) ); else return self.pos.x, self.pos.y, self.pos.z; end end function CameraManager: LookAt( cameraLookAtElement ) if cameraLookAtElement then self.lookAt.x = tonumber( getElementData( cameraLookAtElement, "x" ) ); self.lookAt.y = tonumber( getElementData( cameraLookAtElement, "y" ) ); self.lookAt.z = tonumber( getElementData( cameraLookAtElement, "z" ) ); else return self.lookAt.x, self.lookAt.y, self.lookAt.z; end end --[[================================================================================]]-- --[[================================================================================]]-- Skin = { }; Skin.__index = Skin; function Skin: New( skinElement ) local skin = { name = "", modelId = 0, weaponMngr = WeaponManager:New( ), spawnLoc = { x, y, z }, } if getElementType( skinElement ) == "skin" then setmetatable( skin, self ); self.__index = self; --setmetatable( skin.weaponMngr, WeaponManager ); skin.weaponMngr.__index = skin.weaponMngr; skin.name = getElementData( skinElement, "name" ); skin.modelId = getElementData( skinElement, "id" ); local children = getElementChildren( skinElement ); for _, child in ipairs( children ) do if getElementType( child ) == "spawnpoint" then skin.spawnLoc.x = tonumber( getElementData( child, "x" ) ); skin.spawnLoc.y = tonumber( getElementData( child, "y" ) ); skin.spawnLoc.z = tonumber( getElementData( child, "z" ) ); skin.spawnLoc.rot = tonumber( getElementData( child, "rot" ) ); elseif getElementType( child ) == "weapon" then skin.weaponMngr:AddWeapon( child ); end end return skin; end return false; end function Skin: GetSpawnPosition( ) return self.spawnLoc.x, self.spawnLoc.y, self.spawnLoc.z; end --[[================================================================================]]-- --[[================================================================================]]-- SkinManager = { }; SkinManager.__index = SkinManager; function SkinManager: New( ) local skinmngr = { skins = { }, }; setmetatable( skinmngr, self ); self.__index = self; return skinmngr; end function SkinManager: AddSkin( skinElement ) table.insert( self.skins, Skin:New( skinElement ) ); end function SkinManager: GetSkins( ) return self.skins; end --[[================================================================================]]-- --[[================================================================================]]-- Weapon = { }; Weapon.__index = Weapon; function Weapon: New( weaponElement ) local weapon = { id = 0, ammo = 0, }; if getElementType( weaponElement ) == "weapon" then setmetatable( weapon, self ); self.__index = self; weapon.id = tonumber( getElementData( weaponElement, "id" ) ); weapon.ammo = tonumber( getElementData( weaponElement, "ammo" ) ); return weapon; end return false; end --[[================================================================================]]-- --[[================================================================================]]-- WeaponManager = { }; WeaponManager.__index = WeaponManager; function WeaponManager: New( ) local weaponmngr = { weapons = { }, }; setmetatable( weaponmngr, self ); self.__index = self; return weaponmngr; end function WeaponManager: AddWeapon( weaponElement ) table.insert( self.weapons, Weapon:New( weaponElement ) ); end function WeaponManager: GetWeapons( ) local weapons = { }; for i, weapon in ipairs( self.weapons ) do weapons[ i ] = { }; weapons[ i ].id = weapon.id; weapons[ i ].ammo = weapon.ammo; end return weapons; end function WeaponManager: WeaponCount( ) return #self.weapons; end
  15. still don't work
  16. Alen141

    Not hosting

    maybe you did the following : a) "read uhms post" b) in mta server.conf you puted your IP in here c)you didn't correctly ported ( 22003,22005 and 22126)
  17. if i put client instead?
  18. function( categoryIndex, classIndex, skinIndex, password, aclRestrict ) if skinIndex then local class = classGroups[ categoryIndex ].classes[ classIndex ]; if class.aclRestrict then local playerAccountName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ("user." .. playerAccountName, aclGetGroup(aclRestrict)) then if not aclRestrict or aclRestrict == "" then outputChatBox( "You have no permission!", client, 200, 50, 50 ); return; elseif aclRestrict ~= class.aclRestrict then outputChatBox( "The password you typed in is incorrect! Try again or cancel to choose different class.", client, 200, 50, 50 ); end end end ERROR: WARNING: spawned\s_main.lua:12: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] [time] WARNING: spawned\s_main.lua:12: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [time] ERROR: spawned\s_main.lua:13: attempt to concatenate local 'playerAccountName' (a boolean value) [time] WARNING: spawned\s_main.lua:12: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] [time] WARNING: spawned\s_main.lua:12: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean] [time] ERROR: spawned\s_main.lua:13: attempt to concatenate local 'playerAccountName' (a boolean value)
  19. Hey guys...I just want to say that this is not relly big deal cuse i made spawn script,but i just can't figure out what should i put in this script to workhttps://community.multitheftauto.com/?p=resources&s=details&id=1152 [acl team restriction]
  20. wait is this client + server? : DestructionDerby = setmetatable({}, RaceMode) DestructionDerby.__index = DestructionDerby DestructionDerby:register('Destruction derby') function DestructionDerby:isApplicable() return not RaceMode.checkpointsExist() and RaceMode.getMapOption('respawn') == 'none' end function DestructionDerby:getPlayerRank(player) return #getActivePlayers() end -- Copy of old updateRank function DestructionDerby:updateRanks() for i,player in ipairs(g_Players) do if not isPlayerFinished(player) then local rank = self:getPlayerRank(player) if not rank or rank > 0 then setElementData(player, 'race rank', rank) end end end -- Make text look good at the start if not self.running then for i,player in ipairs(g_Players) do setElementData(player, 'race rank', '' ) setElementData(player, 'checkpoint', '' ) end end end function DestructionDerby:onPlayerWasted(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 0 then RaceMode.endMap() else TimerManager.createTimerFor("map",player):setTimer(clientCall, 2000, 1, player, 'Spectate.start', 'auto') end end RaceMode.setPlayerIsFinished(player) showBlipsAttachedTo(player, false) end function DestructionDerby:onPlayerQuit(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 0 then RaceMode.endMap() end end end function DestructionDerby:handleFinishActivePlayer(player) -- Update ranking board for player being removed if not self.rankingBoard then self.rankingBoard = RankingBoard:create() self.rankingBoard:setDirection( 'up', getActivePlayerCount() ) end local timePassed = self:getTimePassed() self.rankingBoard:add(player, timePassed) -- Do remove finishActivePlayer(player) -- Update ranking board if one player left local activePlayers = getActivePlayers() if #activePlayers == 1 then self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) end end ------------------------------------------------------------ -- activePlayerList stuff -- function isActivePlayer( player ) return table.find( g_CurrentRaceMode.activePlayerList, player ) end function addActivePlayer( player ) table.insertUnique( g_CurrentRaceMode.activePlayerList, player ) end function removeActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) end function finishActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) table.insertUnique( g_CurrentRaceMode.finishedPlayerList, _getPlayerName(player) ) end function getFinishedPlayerCount() return #g_CurrentRaceMode.finishedPlayerList end function getActivePlayerCount() return #g_CurrentRaceMode.activePlayerList end function getActivePlayers() return g_CurrentRaceMode.activePlayerList end
  21. i meant on this : DestructionDerby = setmetatable({}, RaceMode) DestructionDerby.__index = DestructionDerby DestructionDerby:register('Destruction derby') function DestructionDerby:isApplicable() return not RaceMode.checkpointsExist() and RaceMode.getMapOption('respawn') == 'none' end function DestructionDerby:getPlayerRank(player) return #getActivePlayers() end -- Copy of old updateRank function DestructionDerby:updateRanks() for i,player in ipairs(g_Players) do if not isPlayerFinished(player) then local rank = self:getPlayerRank(player) if not rank or rank > 0 then setElementData(player, 'race rank', rank) end end end -- Make text look good at the start if not self.running then for i,player in ipairs(g_Players) do setElementData(player, 'race rank', '' ) setElementData(player, 'checkpoint', '' ) end end end function DestructionDerby:onPlayerWasted(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 0 then RaceMode.endMap() else TimerManager.createTimerFor("map",player):setTimer(clientCall, 2000, 1, player, 'Spectate.start', 'auto') end end RaceMode.setPlayerIsFinished(player) showBlipsAttachedTo(player, false) end function DestructionDerby:onPlayerQuit(player) if isActivePlayer(player) then self:handleFinishActivePlayer(player) if getActivePlayerCount() <= 0 then RaceMode.endMap() end end end function DestructionDerby:handleFinishActivePlayer(player) -- Update ranking board for player being removed if not self.rankingBoard then self.rankingBoard = RankingBoard:create() self.rankingBoard:setDirection( 'up', getActivePlayerCount() ) end local timePassed = self:getTimePassed() self.rankingBoard:add(player, timePassed) -- Do remove finishActivePlayer(player) -- Update ranking board if one player left local activePlayers = getActivePlayers() if #activePlayers == 1 then self.rankingBoard:add(activePlayers[1], timePassed) showMessage(getPlayerName(activePlayers[1]) .. ' is the final survivor!', 0, 255, 0) end end ------------------------------------------------------------ -- activePlayerList stuff -- function isActivePlayer( player ) return table.find( g_CurrentRaceMode.activePlayerList, player ) end function addActivePlayer( player ) table.insertUnique( g_CurrentRaceMode.activePlayerList, player ) end function removeActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) end function finishActivePlayer( player ) table.removevalue( g_CurrentRaceMode.activePlayerList, player ) table.insertUnique( g_CurrentRaceMode.finishedPlayerList, _getPlayerName(player) ) end function getFinishedPlayerCount() return #g_CurrentRaceMode.finishedPlayerList end function getActivePlayerCount() return #g_CurrentRaceMode.activePlayerList end function getActivePlayers() return g_CurrentRaceMode.activePlayerList end
  22. then wait for some more experianced scripters to come like Solidsnake
  23. thx it works fine
  24. addEvent ("text", true ) function text() local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then else cancelEvent () end end addEventHandler ( "text", getRootElement(), text ) try this
  25. can u replace quotes with LUA
×
×
  • Create New...