-
Posts
51 -
Joined
-
Last visited
Everything posted by PaulDK
-
it's not working . i can't give armor in my id . help.
-
This Link May help you https://wiki.multitheftauto.com/wiki/Scr ... Tutorial_2
-
ok thanks but wait i need to test it again
-
hi guys please help me with my problem because i have a script that you can give armor and life in player using by getPlayerFromName but i have problem when i using /givearmor [id] always says id or name not found please help me with this Problem thanks in Advance . this is what i use scoreboard id . Scoreboard Script : -----------> local availableID = { } -- Create the table that specifies which id's are available. local scoreboard local _dxver local _initp = true local _loaded = false function Init () if ( getResourceFromName ( "scoreboard" ) and getResourceState ( getResourceFromName ( "scoreboard" ) ) == "running" ) then scoreboard = exports.scoreboard _dxver = false elseif ( getResourceFromName ( "dxscoreboard" ) and getResourceState ( getResourceFromName ( "dxscoreboard" ) ) == "running" ) then scoreboard = exports.dxscoreboard _dxver = true else outputDebugString ( "No scoreboard resource has been started", 2 ) _initp = false end if _initp then scoreboard:addScoreboardColumn ( "ID", getRootElement(), 1, 0.05 ) -- Add the ID column sortScoreboard( "ID" ) end if not _loaded then loadID() end end addEventHandler ( "onResourceStart", resourceRoot, Init ) function loadID () _loaded = true local max_players = getMaxPlayers() for i = 1, max_players do table.insert ( availableID, i, true ) -- Populate the table. end for _, player in ipairs ( getElementsByType ( "player" ) ) do assignPlayerID ( player ) -- Assign an id to all players. end end function checkStoppedResource ( resource ) local rname = getResourceName ( resource ) local sres = tostring ( scoreboard ):gsub( "exports.","" ) if ( rname:lower() == sres:lower() ) then outputChatBox ( "falsed" ) _initp = false end end addEventHandler ( "onResourceStop", getRootElement(), checkStoppedResource ) function checkStartedResource ( resource ) if ( getResourceName ( resource ) == "scoreboard" or "dxscoreboard" and source ~= getResourceRootElement() ) then Init() end end addEventHandler ( "onResourceStart", getRootElement(), checkStartedResource )--]] function sortScoreboard( column ) if _dxvera and _initp then scoreboard:scoreboardSetSortBy ( column, true, getRootElement() ) end end function onJoin () -- Player joined --> assign ID. assignPlayerID ( source ) end addEventHandler ( "onPlayerJoin", getRootElement(), onJoin) function assignPlayerID ( player ) local s_id = 1 -- start at one while ( isIDAvailable ( s_id ) == false ) do -- is it available? if not, +1 & repeat. s_id = s_id + 1 end setElementData ( player, "ID", s_id ) -- available -> assign the ID to the player. sortScoreboard( "ID" ) availableID[ s_id ] = false -- set the id as not available. end function isIDAvailable ( id ) -- checks if the id is used or not. return availableID[id] end function onLeave () -- player left, remove ID, set as available. local s_id = getElementData ( source, "ID" ) availableID[ s_id ] = true removeElementData ( source, "ID" ) end addEventHandler ( "onPlayerQuit", getRootElement(), onLeave ) function removeData ( ) -- resource stopped, clear everything. for k, players in ipairs ( getElementsByType ( "player" )) do removeElementData ( players, "ID" ) end availableID = { } end addEventHandler ( "onResourceStop", resourceRoot, removeData ) function getNameMatches ( player_name ) i = 1 local matchingPlayers = { } if ( player_name ) then for k, player in ipairs ( getElementsByType ( "player" ) ) do local player_n = getPlayerName ( player ) local match = string.find ( string.lower( player_n ), string.lower ( player_name ) ) if ( match ) then table.insert ( matchingPlayers, i, player ) i = i + 1 end end if ( #matchingPlayers == 1 ) then return true, matchingPlayers[1] elseif ( #matchingPlayers > 1 ) then return true, matchingPlayers else return false, "None" end else return false, "Please enter a player name" end end function getPlayerFromPartialName ( source, player_name, script ) if ( player_name ) then local sucess, value = getNameMatches ( player_name ) if ( sucess ) then local matches = ( type ( value ) == "table" ) and #value or 1 if ( matches == 1 ) then if ( script ) then return value else local player_nick = getPlayerName ( value ) local player_id = getElementData ( value, "ID" ) outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) end else outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) for k, player in ipairs ( value ) do local player_nick = getPlayerName ( value[k] ) local player_id = getElementData ( value[k], "ID" ) outputChatBox ( "(" .. player_id .. ") " .. player_nick, source, 255, 255, 0 ) end return true, true end else if ( script ) then return false else outputChatBox ( "Players matching your search are: ", source, 255, 255, 0 ) outputChatBox ( value, source, 255, 0, 0 ) end end end end function getPlayerFromID ( id ) for k, player in ipairs ( getElementsByType ( "player" ) ) do local p_id = getElementData ( player, "ID" ) if ( p_id == tonumber(id) ) then player_n = getPlayerName ( player ) return player, player_n end end return false, "No player has been found with the ID " .. id .. "." end function getPlayer ( source, input ) if ( tonumber ( input ) ) then local player, playername = getPlayerFromID ( tonumber(input) ) if ( player ) then return player else outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. return false end else local player, multiple = getPlayerFromPartialName ( source, input, true ) if ( player and not multiple ) then return player elseif ( player and multiple ) then return false else outputChatBox ( "Player not found", source, 255, 0, 0 ) return false end end end function processIDCommands ( source, command, input ) if ( tonumber ( input ) ) then local player, playername = getPlayerFromID ( tonumber(input) ) if ( player ) then outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) outputChatBox ( "(" .. input .. ") " .. playername, source, 255, 255, 0, true ) else outputChatBox ( playername, source, 255, 0, 0 ) -- in this case, playername carries the error. It's just to minimize the amount of code if an error is ecountered. end else local player = getPlayer ( source, input ) if ( player ) then outputChatBox ( "Player that matches that id: ", source, 255, 255, 0 ) outputChatBox ( "(" .. tostring ( getElementData ( player, "ID" ) ) .. ") " .. getPlayerName ( player ), source, 255, 255, 0, true ) end end end addCommandHandler ( "id", processIDCommands ) Giving Armor Script : --------> function giveArmor ( p1, _, p2,ID ) for _, group in ipairs ({"Admin", "Supermoderator","Console","Moderator"}) do local playerAccount = getPlayerAccount(p1) if (not playerAccount) then return end local accountName = getAccountName(playerAccount) if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( group ) ) then if p2 then local targetz = getPlayerFromName ( p2 ) if targetz then local ID = tonumber(p2) if ID then target = exports.ID_System:getPlayerFromID(ID) else target = getPlayerFromName(p2) end if target then local xplayer = getPlayerName ( p1 ) setPedArmor ( targetz, 100 ) outputChatBox ("#00FFFF[sERVER] "..xplayer.." #00FFFFgave you Armor.", ej, 255, 255, 255, true ) end else outputChatBox("#00FFFF[sERVER] #FF0000id or name are invalid ! ", p1, 255, 255, 255, true) end else outputChatBox("#00FFFF[sERVER] Please Use /givearmor [ id or name]", p1, 255, 255, 255, true) end end end end addCommandHandler ( "givearmor", giveArmor ) This Script is Seperated by Folder... Thanks in Advance
-
NO DUDE i WANT I HAVE TARGETPLAYER ... like this /health [playername or id] /armor [playername or id] /armorhealth [playername or id] ok ?
-
Dude we have a TargetPlayer this is not for me and you can use it if you have an admin rights or console . and the outputChatBox("[ the Admin Name or who gaves the health or armor] then what he gaves health or armor ")
-
Hey Guys i want to know the functions and example how to do script of give Armor and give Health . example if i type /givearmor [name or id] it will gives 100% armor and if i type /givehealth [name or id] it will gives 100% life+ outputChatBox("[sERVER] [PlayerName who gaves armor or health] have been given you 100% health or Armor.") then if you type /giveall [name or id] it will gives 100% armor and 100% health. + outputChatbox("[sERVER] [PlayerName who gaves armor and health] have been given you 100% armor and 100% health !") Thanks in Advance dude please give me example of the script. Thanks i hope you will help me !
-
hi guys please give me the function of this Script Thank you this is the images Thank you in Advance if the resources start this is the Beginning. Sorry for my bad English. i want to avoid spam if you type /participar that is the lasttime you join. if you type /participar you will go in lobby then see the small box the name of the place and the scores. your score| place | highscore . http://data3.whicdn.com/images/117245557/large.jpg then after this is the start of the Event then the Timer Starts ... http://data2.whicdn.com/images/117244282/large.jpg then if you do self kill you will add negative -100 score. but if you killed 1 person in body it will open in center of the Screen 50+but if selfkill it shows color red -100 but if you killed the enemy in HeadShot way you will get +100 . if you killed Enemy you will change weapon but if you do selfkill your Weapon will get back into lower again... http://data2.whicdn.com/images/117246768/large.jpg Then if you are the highscore in game you will Received Money $200,000. in 7 minutes the resource stop. http://data2.whicdn.com/images/117247614/large.jpg Thanks in Advance i hope you will help me...
-
Yes Rudransh Accept it... im a scripter but im not a real pro
-
addEventHandler("onVehicleExplode", Hydra, function() setTimer ( function() respawnVehicle(Hydra) end, 5000, 1) try it bro
-
WARNING : s\script.lua:21: Bad Argument @ 'killTimer' [Expected Lua-Timer at argument 1] and also outputChatBox("#FFFF00[ADMIN BOT] You moved and the suicide has been canceled !", thePlayer, 0, 0, 0, true) repeat 9 times ... Thanks but can you help me to fix it again ...
-
i want if i move suicide cancel then if the player not moved player would be kill or dead... sorry for my bad english... this is the script please help me Thanks in Advance dude's local movestate = getPedMoveState (sourcePlayer) function commitSuicide ( sourcePlayer ) outputChatBox("Dont Move to not cancel the suicide", sourcePlayer, 255, 255, 0, false) if movestate then outputChatBox("You have been moved the suicide will be cancel",sourcePlayer, 0, 0, 0, true) zPlayer = getPlayerName(sourcePlayer) if not movestate then killPed ( sourcePlayer, sourcePlayer ) outputChatBox("You successfully suicide", sourcePlayer, 255, 255, 0, false) end end end addCommandHandler ( "kill", commitSuicide ) im waiting for your answers thanks in advance please help me
-
function CrimeGang(player) if getPlayerTeam(player) ~= CRIMETeam then if isElementWithinMarker(player, myMarker7) then setPlayerTeam(player, CRIMETeam) outputChatBox("#FF0000[CRIME]#FFFFFF You are now #FF0000A Crime !", player, 0, 0, 0, true) end end end addCommandHandler("crime", CrimeGang) function criminal ( thePlayer, matchingDimension ) if isElementWithinMarker(thePlayer, myMarker7) then giveWeapon(thePlayer, 4, 1) setElementModel(thePlayer, 28) else outputChatBox("You Are not At The Right Place!", thePlayer, 255, 0, 0) end end addCommandHandler("crime", criminal) function onSpawn() if getPlayerTeam(source) == CRIMETeam then setElementPosition(source, 1292.5395507813, -771.5126953125, 95.961303710938) end end addEventHandler("onPlayerSpawn", root, onSpawn) addEventHandler("onMarkerHit", myMarker7, function(player) if getElementType(player) == "player" then outputChatBox("#FF0000[CRIME]#FFFFFFTo become a #FF0000CRIME #FFFFFFwrite /crime", player, 0, 0, 0, true) end end) function LeaveCRIME(player) if getPlayerTeam(player) then setPlayerTeam(player, nil) outputChatBox("#FF0000[CRIME]#0000FF You leaved in CRIME Gang", player, 255, 255, 255, true) else outputChatBox("#FF0000[CRIME]#0000FF You Dont Have a gang.", player, 255, 255, 255, true) end end addCommandHandler("leavecrime", LeaveCRIME) function gang ( ) if getPlayerTeam(source) ~= CRIMETeam then setPlayerTeam(source, nil) end end addEventHandler("onPlayerLogin", getRootElement(), gang) this is my script i want it cannot be deleted Thanks in Advance ...
-
Hey Guys i need help. Anyone Help me cuz i want if i create POLICE and CRIME gang cannot be Deleted by anyone. Thanks in Advance
-
in the addEventHandler("onClientRender", root, drawwStuff) root = getRootElement() if 1 player hit in the pickup it will show to all...
-
Hello Everyone. I need Help. i want if i hit in the pickup the function drawStuff will start can anyone help me and also if you leave in the pickup it will destroy sorry for my Bad English.. Here's the Script.... infoz = createPickup(2000.5545654297, 1538.30, 13.7, 3, 1239, 0, 1) local x,y = guiGetScreenSize() local Text = "This is a Pirate Ship that gives" local Text2 = "Money If you Stay here you will" local Text3 = "Get a lot of Money........." local Text4 = "Created BY : PaulDK" local Text5 = "Keep Calm And Enjoy :)" function drawStuff() dxDrawRectangle ( x/18, y/3, x/3.5, y/3, tocolor ( 0, 0, 0, 180 ) ) dxDrawText ( "INFORMATION", x/6.5, y/3, x, y, tocolor ( 255, 255, 255, 255 ), 0.8, "default-bold" ) dxDrawText ( Text, x/12, y/2.7, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) dxDrawText ( Text2, x/12, y/2.5, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) dxDrawText ( Text3, x/12, y/2.3, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) dxDrawText ( Text4, x/12, y/1.6, x, y, tocolor ( 255, 255, 255, 255 ), 0.9, "clear" ) dxDrawText ( Text5, x/12, y/2, x, y, tocolor ( 255, 0, 0, 255 ), 0.9, "clear" ) end addEventHandler("onClientRender", root, drawStuff)
-
bro thank you very much i fix it
-
Dude Script Doesn't Work... Anyone Give Me The Right Script
-
Hey Dude's i Need Help Can You Help me i want if i type /suicide then i move it will cancel but if i not move it will not cancel thanks in Advance Here's the Script function commitSuicide (sourcePlayer) local moveState = getPedMoveState(sourcePlayer) local seconds = 10 if moveState then outputChatBox("#FFFF00[ADMIN BOT] You Has Move Attempting Suicide Failed", sourcePlayer ,0, 0, 0, true) cancelEvent() end if not moveState then outputChatBox("#FFFF00[ADMIN BOT]Wait 10 seconds You Has Been Frozen", sourcePlayer,255,255,255,true) setTimer(function() seconds = seconds-1 if seconds<=0 then killPed(sourcePlayer, sourcePlayer) end end,1000,seconds) end end addCommandHandler("suicide", commitSuicide)
-
oh Dude Thanks to your help i Fix it
-
Hello brothers i want a little help in my Pirate Script i want if i leave in the Cuboid give money to players will stop. Thanks please Help me Thanks in Advance This is the Script : Cuboid1 = createColCuboid(1995.8243408203, 1517.3013916016, 13.53852558136, 100, 14, 100) Blip = createBlip(2003, 1533, 35, 19, 2, 0, 0, 0, 255, 0, 500, getRootElement()) addEventHandler('onColShapeHit', Cuboid1, function( player ) outputChatBox("#FFFFFFYou Entered in Pirate Boat REWARD:#00FF00You will get Random Money", player, 0, 0, 0, true) setTimer(function() givePlayerMoney(player,math.random(50, 500)) end, 2000, 0 ) end ) addEventHandler('onColShapeLeave', Cuboid1, function( player ) outputChatBox("#FFFFFFYou Leaved in Pirate Boat", player, 0, 0, 0, true) return cancelEvent() end )