-
Posts
1,248 -
Joined
-
Last visited
Everything posted by WhoAmI
-
Is your MTA version is the newest? If no, update it by downloading new client from mtasa.com.
-
So do like that: local table = {{3,1},{22,100}} local text = "" for _, v in pairs ( table ) do if ( type ( v ) == "table" ) then local weapon, ammo = v[1], v[2] text = "Weapon: " .. weapon .. " Ammo: " .. ammo .. "\n" .. text end end dxDrawText ( text, 0, 0 )
-
If so you have to loop through the table. table = {{3,1},{22,100}} for _, v in pairs ( table ) do if ( type ( v ) == "table" ) then local weapon, ammo = v[1], v[2] if ( weapon and ammo ) then dxDrawText ( weapon .." " .. ammo, 0, 0 ) end end end
-
local x, y, z = getElementPosition(thePlayer) local px, py, pz = getElementPosition(ped) local rx,ry,rz = getElementRotation( ped ) local formula = tonumber((360 - math.deg(math.atan2((x - px), (y - py)))) % 360)+1 outputChatBox ( type ( rz ) .. type ( formula ) ) if rz and formula then if not tonumber(rz) > tonumber(formula) then outputChatBox("Looking", root) else outputChatBox("Not looking", root) end end Check what it outptuts on chatbox.
-
table = {{3,1},{22,100}} local weapon, ammo = unpack ( table[1] ) Well, i'm not sure if I am right.
-
#RooTs, man. You always make me laugh.
-
addCommandHandler ( "invisible", function ( player ) for _, v in pairs ( getElementsByType ( "player" ) ) do if ( v ~= player ) then local vehicle = getPedOccupiedVehicle ( v ) if ( isElement ( vehicle ) ) then setElementAlpha ( vehicle, 0 ) end end end end ) This will make invisible other player's vehicle if you type /invisible. Also there is resource for race server https://community.multitheftauto.com/index.php?p= ... s&id=10179
-
setElementAlpha
-
Problem on HOST : ash: ./mta-server: Permission denied
WhoAmI replied to prototype0104's topic in Scripting
I have. Write private message to me. -
Problem on HOST : ash: ./mta-server: Permission denied
WhoAmI replied to prototype0104's topic in Scripting
And you are sure that connection is good and you can make a query into your database? -
Well. You can do like that. server function experience () for i, pPlayer in ipairs( getElementsByType( "player" ) ) do local pAccount = getPlayerAccount( pPlayer ) local exp = getAccountData(pAccount, "exp") local exps = tonumber(getAccountData(pAccount, "exp")) local lvls = tonumber(getAccountData(pAccount, "lvl")) local needexp = lvls * 4 if not exp then setAccountData(pAccount, "exp", 1) setAccountData(pAccount, "allexp", 1) setAccountData(pAccount, "lvl", 1) outputChatBox("Your experience: " .. exps .. "/" .. needexp, pPlayer, 0, 255, 0) else setAccountData(pAccount, "exp", exps + 1) if exps == needexp then setAccountData(pAccount, "lvl", lvls + 1) setAccountData(pAccount, "exp", 1) outputChatBox("Your lvl is up to " .. lvls + 1 .. "!", pPlayer, 0, 255, 0) else outputChatBox("Your experience: " .. exps .. "/" .. needexp, pPlayer, 0, 255, 0) end end triggerClientEvent ( pPlayer, "drawDxText", pPlayer, exps, needexp ) end end setTimer(experience, 3600000, 0) addEventHandler ( "onPlayerLogin", root, function ( _, account ) if ( account ) then local exp = tonumber ( getAccountData ( account, "exp" ) ) local lvl = tonumber ( getAccountData ( account, "lvl" ) ) if ( exp and lvl ) then local needExp = lvl * 4 triggerClientEvent ( source, "drawDxText", source, exp, needExp ) end end end ) client text = "" addEvent ( "drawDxText", true ) addEventHandler ( "drawDxText", root, function ( exp, needExp ) text = exp .. "/" .. needExp end ) addEventHandler ( "onClientRender", root, function ( ) if ( string.len ( text ) > 0 ) then dxDrawText ( text, 0, 0 ) end end ) Should work imo. Didn't test.
-
Problem on HOST : ash: ./mta-server: Permission denied
WhoAmI replied to prototype0104's topic in Scripting
Did you set up MySQL for your VPS/Dedicated server? -
Well, I have always been using "z-1" and it worked. In this case it didn't, don't know why. Problem is solved anyway, "corona" looks even better than normal cylinder.
-
I prefer NOT to use MySQL module. They are not that good anymore. Use db functions instead.
-
I did it before posting code here.
-
Solved. I just changed "cylinder" to "corona" and it works now. That's strange.
-
That's main code, tho. In this file I got one more table and function which should be called after entering the marker.
-
Same as before. In other marker works, not in those created in this file.
-
Nope, it doesn't work. But it outputs "test" when I enter another marker made in another file.
-
Problem on HOST : ash: ./mta-server: Permission denied
WhoAmI replied to prototype0104's topic in Scripting
chmod 777 mta-server -
It's strange tho. I changed code to addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, d in pairs ( modelki ) do local x, y, z, rx, ry, rz, int, dim, skin = d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9] local ped = createPed ( skin, x, y, z ) setElementRotation ( ped, rx, ry, rz ) setElementInterior ( ped, int ) setElementDimension ( ped, dim ) setElementFrozen ( ped, true ) setElementData ( ped, "modelka", true ) local marker = createMarker ( x + 1, y, z - 1, "cylinder", 1, 255, 51, 255, 50 ) setElementInterior ( marker, int ) setElementDimension ( marker, dim ) setElementData ( marker, "modelka", skin ) end end ) addEventHandler ( "onPlayerMarkerHit", root, function ( hitMarker, matchingDimension ) outputChatBox ( "test" ) local skin = getElementData ( hitMarker, "modelka" ) if ( tonumber ( skin ) and matchingDimension ) then podejmijPrace ( source, skin ) end end ) And it outputs "test" when I'm entering the markers created in the same resource, but not this file. When I'm entering those created here, chat outputs nothing. C'mon...
-
addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, d in pairs ( modelki ) do local x, y, z, rx, ry, rz, int, dim, skin = d[1], d[2], d[3], d[4], d[5], d[6], d[7], d[8], d[9] local ped = createPed ( skin, x, y, z ) setElementRotation ( ped, rx, ry, rz ) setElementInterior ( ped, int ) setElementDimension ( ped, dim ) setElementFrozen ( ped, true ) setElementData ( ped, "modelka", true ) local marker = createMarker ( x + 1, y, z - 1, "cylinder", 1, 255, 51, 255, 50 ) addEventHandler ( "onPlayerMarkerHit", marker, function ( hitMarker ) outputChatBox ( "test" ) if ( hitMarker == marker ) then if ( isElement ( source ) and getElementType ( source ) == "player" ) then outputChatBox ( "test1" ) podejmijPrace ( source, skin ) end end end ) end end ) Well, when I hit the marker nothing happens. No errors, no warnings... Even before "if" things i put output in chat "test" and it doesn't work. What is the problem?
