Jump to content

IIYAMA

Moderators
  • Posts

    5,972
  • Joined

  • Last visited

  • Days Won

    191

Everything posted by IIYAMA

  1. I don't understant when I need to use "local" Wiki: The health variable only exists within the if-condition block, that is between the 'then' and the 'end'. They mean this? function epic () if 7 > 3 then--starts? local P = 1 if P then outputChatBox("this works") end end--ends? end I know what they mean, but I don't know when I need to use it: Their samples: local playermoney = getPlayerMoney ( source ) local health = getElementHealth(player) Do I need local for math? or will it only make lagg. number1 = 1 number2 = 2 number3 = number1 + number2 outputChatBox(number3) Do I need local for tables? number3 = {[3] = 1,[2] = 2,[1] = 3} I hope you can explane to me when I do need to use local and when I don't need to use it. THX
  2. --server addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() call(getResourceFromName("scoreboard"),"addScoreboardColumn","spawnlocalition") end ) --client or server setElementData(getLocalPlayer(),"spawnlocalition",location) setElementData(source,"spawnlocalition",location) @Klesh Then his question isn't correctly formulated. What ever... location = getElementZoneName ( source )
  3. Make sure the element do exist. Most of the time the problem: When you try to destroy an element that already have been destroyed. To solve it: if robhouseMarker and robhouseBlip then destroyElement ( robhouseMarker ) destroyElement ( robhouseBlip ) end or if you aren't sure they both exist: if robhouseMarker then destroyElement ( robhouseMarker ) end if robhouseBlip then destroyElement ( robhouseBlip ) end
  4. IIYAMA

    question,

    https://wiki.multitheftauto.com/wiki/SetTimer https://wiki.multitheftauto.com/wiki/GetTimers https://wiki.multitheftauto.com/wiki/OnResourceStart --when this script is loaded, if you want to know the time when he joins. (also pre trigger to prevent the client isn't loaded bevore the server triggers) https://wiki.multitheftauto.com/wiki/TriggerClientEvent and as Rekon said: https://wiki.multitheftauto.com/wiki/SetElementData -- https://wiki.multitheftauto.com/wiki/GetElementData (the client can deside for him self) or use a trigger to deside the server when he must see the time. Elementdata will be set on serverside. When you need it, you can easy ask the time from the server when you use getElementData. But Element data can be laggy.(I never use it)
  5. IIYAMA

    Teams problem:

    Well it is just the gamemode stealth you got on your pc, but if you seriously want it. function teamstealthgamestart() killmessageRes = getResourceFromName"killmessages" call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") playingaround = 0 redwinsdisplay = textCreateDisplay() local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) textDisplayAddText ( redwinsdisplay, redtext ) bluewinsdisplay = textCreateDisplay() local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) textDisplayAddText ( bluewinsdisplay, bluetext ) tiegamedisplay = textCreateDisplay() local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) textDisplayAddText ( tiegamedisplay, tietext ) waitDisplay = textCreateDisplay() local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) textDisplayAddText ( waitDisplay, waittext ) team1 = createTeam("RED",255,0,0)--red team2 = createTeam("BLUE",0,0,255)--blue teamprotect = get("stealth.teamdamage") if teamprotect == 1 then setTeamFriendlyFire( team1, false ) setTeamFriendlyFire( team2, false ) elseif teamprotect == 0 then setTeamFriendlyFire( team1, true ) setTeamFriendlyFire( team2, true ) end setElementData ( team1, "Score", 0 ) setElementData ( team2, "Score", 0 ) local players = getElementsByType("player") for k,v in ipairs(players) do player = v aTablePlayer[player]={}; aTablePlayer[player]["shieldup"] = false killPed(v) fadeCamera(v,true) thisplayer = v --setTimer(triggerClientEvent,2000,1,v,"swaptoggle",getRootElement(), thisplayer, teamswap) setElementData ( v, "kills", 0 ) setElementData ( v, "deaths", 0 ) setPlayerNametagShowing ( v, false ) spectators[v] = true bindKey ( v, "F3", "down", selectTeamKey ) end --Enable laser sight setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) end addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) Welcome to the old codes of stealth. see line 18 function spectateNext (source) -- THIS IS THE FUNCTION USED TO SWICH WHO IS BEING SPECTATED BY PRESSING R if playingaround == 1 then -- IF A ROUND IS IN PROGRESS --if getElementHealth(source)<1 then if ( isPedDead ( source ) ) then --IF THE PLAYER IS DEAD local specPlayer = getPlayerSpectatee[source] -- gets the spectatee player if not specPlayer then specPlayer = 1 spectators[source] = true bindKey ( source, "r", "down", spectateNext ) end local deadplayerTeam = getPlayerTeam(source)--local --local deadplayerTeam2 = getTeamFromName ( deadplayerTeam ) local deadplayerTeam2 = getTeamName ( deadplayerTeam ) if source then-- my checks outputChatBox ("source does exist") end if deadplayerTeam then-- my checks outputChatBox ( deadplayerTeam2)--output > TeamRED and Team1-----------------------< this end local playersTable = getPlayersInTeam ( deadplayerTeam )--local end playersTable = filterPlayersTable ( playersTable ) -- local playerCount = #playersTable if playerCount == 0 then outputSpectateMessage("Nobody to Spectate",source) -- IF ITS JUST THE 1 PLAYER, SPECTATING IS IMPOSSIBLE else specPlayer = specPlayer+1 outputChatBox( playersTable .. " " .. specPlayer) if playersTable[specPlayer] then while isPedDead ( playersTable[specPlayer] ) do --while getElementHealth(playersTable[specPlayer])<1 do specPlayer = specPlayer+1 end end if specPlayer > playerCount then specPlayer = 1 end --setCameraMode ( source, "player" ) setCameraTarget ( source, playersTable[specPlayer] ) outputSpectateMessage("Now spectating "..getPlayerName(playersTable[specPlayer]),source) getPlayerSpectatee[source] = specPlayer end end end end I have tryed this for a long time and I just getting creazy..... and now I know why 1 team = (2 teams) SO THE DATA I GET WITH local deadplayerTeam = getPlayerTeam(source) IS USELESS
  6. Hello guys, I got a very strange bug. In the gamemode there is: team1 = createTeam("RED",255,0,0)--red team2 = createTeam("BLUE",0,0,255)--blue When I check this player his team I get this: TeamRED Team2 I get 2 team instead of 1. How can I splits or fix this? Because I can do nothing with this data.
  7. Small question: If I shutdown a resource, all tables will be gone only the element data will remain (of this resource). Element data will be gone at the moment this element is gone. True or false?
  8. IIYAMA

    Update MTA virus wtf?

    Thank you very much.
  9. Hi, I just started my mta, clicked on a server. Then he asked for an update and clicked on yes... I downloaded it and bevore he asked for "instal". My virus scan blocked it, because he said virus etc.. C:\ProgramData\MTA San Andreas All\1.3\upcache\_mtasa-1.3.1-rc-04793-0-000-files-all-cksummed.rar_tmp_\MTA\loader.dll Virus: TR/Hijacker.Gen --wtf? Something wrong? I have never had this kind of warnings from mta, so I am worried. Virus: TR/Hijacker.Gen Date discovered: 19/06/2007 Type: Trojan In the wild: Yes Reported Infections: Low Distribution Potential: Low Damage Potential: Low Static file: No Engine version: 7.04.00.34
  10. I won't recommend Element data, it is laggy. I only use it for slow data.
  11. How do you set a table like that? denny199 0 to 10 = 0 10 to 20 = 1 11 to 15 = 0 etc. etc. I get errors if I call a weapon/number, that does not exist in the table it self. Sample: I ask for 3, but the table is: omfg = {1=[1],2=[2]} -- 3 isn't inside. myonlake Perhaps don't make a table for all weapons if you don't want to change them from zero to anything. Only make a table for the weapons you want to change. How can I check with nil if the number isn't inside? Renkon You can use 'nil', unless I'm wrong
  12. Hello guys, I have a very large table, but the problem is that 70% is "0" WeaponRecoil = {[0]=0,[1]=0,[2]=0,[3]=0,[4]=0,[5]=0..................ETC How can I make sure the table will be small. The numbers that will be something in the table is 0 t/m 47. (btw in some of my tables does have a "0", for sample you have explosion = 0 or unarmed = 0) A guy told me once, that I have to use "var" (remi-x) What is the best way to make a good table?
  13. When I run this resource for real(not start and stop) It will calculate the distance between bullet inpacts that hits cars or ped/players.(only when they hit) The x y z coordinations + attacker + timestamps + mathfloor x y coordinations of the attacker.
  14. How much lagg will a started and stopped resource cause with more than 1400 lines? Because on my pc I have an overkill on (32gb ram), the server does only have 1 gb ram.
  15. Hey I got a question. A friend told me onces that if you start a resource, the code(+ everything else) will be loaded in the RAM memory and it will be out of the RAM untill you stop the whole server? Is this True or False?
  16. Heh? You sure that won't give trouble? People will have to download client and server scripts, don't they? The client script does already have arround 800 lines, the server is 2 times more.
  17. I don't get it, sebbe. >--server export end Let me try. Working 100% thx solidsnake
  18. Almost: --client triggerServerEvent ( "gasmaskexport", player ) outputChatBox(player)-- user data visible --server addEvent ("gasmaskexport", true ) function gasmaskexporter (player) exports.syncro_fixing:gasmaskon(player) end addEventHandler ("gasmaskexport", getRootElement(), gasmaskexporter) Error: --server export end function gasmaskon (player) aPlayerCheck[player]["gasmask"]=true; end ERROR: [ouder_server]\syncro_fixing\syncro_server.lua:1250: attempt to index field '?' ( a nil value) ERROR: call: failed to call 'syncro_fixing:gasmaskon' [string "?"]
  19. I mean: --client triggerServerEvent ( string event, element theElement, [arguments...] ) --1 --server addEvent... --2 addEventHandler etc.. Function .. () exports.syncro_fixing:gasmaskon(player) --3 end --export function
  20. So I have to trigger first the server function in the same folder. then export?
  21. client: exports.syncro_fixing:gasmaskon(player) server: function gasmaskon (player) aPlayerCheck[player]["gasmask"]=true; end
  22. Export from Stealth: (player does exist) exports.syncro_fixing:gasmaskon(player) Other script: <export function="gasmaskon" type="server"/> function gasmaskon (player) aPlayerCheck[player]["gasmask"]=true; end Error: ERROR: call: failed to call 'syncro_fixing:gasmaskon' [string "?"] (both are running/no other errors)
×
×
  • Create New...