Anubhav
Members-
Posts
2,277 -
Joined
-
Last visited
Everything posted by Anubhav
-
You can connect to SQLite database (it will automatically make the file, if it it doesn't exist) through dbConnect. dbQuery examples show how to use SELECT query on SQLite database, and dbExec UPDATE, INSERT, CREATE queries on database. dbConnect basically links you to the database so you can fiddle with it
-
read: wiki.multitheftauto.com/dbExec wiki.multitheftauto.com/dbQuery The normal and exec queries, SELECT * tableName WHERE acc=?, acc..etc. It is practice that will get you used to this. Do not forget to connect to a database through dbConnect and then create it with dbExec dbExec dbQuery dbConnect onPlayerLogin getPlayerAccount getAccountName -- These are all the functions you'll need mandatorily! PM me for help, I'll send my skype.
-
When a player log ins, get his acc, then his acc name. Proceed for a SELECT query towards a poll If there the poll returns 0 results with that acc name -> INSERT one statement, and then put in default settings. Otherwise load it .
-
There can be a solution around this. You can use exports to the damage cancelling resource, and call it when it hits the head or use element data. That is a way around it, although I do not see a reason why wasEventCancelled wouldn't detect it.
-
Need a way to pass text value to a remotes script
Anubhav replied to victorgrant's topic in Scripting
If you want it to pass it to MTA, use fetchRemote/callRemote from your server. You can set a timer, and then send data to X page, which will send it to a website, then it comes ingame through php sdk. There are many ways - but I'm not sure how you will implement as I have never even seen mIRC scripting stuff fetchRemote() --(requires PHP SDK, for such purposes) callRemote() -
The IP/Port is wrong. You might wanna change it to localhost, as you told it is on the same machine.
-
function globalMessage(thePlayer, cmd, ...) local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) outputChatBox("#B24D4D[Global]#FFFFFF "..name..": #ffffff"..message, players, 255, 255, 255, true) end addCommandHandler("global", globalMessage) function outputChatBoxRemote ( playerName, message, type, serverport ) outputChatBox ( "From " .. playerName .. " on " .. serverport .. ": " .. message ) outputDebugString ( "From " .. playerName .. " on " .. serverport .. ": " .. message ) return "hello sailor" end function finishedCallback( responseData, errno ) responseData = tostring(responseData) if responseData == "ERROR" then outputDebugString( "callRemote: ERROR #" .. errno ) elseif responseData ~= "hello sailor" then outputDebugString( "callRemote: Unexpected reply: " .. responseData ) else end end function playerChat ( message, type ) callRemote ( "46.4.173.215:22004", getResourceName(getThisResource()), "outputChatBoxRemote", "46.4.173.215:22004", finishedCallback, getPlayerName(source), message, type, getServerPort() ) callRemote ( "46.4.173.215:22005", getResourceName(getThisResource()), "outputChatBoxRemote","46.4.173.215:22005", finishedCallback, getPlayerName(source), message, type, getServerPort() ) end addEventHandler ( "onPlayerChat", getRootElement(), playerChat ) And
-
I visited it and I liked the design - the features were awesome and the staff helped me to start off! Good luck Infinity
-
You do not need to learn functions at all. Use wiki as reference and create scripts. You just need to know the syntax well. Editing resources then re-creating them is a great way to learn basics and how to script. This will be slow but eventually you'll learn. Note: Always indent your code.
-
You have to trigger it from server side. onClientPlayerWasted executes on the player's PC who died. So you will need todo it server side and trigger for the killer to play the sound,
-
function OpenWindow(thePlayer) if getElementType( thePlayer ) == "player" then local _, _, mZ = getElementPosition(source) -- Marker position local _, _, pZ = getElementPosition(thePlayer) -- Player position if thePlayer == getLocalPlayer() and (getElementData(localPlayer,"Level")) <= 59 and pZ <= mZ + 3 then outputChatBox("You must be atleast Level 60 to access the Special Weapon Shop!", 255, 0, 0) else if ( guiGetVisible ( specialWshop ) == false ) and thePlayer == getLocalPlayer() then guiSetVisible ( specialWshop, true ) showCursor ( true ) end end end end addEventHandler("onClientMarkerHit", special, OpenWindow) addEventHandler("onClientMarkerHit", specialSC, OpenWindow)
-
even that is wrong. function GetAccountNameFromSerial(player, cmd, serial) local accounts = getAccountsBySerial(serial) if accounts then for _,v in pairs(accounts) do outputChatBox(getAccountName(v)) end end end addCommandHandler("tes",GetAccountNameFromSerial)
-
You could use one timer FOR ALL vehicles, make a luck kinda thing, so if math.random(1,2) is 1 it bursts or it doesnt (chances) getElementsByType("vehicle")
-
Not to say the code is wrong.
-
function presidentArrived() setTimer( function( source ) local skin = getElementModel(source) if (skin == 21) then outputChatBox("The President has arrived!", getRootElement(), 0, 120, 80, false) end end, 2500, 1, source ) end addEventHandler("onPlayerSpawn", getRootElement(), presidentArrived) Maybe your spawn script sets the skin a bit late, so I guess this should work.
-
[DayZ] MTASA.LV MULTIPLE SERVERS NETWORK [English]
Anubhav replied to Daniels69's topic in Servers to play on
less players. gg server- 8 replies
-
- plentyofvehicles
- easyloot
- (and 4 more)
-
[LF] Skilled scripter for advice [Contact inside]
Anubhav replied to MegaFire's topic in Looking for staff
I could help you if you have discord/skype in ideas. PM me. -
Lol, source in that event is actually the button clicked. I'm suprised I forgot to fix that or did not even see it e.e localPlayer should be used (the player who clicked it).
-
server sided scripts load first no matter what, its because they are on server, and server starts, and client joins and then the client sided are downloaded and read by the MTA client. so it doesnt matter if you put server type script first or not
-
So you want the weapons on first death to be saved for all NEXT deaths?
-
when the player fires and bullets become one, just toggleControl and play your song.
-
------------------------ --- Create Character --- submitCreate = guiCreateButton(0.38, 0.57, 0.30, 0.05, "Create Character", true) lblCharName = guiCreateLabel(0.47, 0.33, 0.08, 0.04, "Charactername", true) charHeight = guiCreateLabel(0.47, 0.40, 0.08, 0.04, "Height: 150 CM", true) charWeight = guiCreateLabel(0.56, 0.40, 0.08, 0.04, "Weight: 50 KG", true) charGender = guiCreateLabel(0.47, 0.47, 0.04, 0.02, "Gender:", true) charMale = guiCreateCheckBox(0.47, 0.49, 0.04, 0.02, "Male", false, true) charFemale = guiCreateCheckBox(0.52, 0.49, 0.05, 0.02, "Female", false, true) charEdit = guiCreateEdit(0.47, 0.36, 0.15, 0.03, "", true) skinGrid = guiCreateGridList(0.38, 0.33, 0.08, 0.18, true) guiGridListAddColumn(skinGrid, "Skins", 0.9) for i = 1, 3 do guiGridListAddRow(skinGrid) end guiGridListSetItemText(skinGrid, 0, 1, "1", false, false) guiGridListSetItemText(skinGrid, 1, 1, "2", false, false) guiGridListSetItemText(skinGrid, 2, 1, "3", false, false) heightScroll = guiCreateScrollBar(0.47, 0.43, 0.07, 0.02, true, true) weigthScroll = guiCreateScrollBar(0.56, 0.43, 0.07, 0.02, true, true) guiSetVisible(skinGrid,false) guiSetVisible(submitCreate,false) guiSetVisible(lblCharName,false) guiSetVisible(charHeight,false) guiSetVisible(charWeight,false) guiSetVisible(charGender,false) guiSetVisible(charMale,false) guiSetVisible(charFemale,false) guiSetVisible(charEdit,false) guiSetVisible(heightScroll,false) guiSetVisible(weigthScroll,false) ------------------------ function createCharacterFunction() if source == submitCreate then local charname = guiGetText(charEdit) if guiCheckBoxGetSelected (charMale) then local gender = "male" local skin = guiGridListGetItemText ( skinGrid , guiGridListGetSelectedItem ( skinGrid ), 1 ) triggerServerEvent("createCharacter", source, charname, gender, skin) elseif guiCheckBoxGetSelected (charFemale) then local gender = "female" local skin = guiGridListGetItemText ( skinGrid , guiGridListGetSelectedItem ( skinGrid ), 1 ) triggerServerEvent("createCharacter", source, charname, gender, skin) end end end addEventHandler("onClientGUIClick", root, createCharacterFunction)
-
If you dont have any weapons when you die, it won't give you any weapon when you spawn, be it 1st 2nd or 3rd.
-
local tempData = { } addEventHandler ( "onPlayerWasted", getRootElement(), function ( ) tempData [ source ] = { weapons = getWeaponsTable ( source ), skin = getElementModel ( source ) } end ) addEventHandler ( "onPlayerSpawn", getRootElement(), function ( ) if ( tempData [ source ] ) then setElementModel ( source, tempData [ source ].skin ) for weapon, ammo in pairs ( tempData [ source ].weapons ) do giveWeapon ( source, weapon, ammo, true ) end tempData[ source ] = nil end end ) function getWeaponsTable ( thePlayer ) local weapons = { } local hasAnyWeapon = false for slot = 0, 12 do local weapon = getPedWeapon ( thePlayer, slot ) if ( weapon > 0 ) then local ammo = getPedTotalAmmo ( thePlayer, slot ) if ( ammo > 0 ) then weapons [ weapon ] = ammo hasAnyWeapon = true end end end if ( hasAnyWeapon ) then return weapons end end