-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
Ok so this: (I'm doing the same on width and height too) dxDrawImageSection( 0-(width/2), 0-(height/2), width-2, height*2, mapX-(width/2), mapY-(height/2), width*2 , height*2 , "map.jpg", rotation, 0, 0, tocolor( 255, 255, 255, 255 ), false )
-
Here is a generic function I just made. just give the table and the element you want to check if it's in that table: -- /!\ doesn't work with nested tables /!\ -- function isElementInTable( table, elementToFind ) for k, element in ipairs( table ) do if element == elementToFind then return true end end return false end
-
Ok let's invert the roles ... Don't "say crap" if you aren't giving feedbacks about the solutions we are giving to you, just don't post. You are supposed to be powerless than members helping you (I just mean here that you are not the king on your topics, you can't apply your own rights and says what members should do for you). And you didn't even try the 2nd solution. We are helping you on our free time, show the respect we deserve. If you aren't agree with that then you can just leave this forum and again:
-
Use double quotes instead of single ones: addEventHandler ("onPlayerJoin", root, function () redirectPlayer (source, "000.000.000.000", 22003) end )
-
KRZO: Just use your initial script but just set usize and vsize twice the radar size but in this case, we have to adjust the u and v (arg names from the wiki page) dxDrawImageSection( 0, 0, width, height, mapX-(width/2), mapY-(height/2), width*2 , height*2 , "map.jpg", rotation, 0, 0, tocolor( 255, 255, 255, 255 ), false ) And it should be good.
-
Hi, here is the math calculation you need (It's fully configurabe): local fullAlpha = 255 --alpha when diff = 0 local diffLimit = 4 --over this limit, the alpha won't be reduced anymore local minAlpha = 150 --the alpha when the diff = diffLimit local _, _, z1 = getElementPosition( elem1 ) local _, _, z2 = getElementPosition( elem2 ) local diff = math.abs(z2 - z1) --height diff between the 2 elements local alpha = fullAlpha - diff * (fullAlpha-minAlpha) / diffLimit if alpha < minAlpha then alpha = minAlpha end --[[here will be the results: | diff | alpha | | 0 | 255 | | 1 |228.75 | | 2 |202.50 | | 3 |176.25 | | 4 | 150 | ... | 10 | 150 | ]]
-
Here is a code using element datas. This script will destroy the oldest vehicle instead of preventing him to spawn like Anubhav did: (check the comments) local vehicleSpawnLimit = 2 addEvent("onPlayerRequestVehicle",true); addEventHandler("onPlayerRequestVehicle", root, function( carID ) if getElementType(source) == "player" then for i, v in ipairs (disallowedVehicles) do if (v[1] == carID) then outputChatBox("This is disallowed vehicle!",source,255,0,0) return false end end --Limit check here local pVehicles = getELementData(source, "vehicles") -- get the player's vehicle list if not pVehicles or type( pVehicles ) ~= "table" then --if it's not a table (a list) pVehicles = {} --create the table (list) end local playerX, playerY, playerZ = getElementPosition(source) local veh = createVehicle(carID, playerX + 2, playerY +2, playerZ) if veh then if #pVehicles == vehicleSpawnLimit then --if he already spawned 2 vehicles destroyElement(pVehicles[1]) --destroy the oldest player's vehicle end table.insert(pVehicles, veh) --Add the car to the player's vehicle list setElementData(source, "vehicles", pVehicles) --store the updated list else outputChatBox( "An error has occured when spawning the vehicle !", source, 200, 0, 0) end end end)
-
In which world are you living sriously ?! You aren't the only guy asking for help, it's not the Lol987's forum here ... We are here to help others to fix their own code. And KRZO just gave the line you have to copy/paste everywhere this script get the player name. Or just put this on top of your script: local _getPlayerName = getPlayerName local getPlayerName = function ( player ) return _getPlayerName( player ):gsub("#%x%x%x%x%x%x","") end
-
Sorry but you are in the scripting section. https://wiki.multitheftauto.com/wiki/Scr ... troduction
-
Here is an example: function checkPoliceArrest( attacker, weapon, bodypart, loss ) -- if there is an attacker and the weapon is a nightstick or a knife if attacker and (weapon == 3 or weapon == 4) then -- Do your stuff here end end addEventHandler ( "onPlayerDamage", root, checkPoliceArrest )
-
You are totally right: //from CPacketHandler.cpp switch ( weaponType ) { case WEAPONTYPE_GRENADE: case WEAPONTYPE_TEARGAS: case WEAPONTYPE_MOLOTOV: case WEAPONTYPE_REMOTE_SATCHEL_CHARGE: { // Read the force SFloatSync < 7, 17 > projectileForce; if ( !bitStream.Read ( &projectileForce ) ) return; fForce = projectileForce.data.fValue; // Read the velocity if ( !bitStream.Read ( &velocity ) ) return; pvecVelocity = &( velocity.data.vecVelocity ); bCreateProjectile = true; break; } //truncated code } No more like 0 <= x <= 127 if I'm right (2^7 - 1) EDIT: Wiki page updated (hope it won't get reverted for some reason) => createProjectile
-
That's besides the point, though. I'm here to help, but I'm not gonna read through it all and try to spot mistakes when simply providing the errors and/or warnings would make it easier for us all You are totally right ! By the way this script has only 30 lines so yeah I just worked into it even if he didn't post the errors/warning. The rules are here but no one read it so yeah, we (moderators) should probably start to lock a topic untill it's ok.
-
Alright, nice to see I didn't make mistake in that system. Please read the code and try to understand what's going on there. If there is something that you aren't really sure about what is it for, please ask here.
-
It will definitly be faster for you to learn using the wiki and then do it by yourself than waiting here for someone to drop that code.
-
Hehe, nah, I'm totally fine, it's just that some guys do think we are a just a bunch of coders waiting for order like if this forum was a drive through: "Hey fix that thanks", "Hey, script me this, and this, and also this." etc... It's really shocking me and I can't believe they think their topic is fine. I already saw topics where the guy just dropped his code and wrote right under it: "Script doesn't work, why ? :cry:" By the way, I'll stop here because it's totally off topic
-
Tiens essaye cette fonction, regarde bien comment on fait un "if-elseif-else": function setTeamPlayer ( _, account) local accName = getAccountName(account) if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then setPlayerTeam(source, AdminTeam) elseif isObjectInACLGroup("user."..accName, aclGetGroup("SuperModerator")) then setPlayerTeam(source, SModTeam) elseif isObjectInACLGroup("user."..accName, aclGetGroup("Moderator")) then setPlayerTeam(source, ModTeam) elseif isObjectInACLGroup("user."..accName, aclGetGroup("T-Mod")) then setPlayerTeam(source, TModTeam) else setPlayerTeam(source, OtherTeam) end --Un output de test pour vérifier la team dans laquelle le joueur à été placé outputChatBox( getPlayerName( source ).." now in team "..getTeamName( getPlayerTeam( source ) ) ) end addEventHandler("onPlayerLogin", getRootElement(), setTeamPlayer)
-
Tell us why you need that, because maybe we will be able to find a workaround to do what you want to. And do you want to list the dirs on the server-side or on client-side ? I think the only way to list the server's folders is to write your own MTA Module to add the functions you can use in your server-sided scripts.
-
I just please some scripter to do it ... No one will do it for free.
-
Here's the link: https://wiki.multitheftauto.com/wiki/Scr ... troduction
-
The only thing you deserve is a tempban
-
Everything is explained with commentaries: local reputations = { [-1095] = "demon", [-195] = "evil", [-55] = "bad", [0] = "normal", [55] = "good1", [195] = "good2", [1095] = "hero" } -- this function will return the reputation name giving him the reputation points -- i.e getReputationName(-120) will return "evil" function getReputationName( points ) for reppoints, repname in ipairs ( reputations ) do -- loop over all reputations result = repname --stop the loop if the rep from the table is higher than the rep of the player if reppoints > points then return result --we found it, so let's return it end end end -- this function will update the reputation name of the player -- if the player has -120, getElementData on "Reputation.status" will return "evil" function updateReputationName( player ) local repPoints = getElementData(killer, "Reputation.points") or 0 local newRepName = getReputationName( repPoints ) setElementData(player, "Reputation.status", newRepName) end function reputation(ammo, killer, weapon, bodypart) if killer and killer ~= source then --Reputation points of the guy who died local dRPoints = getElementData(source, "Reputation.points") or 0 --Reputation points of the guy who killed him local kRPoints = getElementData(killer, "Reputation.points") or 0 if dRPoints < 0 then -- the guy who died was a bad guy kRPoints = kRPoints + 5 else --was a good guy kRPoints = kRPoints - 5 end setElementData(killer, "Reputation.points", updateReputationName( killer ) -- update the reputation name for the killer end end addEventHandler( "onPlayerWasted", getRootElement(), reputation) function onLogin (_, account) local defaultPoints = 0 --you can change the default points a guy should have here local defaultRepName = getReputationName( defaultPoints ) --do not modify here setElementData(source, "Reputation.status", getAccountData(account, "rep") or defaultRepName) setElementData(source, "Reputation.points", getAccountData(account, "re.p") or defaultPoints) end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "rep", getElementData(thePlayer, "Reputation.status")) setAccountData (theAccount, "re.p", getElementData(thePlayer, "Reputation.points")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) I didn't test it so if it works, please post the errors if there is any.
-
Is It Ok thank you for your efforts You weren't logged in right ?
-
Not asking for help about another language than Lua
-
Maybe because you are just trying random stuff to make it works without using your brain (sorry if I'am mean but that's the truth). Don't zip the maps ! So extract them back into your maps folder. As I can see you didn't undestand what I told you above ... Each map file you want to load with the resource has to be in the meta.xml If I want to load a 2nd map called map2.map you have to add this into the meta.xml <map src="maps/map2.map" /> I don't see what is so difficult for you to understand that. And MIKI785: Please read and try to understand what is the problem before posting. Oh yeah and be sure you have the required knowledges to help someone. Your posts were pretty much out of the topic (No hate). Best regards, Citizen
