
#Paper
Members-
Posts
568 -
Joined
-
Last visited
Everything posted by #Paper
-
wiki.multitheftauto.com mhh it isn't useless... <_
-
So, i tryed whit this code: function addTeam(name, text) teamName[name] = text end addEvent ( "onAddTeam", true ) addEventHandler ( "onAddTeam", getRootElement(), addTeam ) local teamDraw = {} function showKills() local textBoost = 240 for k, team in pairs(teamName) do teamDraw[team] = dxText:create( k, 15, textBoost, false, 'bankgothic', 0.50, 'left') teamDraw[team]:type('stroke', 1, 0, 0, 0, 255) textBoost = textBoost + 15 end end addEvent ( "showKillsForTeam", true ) addEventHandler ( "showKillsForTeam", getRootElement(), showKills ) function modifyKills(newText, teamName) teamDraw[teamName] = newText teamDraw[teamName]:text( newText ) end addEvent ( "modifyKillsForTeam", true ) addEventHandler ( "modifyKillsForTeam", getRootElement(), modifyKills ) So, addTeam(name, text), name is the team name and text is the text to write, and i store the table whit the team name and whit text to write (teamName[name] = text) for k, team in pairs(teamName) do teamDraw[team] = dxText:create( k, 15, textBoost, false, 'bankgothic', 0.50, 'left') teamDraw[team]:type('stroke', 1, 0, 0, 0, 255) textBoost = textBoost + 15 end whit this for i create the text whit the team name first called and the string is the text first called. The text have been create but doesn't modify, i tryed whit this command: function test (player) local teamID = getElementData( player, "tdma.teamid" ) gameTeams[teamID].kills = gameTeams[teamID].kills + 1 triggerClientEvent("modifyKillsForTeam", getRootElement(), rgbToHex(getTeamColor(getTeamFromName(gameTeams[teamID].name)))..gameTeams[teamID].name .. ": " .. gameTeams[teamID].kills .. "/" .. gameMaxKills .. " Kills", gameTeams[teamID].name) end addCommandHandler("testmod", test) function modifyKills(newText, teamName) teamDraw[teamName] = newText teamDraw[teamName]:text( newText ) end and whit this func i modify the text team name and the text and i set the text whit new one but bad argument on modify CS func: attempt to call method 'text' (a nil value) any help?
-
Emhhh, what does it do? i don't understand
-
Bad argument @ "getElementByID" | Switch two functions
#Paper replied to dragonofdark's topic in Scripting
On getPedOccupiedVehicle u use 'source' but u can't use this cuz is not defined, use 'player' -
Bad argument @ "getElementByID" | Switch two functions
#Paper replied to dragonofdark's topic in Scripting
Maybe i can anserw to the 2° question: mark = createMarker(0,0,0) local alpha = 255 setTimer(function() alpha = alpha - 1 end, 100, -1) setTimer(function() setMarkerColor ( mark , 0, 0, 0, alpha ) end, 250, -1) idk try -
ah, in that can u have to add in meta
-
You want to make a ped and make it in a vehicle? acitanox = createPed( 0, x, y, z ) if acitanox then warpPedIntoVehicle( acitanox , theVehicle, 2 ) end
-
Mhh, for open the files in the script i'm not sure that u need to insert these in the meta, u can try like: xmlLoadFile(":"..getResourceName(getThisResource()).."/"..math.random(1, 150)) But i'm not sure that works try...
-
So, import all files in the meta.xml, and then in the script: math.random(1, 50) and then u load xml file whit the random number
-
I don't understand you either... createPickup returns a pickup element already. Infact, but think that i'll use the classic method of money getting: function onWasted (killer) givePlayerMoney(killer, 500) end
-
I'll try, and for delete and make again the text when a new map start?
-
works just the draw, when i need to change it: function modifyKills(text, teamName) teamDraw[teamName]:text( text ) end addEvent ( "modifyKillsForTeam", true ) addEventHandler ( "modifyKillsForTeam", getRootElement(), modifyKills ) attempt to index field ? (nil value) @ line 2 P.S: How can i make that when a new map start the script destroy the old texts and makes new?
-
ok, i tryed whit someone that kills me, i pick up the pickup but i don't get money
-
so, i create teamName = {} in cs and then i make a for cicle in CS for make the text whit dxCreate and then for modify it same for? ------------------SS for k,v in ipairs(gameTeams) do local teamName = v.name triggerClientEvent("onAddTeam", getRootElement(), teamName) end triggerClientEvent("showKillsForTeam", getRootElement()) ------------------CS local teamName = {} function addTeam(teamName) teamName = teamName[teamName] end addEvent ( "onAddTeam", true ) addEventHandler ( "onAddTeam", getRootElement(), addTeam ) function showKills() local textBoost = 240 for k, team in ipairs(teamName) do team[text] = dxText:create( text, 15, y, false, 'bankgothic', 0.50, 'left') team[text]:type('stroke', 1, 0, 0, 0, 255) textBoost = textBoost + 15 end end addEvent ( "showKillsForTeam", true ) addEventHandler ( "showKillsForTeam", getRootElement(), showKills )
-
So, when a players die, the server creates the money pickup and when a player get it get the amount of pickup, just this P.S: OMFG T_T sry for double post
-
I edited a little bit the code, whit "test" cmd the pickup is created but i can't drop it function createMoney(killed) local x, y, z = getElementPosition(killed) local x1, y1, x2, y2 x1 = (x-2)+(math.random()*2) y1 = (y-2)+(math.random()*2) x2 = (x-2)+(math.random()*2) y2 = (y-2)+(math.random()*2) local moneyAmmount = getPlayerCount() * 4 addStat(getPlayerAccount(killed), "cash", -moneyAmmount) setElementData(createPickup(x1, y1, z, 3, 1212), "ammount", moneyAmmount) end addCommandHandler("test", createMoney) function moneyPickupHit(player) if isGuestAccount(getPlayerAccount(player)) == false then local money = getElementData(source, "ammount") if money then addStat(getPlayerAccount(player), "cash", money) destroyElement(source) end end end addEventHandler("onPickupUse", getRootElement(), moneyPickupHit) P.S: I didn't see the events
-
I edited a little bit the code, whit "test" cmd the pickup is created but i can't drop it function createMoney(killed) local x, y, z = getElementPosition(killed) local x1, y1, x2, y2 x1 = (x-2)+(math.random()*2) y1 = (y-2)+(math.random()*2) x2 = (x-2)+(math.random()*2) y2 = (y-2)+(math.random()*2) local moneyAmmount = getPlayerCount() * 4 addStat(getPlayerAccount(killed), "cash", -moneyAmmount) setElementData(createPickup(x1, y1, z, 3, 1212), "ammount", moneyAmmount) end addCommandHandler("test", createMoney) function moneyPickupHit(player) if isGuestAccount(getPlayerAccount(player)) == false then local money = getElementData(source, "ammount") if money then addStat(getPlayerAccount(player), "cash", money) destroyElement(source) end end end addEventHandler("onPickupUse", getRootElement(), moneyPickupHit)
-
i think that i need it, cuz when i create the text the event is triggere by a for cicle in SS, teamName in modifyKills in needed cuz i need to delete the text whit the team name, not as name teamName... P.S: Attempt to call method "text" in modifyKills
-
i have this code: function showKills(text, y, teamName) teamName = dxText:create( text, 15, y, false, 'bankgothic', 0.50, 'left') teamName:type('stroke', 1, 0, 0, 0, 255) end addEvent ( "showKillsForTeam", true ) addEventHandler ( "showKillsForTeam", getRootElement(), showKills ) function modifyKills(text, teamName) teamName:text( text ) end addEvent ( "modifyKillsForTeam", true ) addEventHandler ( "modifyKillsForTeam", getRootElement(), showKills ) but modifyKills function doesn't work: doesn't set the text, maybe he can't find the text element?
-
the money doesn't drop (bad argumnets the setElementData(createPickup...)) and from where i must trigger the moneyPickupHit?
-
the name is headShots not textHeadshots
-
error: attempt to index upvalue on "headShots" (a table value) it happen when i use "test" cmd and the text is setted to: "table: xxxxxxxx" local headShots = 1 local legShots = 0 local torsoShots = 0 local armShots = 0 local assShots = 0 function modifyKillCounter(killer, weapon, bodypart) if bodypart == 9 then headShots = headShots + 1 elseif bodypart == 7 or bodypart == 8 then legShots = legShots + 1 elseif bodypart == 5 or bodypart == 6 then armShots = armShots + 1 elseif bodypart == 3 then torsoShots = torsoShots + 1 elseif bodypart == 4 then assShots = assShots + 1 end headShots:text("HeadShots#FF7256: [ #ffffff"..tostring(headShots).." #FF7256]") leg:text("Leg#FF7256: [ #ffffff"..tostring(legShots).." #FF7256]") torso:text("Torso#FF7256: [ #ffffff"..tostring(torsoShots).." #FF7256]") arm:text("Arm#FF7256: [ #ffffff"..tostring(armShots).." #FF7256]") ass:text("Ass#FF7256: [ #ffffff"..tostring(assShots).." #FF7256]") end addEventHandler("onClientPlayerWasted", getRootElement(), modifyKillCounter) function test () headShots = headShots + 1 end addCommandHandler("test", test)
-
/debugscript 3 any error?