Jump to content

.:HyPeX:.

Members
  • Posts

    1,255
  • Joined

  • Last visited

Everything posted by .:HyPeX:.

  1. Thanks, i'll test it and tell how it goes on the nick getting. PD: just wondering, could i do it with the actual players in the server? to make it easier for making a table with them. Thanks HyPeX EDIT: i'm not sure how to find a data value with the function you gave me, could you help me out? EDIT2: Something like this maybe? function getNicks(player, command, nick) local accounts = getAccounts () for i, v in ipairs ( accounts ) do local named = getAccountData ( v, "name" ) local nameacc = getAccountPlayer( v ) local name = getPlayerName( nameacc ) if string.find(named, nick) then outputChatBox("[Nick]: Player: ".. named ..", real nick: ".. name ..", account: ".. v .."", source, 0,175,255, false) end end end addCommandHandler("getNick", getNicks)
  2. I dont really know it, just sent a pm to him over skype for it. EDIT//: found it myself.
  3. nonon, just got the problem, i should use the key with "" to make it as a string. getAccountData( thePlayerAcc, "ZombiesKilled" )
  4. Yeah, thought of this already, becouse i'm using it as a script for letting players have longer nicknames, but it isnt easy, since we have this problem.. and thats why i was asking if there was a better method. PD: could you help me out with the code to loop them? i'm not good doing loops at all
  5. Hello guys, is there a way i can find a specific player by checking a key value of account data? lets stay i stored a player's name under the key "name": setAccountData(player, "name", getPlayerName( player)) Now, how could i find it? becouse supposing i use the key value to use longer nicknames on players, and i need to find one by its nick, i would then need to do a miracle to match a players nickname and its real nick. Thanks HyPeX
  6. Hi guys, i think i forgot to show down my ft with luka over here so enjoy! Credits to CompactTxz for recording the map! Thanks HyPeX
  7. hello guys, i got a problem, i'm getting 2 erros wich i cant manage to fix, can someone help me? Line 38 - bad argument@getAccountData - expected string at argument 2, got nil. Line 46 - attempt to compare number with boolean ZombieCap = {} ZombieArena = getTeamFromName ( "ZombieArena" ) Lobby = getTeamFromName ( "Lobby" ) function getaPlayer() local RandomPlayer = getRandomPlayer() local RandomPlayerTeam = getPlayerTeam(RandomPlayer) if RandomPlayerTeam == ZombieArena then g_Player = RandomPlayer if not ZombieCap[g_Player] then ZombieCap[g_Player] = 0 setTimer ( ZombieToEnemy, 50, 1 ) else outputChatBox("ZombieCap is already defined!") setTimer ( ZombieToEnemy, 50, 1 ) end else if g_ErrorMSG_1 == 0 then outputChatBox("RandomPlayerTeam is not == ZombieArena") g_ErrorMSG_1 = 1 elseif g_ErrorMSG == 1 then return end end end setTimer(getaPlayer, 1000, 0) function ZombieToEnemy(Player) if ZombieCap[thePlayer] == 20 then return end local RandomPlayer = getRandomPlayer() local thePlayer = getPlayerName( RandomPlayer ) local thePlayerAcc = getPlayerAccount( RandomPlayer ) local IsEnemy = getPlayerTeam( RandomPlayer ) if getAccountData( thePlayerAcc, ZombiesKilled ) == nil then outputChatBox("Welcome to the Zombie Arena, each zombie killed will give you $500", source) outputChatBox("If you recived this message it means its your first time in the Zombie Arena", source) outputChatBox("This also means there's a Zombie spawning near you. You can spend the money in the lobby", source) setAccountData( thePlayerAcc, ZombiesKilled, 0) else outputChatBox("a zombie spawned near you, warning!", source) end if not ZombieCap[thePlayerAcc] > 20 then if IsEnemy == ZombieArena then ZombieCap[thePlayerAcc] = tonumber(ZombieCap[thePlayerAcc])+1 local X,Y,Z = getElementPosition( thePlayer ) local Rot = getElementRotation( thePlayer ) spawnBot( tonumber(X)+10, tonumber(Y)+10, tonumber(Z), tonumber(Rot), 10, 0, 0, nil, 0, "chasing", thePlayer) else outputChatBox("".. thePlayer .." is not into ZombieArena team, Zombie spawning failed!") end else outputChatBox("" .. thePlayer .." has reached the cap of Zombies allowed!") end end function ZombieKilled(attacker, weapon, bodypart) local thePlayer = getPlayerName( attacker ) local thePlayerAcc = getPlayerAccount( attacker ) if ( not ZombieCap[thePlayerAcc] ) then ZombieCap[thePlayerAcc] = 0 end ZombieCap[thePlayerAcc] = tonumber(ZombieCap[thePlayerAcc])-1 local account = thePlayerAcc local money = getPlayerMoney( attacker ) local KilledZombies = getAccountData( account, ZombiesKilled) setPlayerMoney( tonumber(money)+500 ) setAccountData( account, ZombiesKilled, tonumber(KilledZombies)+1) outputChatBox("".. thePlayer .." has killed a zombie and $500 were added to his account!") end addEventHandler("onBotWasted", getRootElement(), ZombieKilled)
  8. why you used 'handler'? it should be 'connection' as defined... function setPlayerZombieKill(thePlayer, theZKill) if (isElement(thePlayer) and getElementType(thePlayer) == "player") then account = getPlayerAccount(thePlayer) else account = thePlayer end if (not account or isGuestAccount(account)) then return false end local accountName = getAccountName(account) if dbExec( connection, "UPDATE zkills SET zkill = '" .. tonumber(theZKill) .. "' WHERE accountName = '" .. tostring(accountName) .."'" ) then return true else return false end end
  9. Try using isntead: setAccountData getAccountData getPlayerAccount getAccountName you also got it wrong. you did function .. ( vehicle ) this will not work properly, you should get the element by souce, not by vehicle. try this: function respawnVehicle() local account = getPlayerAccount( source ) spawnVehicle ( vehicle, getAccountData( account, "posX" ), getAccountData( account, "posY" ), getAccountData( account, "posZ" ), getAccountData( account, "rotX" ), getAccountData( account, "rotY" ), getAccountData( account, "rotZ" ) ) end function onVehicleSpawn () local account = getPlayerAccount( source ) local x,y,z = getElementPosition (source) local rx,ry,rz = getElementRotation ( targetElem ) setAccountData (account,"posX",x) setAccountData (account,"posY",y) setAccountData (account,"posZ",z) setAccountData (account,"rotX",rx) setAccountData (account,"rotY",ry) setAccountData (account,"rotZ",rz) end addEventHandler ("onVehicleExplode",getRootElement(),onVehicleSpawn) function onVehicleExplode () setTimer( respawnVehicle, 50000, 1, source ) end addEventHandler("onVehicleExplode", getRootElement(), onVehicleExplode)
  10. you should do it into the meta: this is a taken example of how mapmanager works: > function="getGamemodes"/> > function getGamemodes() local resourceList = getResources() local gamemodeList = {} for i,theResource in ipairs(resourceList) do if isGamemode(theResource) then table.insert(gamemodeList, theResource) end end return gamemodeList
  11. Can somone tell me why even if i restart the script and the race, it is making an infinite loop of reseting the actual map? function ReNextMap( map ) if map then local mapName = map outputChatBox("#00aaff[Nextmap]: Moved map '#ffffff".. mapName .."#00aaff' due to nextmap command was recived and reset!",getRootElement(), 0, 50, 175, true) g_ForcedNextMap = map mapIsAlreadySet = true triggerEvent("onBoughtMap", getRootElement(), mapName) else outputChatBox("#00aaff[Nextmap]: 'map name' was not recived correctly!",getRootElement(), 0, 50, 175, true) end end function () outputChatBox("#00aaff[Nextmap]: Loading..",getRootElement(), 0,175,255,true) end function resetMapLimitations( g_NextMap ) g_ForcedNextMapBlock = 0 outputChatBox("#00aaff[Nextmap]: Nextmap command is now aviable again!", getRootElement(), 0, 175, 255, true) g_ForcedNextMap = nil if g_NextMap then local mapName = getMapName(g_NextMap) g_NextMap = false mapIsAlreadySet = true setTimer(ReNextMap, 5000, 1, mapName) setTimer(, 2000, 1) outputChatBox("#00aaff[Nextmap]: Moved map '#ffffff".. mapName .."#00aaff' due to nextmap command was sent for setting again!",getRootElement(), 0, 50, 175, true) g_NextMap = false else if mapIsAlreadySet == true then mapIsAlreadySet = false outputChatBox("#00aaff[Nextmap]: Map has loaded!, you can now buy a map!",getRootElement(), 0, 50, 175, true) else outputChatBox("#00aaff[Nextmap]: The nextmap is free, buy one!",getRootElement(), 0,50,175, true) end end end addEventHandler("onGamemodeMapStart",getRootElement(),resetMapLimitations) Thanks HyPeX
  12. //Upadted and testing.. function ReNextMap( map ) if map then local mapName = map outputChatBox("#00aaff[Nextmap]: Moved map '".. mapName .."' due to nextmap command was recived and reset!",getRootElement(), 0, 50, 175, true) g_ForcedNextMap = map mapIsAlreadySet = true triggerEvent("onBoughtMap", getRootElement(), mapName) else outputChatBox("#00aaff[Nextmap]: 'map name' was not recived correctly!",getRootElement(), 0, 50, 175, true) end end function resetMapLimitations() g_ForcedActualMap = getMapName(exports.mapmanager:getRunningGamemodeMap()) g_ForcedNextMapBlock = 0 outputChatBox("#00aaff[Nextmap]: Nextmap command is now aviable again!", getRootElement(), 0, 175, 255, true) g_ForcedNextMap = nil if g_ForcedResetNextMap then g_ForcedNextMap = getMapName(g_ForcedResetNextMap) mapIsAlreadySet = true local map = g_ForcedResetNextMap setTimer(ReNextMap, 500, 1, map) outputChatBox("#00aaff[Nextmap]: Moved map '".. g_ForcedResetNextMap .."' due to nextmap command was sent for setting again!",getRootElement(), 0, 50, 175, true) g_ForcedResetNextMap = nil else if mapIsAlreadySet == true then mapIsAlreadySet = false outputChatBox("#00aaff[Nextmap]: Map has loaded!, you can now buy a map!",getRootElement(), 0, 50, 175, true) else outputChatBox("#00aaff[Nextmap]: The nextmap is free, buy one!",getRootElement(), 0,50,175, true) end end end addEventHandler("onGamemodeMapStart",getRootElement(),resetMapLimitations) function NextMapCommand(player, command, ...) if (not isObjectInACLGroup ("user."..accountName, aclGetGroup ( "Admin" ))) or ( not isObjectInACLGroup ("user."..accountName, aclGetGroup ( "SuperModerator" ))) then outputChatBox("[Nextmap]: You are not admin!", source, 0,175,255) return end if g_ForcedNextMap then showPutchatbox = "[Nextmap]: Nextmap is #ffffff".. (getMapName(g_ForcedNextMap)) .. "" else showPutchatbox = "[Nextmap]: There is no nextmap set!" end local query = #{...}>0 and table.concat({...},' ') or nil if not ... then outputChatBox("".. showPutchatbox .."", source, 0, 175, 255, true) return end local admin = true if not _TESTING and admin == false then return end local map, errormsg = findMap( query ) if not map then return end if g_ForcedNextMap == map then outputChatBox("#00aaff[Nextmap]: That is already the nextmap!", player, 0, 175, 255, true) return end if g_ForcedNextMapBlock then outputChatBox("#00aaff[Nextmap]: Please wait for next map to use nextmap again!", player, 0, 175, 255, true) return end if mapIsAlreadySet == true then g_ForcedResetNextMap = getMapName(g_ForcedNextMap) g_ForcedNextMap = query g_ForcedResetNextMapBlock = 1 local mapName = getMapName( g_ForcedNextMap ) local PlayerName = getPlayerName(player) outputChatBox("#00aaff[Nextmap]: ".. PlayerName .."#00aaff has set #ffffff".. mapName .."#00aaff as nextmap!", getRootElement(), 0, 175, 255, true) outputChatBox("#00aaff[Nextmap]: the previous map was moved becouse ".. mapName .."#00aaffwas set as nextmap!", getRootElement(), 0, 175, 255, true) triggerEvent("onBoughtMap", getRootElement(), mapName) return end g_ForcedNextMap = map mapIsAlreadySet = true local mapName = getMapName( g_ForcedNextMap ) local PlayerName = getPlayerName(player) outputChatBox("#00aaff[Nextmap]: ".. PlayerName .."#00aaff has set #ffffff".. mapName .."#00aaff as nextmap!", getRootElement(), 0, 175, 255, true) triggerEvent("onBoughtMap", getRootElement(), mapName) end addCommandHandler("nextmap",NextMapCommand)
  13. Thats not the problem, it works perfectly that part, the problem is:
  14. dont you read? if not ... then outputChatBox("".. showPutchatbox .."", source, 0, 175, 255, true) return end Still searching why this doesnt work as it should.
  15. Bump, still any help on this? Thanks in advance HyPeX
  16. .:HyPeX:.

    SlothBot

    Yes, but it is not correctly recognizing the team, it needs to be directly created by the script to be recognized? Thanks HyPeX
  17. you got 2 functions right one after the other, the seconds closes the first one, they're both triggered on the same event. the gui actually opens, but it is closed instantly. if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, Armed_Forces) function joinTeam() triggerServerEvent("set Armed Forces",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end
  18. adding to what prestege said, where are you defining from whom you are getting the camera matrix? local cameraX,cameraY,cameraZ = getCameraMatrix() if sx then if getDistanceBetweenPoints3D(cameraX,cameraY,cameraZ,pedX,pedY,pedZ) <= maxrange then
  19. Hi guys, can someone tell me why: 1°: The nextmap command is not stopped if it was used already 2°: The previous map is not saved and reset after map changing *Note: i removed all redo/etc functions from the race resource. In-Game: http://i.imgur.com/EHaYB5a.png http://i.imgur.com/gCxFT0N.png both of them are serverside. For reseting the map and clearing the nextmap block: function resetMapLimitations() g_ForcedActualMap = getMapName(exports.mapmanager:getRunningGamemodeMap()) if g_ForcedNextMapBlock == true then g_ForcedNextMapBlock = false outputChatBox("#00aaff[Nextmap]: Nextmap command is now aviable again!", getRootElement(), 0, 175, 255, true) end if g_ForcedNextMap then g_ForcedNextMap = nil end if g_ForcedResetNextMap then g_ForcedNextMap = g_ForcedResetNextMap mapIsAlreadySet = true local map = g_ForcedResetNextMap outputChatBox("#00aaff[Nextmap]: Moved map '".. g_ForcedResetNextMap .."' due to nextmap command was set again!",getRootElement(), 0, 50, 175, true) triggerEvent("onBoughtMap", getRootElement(), map) g_ForcedResetNextMap = nil else if mapIsAlreadySet == true then mapIsAlreadySet = false outputChatBox("#00aaff[Nextmap]: Map has loaded!, you can now buy a map!",getRootElement(), 0, 50, 175, true) else outputChatBox("#00aaff[Nextmap]: The nextmap is free, buy one!",getRootElement(), 0,50,175, true) end end end addEventHandler("onGamemodeMapStart",getRootElement(),resetMapLimitations) the nextmap function: function NextMapCommand(player, command, ...) if g_ForcedNextMap then showPutchatbox = "[Nextmap]: Nextmap is #ffffff".. (getMapName(g_ForcedNextMap)) .. "" else showPutchatbox = "[Nextmap]: There is no nextmap set!" end local query = #{...}>0 and table.concat({...},' ') or nil if not ... then outputChatBox("".. showPutchatbox .."", source, 0, 175, 255, true) return end local admin = true if not _TESTING and admin == false then return end local map, errormsg = findMap( query ) if not map then return end if g_ForcedNextMap == map then outputChatBox("#00aaff[Nextmap]: That is already the nextmap!", player, 0, 175, 255, true) return end if g_ForcedNextMapBlock == true then outputChatBox("#00aaff[Nextmap]: Please wait for next map to use nextmap again!", player, 0, 175, 255, true) return end if mapIsAlreadySet == true then g_ForcedResetNextMap = getMapName(g_ForcedNextMap) g_ForcedNextMap = map g_ForcedResetNextMapBlock = true local mapName = getMapName( g_ForcedNextMap ) local PlayerName = getPlayerName(player) outputChatBox("#00aaff[Nextmap]: ".. PlayerName .."#00aaff has set #ffffff".. mapName .."#00aaff as nextmap!", getRootElement(), 0, 175, 255, true) outputChatBox("#00aaff[Nextmap]: the previous map was moved becouse ".. mapName .."#00aaffwas set as nextmap!", getRootElement(), 0, 175, 255, true) triggerEvent("onBoughtMap", getRootElement(), mapName) else g_ForcedNextMap = map mapIsAlreadySet = true local mapName = getMapName( g_ForcedNextMap ) local PlayerName = getPlayerName(player) outputChatBox("#00aaff[Nextmap]: ".. PlayerName .."#00aaff has set #ffffff".. mapName .."#00aaff as nextmap!", getRootElement(), 0, 175, 255, true) triggerEvent("onBoughtMap", getRootElement(), mapName) end end addCommandHandler("nextmap",NextMapCommand)
  20. Fixing my information, i would like to add that the location change was requested at the same time as requested with the other server, (199.188.103.25:22005). Ineeded, it was originally ordered for LA and then asked for change.
  21. sure? this is the screen got by the owner via cp panel http://i.imgur.com/jaJlCVb.png
  22. .:HyPeX:.

    SlothBot

    Bump, any help on why it is not correctly recognizing the team? i've created and set myself into team "ZombieArena" via admin panel...
  23. .:HyPeX:.

    AntiSpam

    Ah, didnt knew = was definition and == comparing/matching.. thanks
  24. .:HyPeX:.

    AntiSpam

    whats so strange about it?
×
×
  • Create New...