-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
Of course, in this line: if (getPlayerCount() > 1) then It means that if there are more than 1 player in the server then blablabla If you are a cop, you can't get any wanted star ( except by a command ). If there are nobody in the server, so Theres nobody wanted ( in the server ). So don't touch it, it works fine
-
... But if you want to "print the code", you have to click on the SCREEN not on a guiElement 1- Right click on the screen 2 - Left click on "Rel/Abs Screen" to print the code in relativ 3 - Right click on the screen again 4 - Left click on "Print Code" 5 - Copy and Paste ( if you select the code with the cursor you do not have to go out of the white frame ! Because you can't copy (Ctrl+C) ) if you want to copy all the code, use Ctrl+A then Copy it ( Ctrl+C ) I make it for you: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(0,0,0.99,1,"",true) GUIEditor_Memo[1] = guiCreateMemo(0.0164,0.0517,0.5404,0.56,"",true,GUIEditor_Window[1]) GUIEditor_Image[1] = guiCreateStaticImage(0.5101,0.1017,0.4836,0.4767,"images/mtalogo.png",true,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(0.0278,0.8267,0.2374,0.1217,"",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.3851,0.8267,0.2374,0.1217,"",true,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(0.7172,0.8267,0.2374,0.1217,"",true,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(0.2841,0.6783,0.4306,0.0717,"VOGLIO FARE PARTE DEI:",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"center") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",false) For the MTA Logo, you have to copy the image to a folder "images" in YOUR resource folder.
-
Maybe in your meta.xml, yourScript.lua is loaded 2 times or there are 2 times the function tworzeniePickupa in your code. Why get the position of the cursor again because this event send this parameters ( button, state, absoluteX, absoluteY, wx, wy, wz, clickedElement ): function tworzeniePickupa ( button, state, absoluteX, absoluteY, wx, wy, wz, clickedElement ) outputChatBox(wx.." "..wy.." "..wz) end addEventHandler ( "onClientClick", getRootElement(), tworzeniePickupa )
-
2 Questions about "addEvent" and "setAccountData"!
Citizen replied to SHC//Sniper's topic in Scripting
1- Yes you can ! This is an exemple which delete the row of the player Sniper from the table accounts: executeSQLQuery( "DELETE FROM 'accounts' WHERE name='Sniper' ") -- It's the same as: local player = "Sniper" executeSQLQuery( "DELETE FROM 'accounts' WHERE name='"..player.."'" ) 2- no you can make just 1 addEvent -
Ok I think you are too lazy to make my modifications yourself so this is the full code (sorry for the ???? it's notepadd++): addEvent( "theMoney", true ) function giveThisCash(playerNick, amount) local cash = getPlayerMoney( source ) local giveplayer = getPlayerFromName ( playerNick ) local playername = getPlayerName ( source ) local moneytogive = tonumber(amount) outputChatBox( "You ("..tostring(playername)..") have: "..tostring(cash).." and you want to give "..tostring(moneytogive).." to the player\" "..tostring(giveplayer).."\" ", source ) if( cash < moneytogive ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[??????] ???????? ??????????!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] Invalid amount!", source, 243, 151, 12 ) else outputChatBox( "SERVER: I can't get your langage (1)" ) end return end if( moneytogive < 1 ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[??????] ???????? ??????????!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] Invalid amount!", source, 243, 151, 12 ) else outputChatBox( "SERVER: I can't get your langage (1)", source ) end return end if( giveplayer ) then givePlayerMoney ( giveplayer, amount ) takePlayerMoney ( source, tonumber(amount) ) if getElementData( source, "Lang" ) == "Rus" then outputChatBox ( "[??????] ?? ???????? $" ..amount.." ??? "..getPlayerName ( giveplayer ).. "!", source, 243, 151, 12 ) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox ( "[sERV] You have send $" ..amount.." to "..getPlayerName ( giveplayer ).. "!", source, 243, 151, 12 ) elseif getElementData( givePlayer, "Lang" ) == "Rus" then outputChatBox ( "[??????] "..playername.. " ???????? ??? $" ..amount.. "!", giveplayer, 243, 151, 12 ) elseif getElementData( giveplayer, "Lang" ) == "Eng" then outputChatBox ( "[sERV] "..playername.. " sent you $" ..amount.. "!", giveplayer, 243, 151, 12 ) else outputChatBox( "SERVER: I can't get your langage (2)",source ) end elseif (giveplayer == false) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox("[??????] ????? ?? ??????????.",source,243, 151, 12) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox("[sERV] Player did not exist",source,243, 151, 12) else outputChatBox( "SERVER: I can't get your langage (3)", source ) end end end addEventHandler( "theMoney", getRootElement(),giveThisCash)
-
"attempt to preform arithmetic on a boolean value"?!? help!!
Citizen replied to blurryshadow1's topic in Scripting
Try this ( replace Kills by the good elementData if it's wrong ): function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerConnect", getRootElement(), resetKills ) -
Ok so try this: Put my outputChatBox like this: function giveThisCash(playerNick, amount) local cash = getPlayerMoney( source ) local giveplayer = getPlayerFromName ( playerNick ) local playername = getPlayerName ( source ) local moneytogive = tonumber(amount) outputChatBox( "You ("..tostring(playername)..") have: "..tostring(cash).." and you want to give "..tostring(moneytogive).." to the player\" "..tostring(giveplayer).."\" " ) it's not if (giveplayer == nil) then but if (giveplayer == false ) then : and replace the end like this: elseif (giveplayer == false ) then if getElementData( source, "Lang" ) == "Rus" then outputChatBox("[СЕРВЕР] Игрок не существует.",source,243, 151, 12) elseif getElementData( source, "Lang" ) == "Eng" then outputChatBox("[sERV] Player did not exist",source,243, 151, 12) end end end addEvent( "theMoney", true ) addEventHandler( "theMoney", getRootElement(),giveThisCash) And tell me what is it write in the chatbox
-
I found ! The problem that you use sometimes giveplayer and sometimes givenplayer So replace giveplayerby givenplayer
-
There are no errors ? And can you show us your triggerServerEvent ?
-
you have to add this event onClientGUIClick after the creation of your 2 buttons ( and where is your 1st button ? ^^ ): function spawnFreeroamer() outputChatBox("Spawn Freeroamer" ) -- you can hide your windows: guiSetVisible( GUIEditor_Window[1], false ) end addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Progress = {} GUIEditor_Window[1] = guiCreateWindow(33,174,149,276,"Teams",false) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Button[2] = guiCreateButton(46,172,67,31,"Freeroamer",false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Button[2],1) GUIEditor_Edit[1] = guiCreateEdit(36,39,92,43,"Select a Team",false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Edit[1],1) guiEditSetReadOnly(GUIEditor_Edit[1],true) GUIEditor_Progress[1] = guiCreateProgressBar(24,238,112,29,false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Progress[1],1) guiProgressBarSetProgress(GUIEditor_Progress[1],100) -- execute spawnFreeroamer() if the GUIEditor_Button[2] is clicked: addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], spawnFreeroamer, false ) end )
-
He added me on skype and I made a very long explaination ( 1 hour ) and when I told him new things ( like tables or for k, i in ipairs ), I explained it and I show him an exemple full annotated,then I ask him if he understand it. And I can say that it's a good student ^^
-
function is called every time some data changes on any element (vehicle, ped, ect), some resorces (zombies for example) change the data for non player elements all the time, so the function is caled for no reason, only to chack if the source is a player drifterCZE want to be shure that the source is always a player, and the function will be not caled for non player elements I'm sorry but i can not explain it better We understood correctly wojak but he said that because he didn't know the getElementType function so for him the only way to trigger this function for only players is to make the selection in his addEventHandler. He is here to learn so we ( me and SolidSnake ) show him another ( the better ) way to make this selection with a new function for him ( getElementType ).
-
He said: So my script is correct !: function myFunction() if ( getElementType( source ) == "player" ) then -- your instructions end end addEventHandler ( "onElementDataChange", getRootElement(), myFunction ) I know I'm french but I understood what he wants.
-
Yeah the guy who write that on the wiki is a noob ( and there are a bad syntax for the server-side ) Don't worry about this timer you don't need that
-
Hi add this condition at the begining of your function that is triggered with onElementDataChange if ( getElementType( source ) == "player" ) then -- your instructions end
-
It's not necessary because he wanted to know why his code works because in the wiki it says that: I don't know why and who said that but I think it's a noob: I use this: setCameraTarget( source, source ) It set the camera target of source at source ( so his camera on him )
-
Yeah I can make a destroyElement for the marker but he can do that alone ?: function yourFunction () local marker = createMarker( ... ) -- create your marker where you want local veh = getVehicleInMarker( marker ) -- we try to get the vehicle in the marker if ( veh ) then if ( isAnEmptyVeh( veh ) ) then outputChatBox( "There is a vehicle in the marker and it's not empty !" ) else outputChatBox( "There is no vehicle in the marker but it's empty !" ) end else outputChatBox( "There is no vehicle in the marker !" ) end destroyElement( marker ) end onMarkerHit is triggered only when an element enter in the marker, so if you create a marker on the vehicle, this event is not triggered. Why you doesn't want use my script ? It should works perfectly
-
not understand ? He want to set the same interior that the player so where is your setElementInterior ?? @AZOZE: The full code with the setElementInterior: addEvent("buy2", true) addEventHandler("buy2", getRootElement(), function() if ( getPlayerMoney (source) >= 2000 ) then takePlayerMoney(source, 2000) local x,y,z = getElementPosition ( source ) local i = getElementInterior ( source) trolley = createObject (2780, x, y, z, 0, 0, 0 ) setElementInterior( trolley, i ) outputChatBox(""..getPlayerName(source).." Bought SMoke !", getRootElement(), 0, 255, 0, true) else outputChatBox(" No Money !", source, 255, 0, 0, true) end end )
-
Maybe with this function ( client-side only ): DxDrawLine3D
-
Or replace thePlayer ( he doesn't defined ) by player like this: function kontaktadmina (player, cmd, ...) local text = table.concat ({...}, " ") local adminObjects = aclGroupListObjects (aclGetGroup ("Admin")) local admins = {} for k,v in ipairs (getElementsByType ("player")) do if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount (v)), aclGetGroup ("Admin")) then outputChatBox ("#FF7F00* Sporocilo od "..getPlayerName (player)..": #FFFF00"..text, v, 255, 255, 0, true) end end outputChatBox ("Message sent.", player) end addCommandHandler ("Admins", kontaktadmina) addCommandHandler ("admins", kontaktadmina) It's better than make a second function for the same command
-
This is more than a clue : function yourFunction () local marker = createMarker( ... ) -- create your marker where you want local veh = getVehicleInMarker( marker ) -- we try to get the vehicle in the marker if ( veh ) then if ( isAnEmptyVeh( veh ) ) then outputChatBox( "There is a vehicle in the marker and it's not empty !" ) else outputChatBox( "There is no vehicle in the marker but it's empty !" ) end else outputChatBox( "There is no vehicle in the marker !" ) end end function getVehicleInMarker( theMarker ) local veh = false for k,i in ipairs ( getElementsByType( "vehicle" ) ) do -- we get all vehicles in the server if ( isElementWithinMarker( i, theMarker ) ) then -- if a vehicle is in the marker veh = i -- we store the vehElement in veh break -- Exit the loop end end return veh -- Return the vehElement( = there is a vehicle in the marker) or false ( = no vehicle in the marker ) end function isAnEmptyVeh( theVeh ) if ( getElementType ( theVeh ) == "vehicle" ) then -- we get if theVeh is really a vehicle local tablePassenger = getVehicleOccupants( theVeh ) -- we get all passengers in the vehicle local passengers = #tablePassenger -- we get how many lines in the table ( 1 line by passenger ) if ( passengers <= 0 ) then -- if there are no passengers return true -- we return true end return false -- false otherwise end end If you don't understand my code, tell me it
-
Try with this XML: <players> <player name="JasperNL=D"> <character name="JasperNL=D" skin="106" cr="255" cg="127" cb="0" px="-1959.99609375" py="284.21875" pz="36.46875" pi="0" pd="0" cash="99999549" bank="6255" health="54.117649078369" armor="0" house="0" /> <character name="JasperNL=O" skin="106" cr="127" cg="255" cb="0" px="-1973.9951171875" py="294.1162109375" pz="36.171875" pi="0" pd="0" cash="703" bank="92501496" health="65.098037719727" armor="0" house="1" /> </player> </players> If it works, it means that you can't modify the XML structure like you want
-
So: 1 - You are not in the ACL group or 2 - There is a problem with accountname And maybe try this: local accounts = getAccount ( users, passs ) local accountname = getAccountName (accounts)