
Anubhav
Members-
Posts
2,277 -
Joined
-
Last visited
Everything posted by Anubhav
-
thePlayer is not defined as far as I see. That is why getElementData returns false causing that error.
-
function atkaribasCheck() local atkariba = mysql:query_free("SELECT `atkaribaLVL` FROM `characters` WHERE `id`='".. getElementData( thePlayer, "dbid" ).."'") if (tonumber(atkariba) > 10) then outputChatBox("Jūs esiet atkarīgs no narkotikām, lai ārstētos Jums jālieto vēl vai jādodas uz slimnīcu!", thePlayer) else outputDebugString("INFO: Atkarības sistēma work!") end end
-
Oh really? Wonder if someone has a login panel with a custom account system and he does it on client side? It's not risky? The client can access the database and change it I belive
-
Something like this: table = { ["Exhaust"]={{"1018,"10913"}}, ["Rims"]={{"1025"}}, Just an example. Can be accessed by: table['Exhaust'][1] will return 1018
-
Why don't you use elseif? It is better than typing so many ends
-
KariiM, you did the opposite. Lol, you did if the player is admin, then it wont work. function createSpeaker(thePlayer) if not isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ( "Admin" ) ) then outputChatBox("You're not admin",thePlayer,255,0,0) return end local x, y, z = getElementPosition(thePlayer) speakerObject = createObject(2229, x, y, z-1) outputChatBox("You have Succesfully created a speaker!", thePlayer, 0, 250, 0) if (isPedInVehicle(thePlayer)) then local vehicle = getPedOccupiedVehicle(thePlayer) attachElements(speakerObject, vehicle) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else triggerClientEvent(root, "playTheSound", root, x, y, z) end end addCommandHandler("placespeaker", createSpeaker) function deleteSpeaker(thePlayer) if isObjectInACLGroup ("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup ( "Admin" ) ) then outputChatBox("You're not admin",thePlayer,255,0,0) return end if (isElement(speakerObject)) then destroyElement(speakerObject) outputChatBox("You have Succesfully destroyed the Speaker!", thePlayer, 0, 0, 255) triggerClientEvent("stopTheSound", root) else outputChatBox("Speaker is not created!", thePlayer, 250, 0, 0) end end addCommandHandler("destroyspeaker", deleteSpeaker)
-
Use onClientRender on dxDrawText
-
function getPlayerFromPatrialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function privateMessage(thePlayer, _, sendToName, id, ...) local message = table.concat({...}, "") if sendToName then if (getPlayerFromPatrialName(sendToName)) then toPlayer = getPlayerFromPatrialName(sendToName) if toPlayer ~= thePlayer then if message ~= "" then outputChatBox("#18CB5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message, thePlayer, 255, 255, 255, true) outputChatBox("#18CB5BPM from "..getPlayerName(thePlayer)..":#FFFFFF "..message, toPlayer, 255, 255, 255, true) outputServerLog("#18CB5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message) outputServerLog("#18CB5BPM from "..getPlayerName(thePlayer).."#FFFFFF "..message) outputChatBox("#18CB5B /reply [message]", toPlayer, 255, 255, 255, true) setElementData(thePlayer, "pmPartner", toPlayer) setElementData(toPlayer, "pmPartner", thePlayer) else outputChatBox("Use /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("You cannot pm to yourself!", thePlayer, 255, 0, 0) return false end else outputChatBox("Player not found!", thePlayer, 255, 0, 0) return false end else outputChatBox("Use /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end end addCommandHandler("pm", privateMessage) function privateMessageReply(thePlayer, _, ...) local message = table.concat({...}, "") local toPlayer = getElementData(thePlayer, "pmPartner") if toPlayer then if message ~= "" then outputChatBox("#18CB5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message, thePlayer, 255, 255, 255, true) outputChatBox("#18CB5BPM from "..getPlayerName(thePlayer)..":#FFFFFF "..message, toPlayer, 255, 255, 255, true) outputServerLog("#18CB5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message) outputServerLog("#18CB5BPM from "..getPlayerName(thePlayer)..":#FFFFFF "..message) outputChatBox("#18CB5B /reply [message]", toPlayer, 255, 255, 255, true) else outputChatBox("Use /reply [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("None is pmming you!", thePlayer, 255, 0, 0) return false end end addCommandHandler("reply", privateMessageReply)
-
Either there is no client sided present and cache is false in meta.xml. Btw, server-sided files are not downloaded by the client.
-
change line 37 to: triggerClientEvent("nobfokopenlogin", source)
-
Fault at line 6. presidentExist = false addCommandHandler("president", function(player) if (presidentExist == false) then presidentExist = true local randomPlayer = getRandomPlayer() local veh = createVehicle(409, 1481.3916015625, -1733.9626464844, 13.3828125) local president = getTeamFromName("President") setPlayerTeam(randomPlayer, getTeamFromName("President")) outputChatBox("#fff000(Mission) #8e8c00Seek help from the #0000ffPolice #8e8c00and reach your target destination", player, 255, 255, 255, true) spawnPlayer(player, 1481.3916015625, -1733.9626464844, 13.3828125) warpPedIntoVehicle(player, veh) fadeCamera(player, true) setCameraTarget(player, player) setPlayerNametagColor(player, 255, 255, 0) setElementModel(player, 17) else outputChatBox("Error: there is already a president selected", player, 255, 0, 0) end end )
-
use executeCommandHandler .
-
function checkblood() for i, source in ipairs(getElementsByType( "player" ) ) do local sourceAccount = getPlayerAccount ( source ) if isGuestAccount ( sourceAccount ) then -- nothing else local blood = getElementData(source, "health" ) if (blood <= "0") then outputChatBox( "SANGRE NEGATIVA",source,255,0,0 ) end end end end setTimer(checkblood, 1000, 0) This is how it should be if you want to use setTimer only
-
local restrict_team = "team name here" addEvent("onPlayerHeadshot", true ) addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if getElementType ( attacker ) == "player" then if bodypart == 9 and weapon == 34 then local HSteam = getPlayerTeam(attacker) if HSteam == getTeamFromName( restrict_team ) then local result = triggerEvent("onPlayerHeadshot",source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless( source, true ) addEventHandler("onPlayerSpawn", root, function () setPedHeadless( source, false) end ) end end end end end ) function BackUp( source ) if getElementType ( source ) == "player" then setPedHeadless ( source, false ) end end
-
function getPlayerFromPatrialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function privateMessage(thePlayer, _, sendToName, ...) local message = table.concat({...}, "") if sendToName then if (getPlayerFromPatrialName(sendToName)) then toPlayer = (getPlayerFromPatrialName(sendToName)) if not toPlayer == thePlayer then if not message == "" then outputChatBox("#18BC5BPM to "..getPlayerName(toPlayer)..":#FFFFFF "..message, thePlayer, 255, 255, 255, true) outputChatBox("#18BC5BPM from"..getPlayerName(thePlayer)..":#FFFFFF "..message, toPlayer, 255, 255, 255, true) outputChatBox("#18BC5BPM Use /reply [message]", toPlayer, 255, 255, 255, true) setElementData(thePlayer, "pmPartner", toPlayer) setElementData(toPlayer, "pmPartner", thePlayer) else outputChatBox("Use /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("You cannot pm to yourself!", thePlayer, 255, 0, 0) return false end else outputChatBox("Player not found!", thePlayer, 255, 0, 0) return false end else outputChatBox("Use /pm [part of name] [message]", thePlayer, 255, 0, 0) return false end end addCommandHandler("pm", privateMessage) function privateMessageReply(thePlayer,_, ...) local message table.concat({...}, "") local toPlayer = getElementData(thePlayer, "pmPartner") if toPlayer then if not message == "" then outputChatBox("#18BC5BPM to".. getPlayerName(toPlayer)..":#FFFFFF "..message, thePlayer, 255, 255, 255, true) outputChatBox("#18BC5BPM from"..getPlayerName(thePlayer)..":#FFFFFF"..message, toPlayer, 255, 255, 255, true) outputChatBox("#18BC5BPM Use /reply [message]", toPlayer, 255, 255, 255, true) else outputChatBox("Use /reply [message]", thePlayer, 255, 0, 0) return false end else outputChatBox("No partner has been found!", thePlayer, 255, 0, 0) return false end end addCommandHandler("reply", privateMessageReply)
-
function PedirReforco(thePlayer) if thePlayer and isElement(thePlayer) then local x, y, z = getElementPosition(thePlayer) local location = getZoneName ( x, y, z ) for index, players in pairs(getElementsByType("player")) do local acc = getPlayerAccount (players) if (not isGuestAccount( acc ) ) then local accName = getAccountName( acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ("ComandosPolicia")) then local NickChamador = getPlayerName(players) local sx, sy, sz = getElementPosition(players) local dist = getDistanceBetweenPoints3D(x, y, z, sx, sy, sz) outputChatBox ("#000000[#ff0000POLICIA#000000] #c1c1c1O jogador "..NickChamador.." pediu reforços mais proximo de "..location.." a "..math.floor(dist).." Km/H.", players, 255, 255, 255, true) end end end end end addCommandHandler("reforco", PedirReforco) Use /reforco Remember: 1. You should be logged in.
-
Checking if everything from said resource is downloaded?
Anubhav replied to Captain Cody's topic in Scripting
Walid @ totally wrong. The event only works if you use downloadFile. fileExists? seriously? Use isTransferBoxActive (client sided). I mean it, it will tell you if the downloading thing is active or not. -
You are totally wrong here, i use it a lot times in my own scripting. [quote name=..&G:..] What do you mean...? I don't get it He meant that when u trigger server side event, you need get info back from server side event to client side event by using triggerClientEvent. So that is the reason why it outputs NO on client side but on server side outputs YES, because Client side doesnt know that information because you havent returned that correct info back to client side from server side. Thank you. It will always return true if the event was sent. But now in the functions you're not returning anything which causes you giving nil which gives you false value. The other information is given above by the person. Thank you again for explaining it!
-
It will always output no, because the function doesn't return anything (hasPlayerSleepingBag). You have to use triggerClientEvent from the server side and then addEvent.
-
you probably need the MySQL module
-
for i=550,20000 do removeWorldModel(i,10000,0,0,0) end setOcclusionsEnabled(false) -- Also disable occlusions when removing certain models setWaterLevel(-5000) -- Also hide the default water as it will be full of holes No need to add a function. It is the full code. + in meta.xml make this server sided.
-
new mta diag after reinstalling gta3 files. https://pastebin.mtasa.com/214454510