Jump to content

Saml1er

Retired Staff
  • Posts

    1,058
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Saml1er

  1. This won't work anubav since you're defining team twice. theSkin = {105, 106, 107, 102, 103, 104, 28, 29} local team = createTeam( "Criminal" , 255 , 0 , 0 ) or getTeamFromName ( "Criminal" ) function getWantedLevelAndSetCriminal (ammo, attacker, weapon, bodypart) local pteam = getPlayerTeam ( attacker ) local wlevel = getPlayerWantedLevel ( attacker ) if attacker and attacker ~= source then if getElementType ( attacker ) == "player" then if wlevel > 3 and not getTeamName( pteam ) == "Criminal" then setPlayerTeam(attacker, team) outputChatBox ("You are a Dmer !", attacker, 255, 0, 0) setTimer (triggerClientEvent, 1000, 1, attacker, "messCrim", attacker ) setElementModel (attacker, theSkin[math.random(1, #theSkin)] ) setPlayerNametagColor ( attacker, 255, 0, 0 ) setTimer (triggerClientEvent, 1000, 1, attacker, "createHouseEvent", attacker ) end end end end addEventHandler ("onPlayerWasted", root, getWantedLevelAndSetCriminal )
  2. I'll suggest you to go with SQL.
  3. There's no error, im reciving true as a return Are you sure? addEventHandler("getAccData", getRootElement(), getAccData There is a missing bracket ")".
  4. Where is source defined? You're calling this function, right? Anyways why don't you try debugging it?
  5. -- client sided local spd = "" function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.8 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end function setElementSpeed(element, unit, speed) -- only work if element is moving! if (unit == nil) then unit = 0 end if (speed == nil) then speed = 0 end speed = tonumber(speed) local acSpeed = getElementSpeed(element, unit) if (acSpeed~=false) then -- if true - element is valid, no need to check again local diff = speed/acSpeed local x,y,z = getElementVelocity(element) setElementVelocity(element,x*diff,y*diff,z*diff) return true end return false end function speeder () local theV = getPedOccupiedVehicle ( localPlayer ) if tonumber ( getElementSpeed ( theV, "kph" ) ) >= spd then setElementSpeed (theV, "kph", spd ) end end function limit_func ( command, speedy ) local speedy = tonumber ( speedy ) if speedy then spd = speedy addEventHandler ("onClientRender", root, speeder ) end end addCommandHandler ( "limit", limit_func ) function stoplimit_func () removeEventHandler ("onClientRender", root, speeder ) end addCommandHandler ( "stoplimit", stoplimit_func )
  6. function AlivePlayersCheck() local theTable = { } local players = getElementsByType ( "player" ) for i,v in pairs(players) do if not isPedDead(v) then theTable[#theTable+1]=v end end return theTable end addEventHandler("onPlayerWasted", getRootElement(), function () local count = #AlivePlayersCheck() or 0 -- g alive players. if count == "" then outputChatBox ( "0 players are alive " ) --trigger it else -- trigger it outputChatBox (tonumber(count) .." players are alive.") end end ) getAlivePlayers will return a table of alive player and yes if 3rd player dies then it will output the names of the 2 alive players but if nobody is alive then it will output none.
  7. I don't see any context player or thePlayer in function (). Here: function checkMoney (thePlayer) local money = getPlayerMoney(thePlayer) or 0 outputChatBox("You have $"..money, thePlayer ) end addCommandHandler("money",checkMoney)
  8. Saml1er

    Hello.

    My dear, try to search for examples in google. Trust me, you'll find what you need. Btw you can only create the rectangle with dxDrawRectangle and for displaying text you'll need to use dxDrawText.
  9. Saml1er

    Another Q

    He meant. local ranks1 = getElementData(source, "Rank") But in case of getAccountData addEventHandler("onPlayerLogin", root, function ( _, acc ) local ranks1 = getAccountData ( getPlayerAccount ( acc ), "Rank") -- your code end ) You can also replace acc with source for getPlayerAccount. EDIT: Oh seems that's not the problem. ;p
  10. You really think mta let you do that? Umm.... There should be some way. Bons, why don't you talk to lil_toady in irc chat? He might be able to help you.
  11. Saml1er

    Countdown

    By karevan from DDC: The actual difference between client and server, explained basically: The scripts you run on the server, run on a machine which is common for all players, that machine synchronizes all players and shares their information. Server scripts run just once and on one machine. The scripts you run on a client run on the PC of each player. The client "talks" with the server to know about the other players, where they are, what they do, etc... Client scripts run once on every player. This means you can have the same script running in different ways on different machines, with different players. But having the same code. So, while things that happen in server happen at the same time for all connected clients (or players), things that happen on client happen in a different time for each client (or player). Also check this tutorial: viewtopic.php?f=148&t=71106&p=660192#p660192
  12. Hello everybody, this is a tutorial by my friend ( Dreddy from DDC ) : It's my first lesson to you, as Subject says, today I will teach you how to create resources. Well, If you wanna create a simple resource, like with fun commands. You have to make only 2 files in folder (.xml one and .lua) Well, Let's get started from beginning. 1. Open MTA Folder/server/mods/deathmatch/resources. 2. Create a new folder, called "Script01" http://i.imgur.com/ZU72Kor.jpg As you see now, It's empty, Let's make something there. 3. Create a new Text File and call it "meta.xml" and Let's start with meta settings. "Author" version="1.0" name="Script01" type="script"/> Congratulations my boy, we created a simple meta code. 4. Create a new Text File an call it "script.lua" DANGEROUS: If you're going to do some script, look carefully to which side that function belongs. Here's not all functions belong to Client/Server side. If you will put Client-side event into the Server-side .lua file, It will not work at all. 5. Well, Let's make a simple script: When new map starts, It says us "Hello World" addEvent('onRaceStateChanging', true) addEventHandler('onRaceStateChanging', root, function(new) if new=='LoadingMap' then outputChatBox ('Hello World', root, 255, 255, 255, true) end end ) 6. Paste that code into our created .lua file and save it. 7. Adding Lua file in meta. Here's nothing hard at all, just place that line into your .xml file AFTER or BEFORE Now your meta.xml should look like "Author" version="1.0" name="Script01" type="script"/> 8. Come to server, and use "/start Script01" and try to start some map on gamemode. NOTE: If you don't understand anything here then please post it right here so I can help you.
  13. If you know something, people with experience can only help you so why don't you show your code?
  14. Why don't you try something like this? unbindKey ( getLocalPlayer(), "F8", "down")
  15. This will work if he uses "onClientSoundFinishedDownload" as much as I can tell.
  16. Saml1er

    .xml markers

    Search for PayNspray resource in community. It loads an xml file and create markers at different locations.
  17. You want to change everything to free when the price is bugged? Oh, right. Well He might be setting the price wrong or something else that its returning nil.
  18. local cost = tonumber(cost) or 0 This.
  19. Saml1er

    Dead Peds

    He already used that as much as I know.
  20. Actually, if you got a decent lobby system, you can offer the best experience for the players, since they can all be on the same server, talk to each other, and still can play in completely different gamemodes. Also, this might save money for hosting, depends on the way you do it. And its hardly FFS cloning, its evolution, more or less. Exactly. There's no such thing as "cloning" in scripting unless you steal functions from someone.
  21. Yes, for instance. if not isPedOnGround ( sourcePlayer ) then or if isPedOnGround ( sourcePlayer ) == false then
  22. Saml1er

    Need Scripter

    @Iyama: I understand. You're trying to save me from a big loss and I really appreciate that, thank you. @ xdskill: I really don't mind helping someone for a low price but I'm afraid that it might be a lot of work than I expect because I'll go with how you suggest so I think you can ask someone else to help you because it'll be unfair for me later on. Probably you'll ask me to make gui on every marker hit and multiple jobs etc. Edit: @xskill: Everything depends on what exactly you need. You'll need to make a list of everything you need. We can talk on skype. majid.sheikh95
  23. Why don't you do it in this way? "command.reconnect" access="false" /> Simply add this line in default in acl.
  24. Saml1er

    Need Scripter

    How much does he needs to pay for a full game mode? I think you're quite experieced so you can tell me. This is my first time selling an RPG gamemode so I can still script for cheap price but I would like to know the price.
×
×
  • Create New...