-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
You can't make that: addEventHandler( "sendMaps", getLocalPlayer(), sendmaps, set ) See this page before you use it and you need this: https://wiki.multitheftauto.com/wiki/OnClientGUIClick Then try this and don't use existing function like set() (this is a lua function ): mapGridList = guiCreateGridList(7,12,183,270,false,tab6) mapsColumn = guiGridListAddColumn(mapGridList,"Maps List",0.85) guiGridListSetSelectionMode(mapGridList,2) mapNameEdit = guiCreateEdit(280,25,140,29,"",false,tab6) guiEditSetReadOnly(mapNameEdit,5) addEvent("sendMaps", true ) function sendmaps(name) row = guiGridListAddRow ( mapGridList ) guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) end addEventHandler( "sendMaps", getLocalPlayer(), sendmaps ) function set1( ) selectedRow, selectedCol = guiGridListGetSelectedItem( mapGridList ) gridMapName = guiGridListGetItemText( mapGridList, selectedRow, selectedCol ) guiSetText( mapNameEdit, gridMapName ) end addEventHandler( "onClientGUIClick", mapGridList, set1 ) Except that, it works perfectly
-
Lol I make this for my food system like the singleplayer. It's works very well but it makes a triggerServerEvent in an onClientRender so you have to buy a good Server ^^ I explain this system: The server make a triggerClientEvent and it's add an addEventHandler( "onClientRender", getLocalPlayer(), myFunction ) Then myFunction get the Bone position x, y, z and send thePlayer, x, y, z to the server with this: triggerServertEvent( "myOtherFunction", getLocalPlayer(),getLocalPlayer(), x, y, z ) Then myOtherFunction retreive the object ( getElementData( thePlayer, "object" ) ) and set the position to the x, y, z coordinates It's easy but if you are 15 players who have 100 FPS, your function in the server will be called 1500 times per second So make your choice
-
So I test it and it works but I changed 2 things ( and we don't need the ; ^^ ): You have to get the Alpha each time instead of the variable getAlpha because if the getAlpha value is ( for exemple ) 0.3, the server gona make guiSetAlpha(wndShop, 0.3+ 0.1) So the Alpha is always 0.4 do you understand ? I'm sure that you understand And it was not rather fluid so a modified it for you : setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )+0.02) end, 100, 30) and setTimer(function () guiSetAlpha(wndShop, guiGetAlpha( wndShop )-0.02) end, 100, 30) It works perfectly on my own server
-
lol ok so I'm gonna test it for you
-
Maybe that ?: https://wiki.multitheftauto.com/wiki/ShowPlayerHudComponent
-
Thank you very much UAEpro
-
I don't know I never this kind of script. but I think that you ave to put a ; after your guiSetAlpha But why you can't test it yourself ??
-
Good work The Kid if he made that in his first post, we would never have seen the problem here: Replace this for giveMoneySend: addEventHandler ( "onClientGUIClick", giveMoneySend, GUIEditor_Button[111], false ) by this: addEventHandler ( "onClientGUIClick", GUIEditor_Button[111], giveMoneySend, false ) Reminder: It's addEventHandler ( "onClientGUIClick", theGUIElement, theFunction, false ) Maybe that it's not the only problem in this code.
-
I have only 1 question: Why you don't create the ID 2053 for each players and make a setElementVisibleTo ? Exemple: if (helmart == 1) then setElementData ( sourcePlayer, "helmeted", true ) helm = createObject (2052, 1, 0, 1 ) -- tommy setElementData( sourcePlayer, "helmobject", helm ) setElementVisibleTo ( helm , getRootElement(), false ) -- hide for all setElementVisibleTo ( helm , sourcePlayer, true ) -- show for sourcePlayer outputChatBox ( "Tommy helmet" ) Then you just have to make a local helm = getElementData( thePlayer, "helmobject" ) for retrieve the object and move it: setElementPosition( helm, x, y, z ) But maybe it's not that you want ?
-
"If this bug occurs in your code you can easily transfer to normal tag without Lua syntax highlightning." Yeah I know so I use [code=text] but it's better if we can use the forum tag
-
I know but why killer == 57 and not killerWeapon == 57 ?? script not work killerWeapon == 57 because what it says on the wiki that need to check exactly "killerWeapon: an integer representing the killer weapon or the death reason." Yes it is what I say: killer: A player element representing the killer. weapon: An integer representing the killer weapon or the death reason. So killerWeapon == 57 and not killer == 57
-
Hi MTA Team, I'm not alone I know but I discovered a problem with Indeed, there is a problem with the getPlayerTeam() function: We get this getPlayerTeam" class="kw2">getPlayerTeam instead of getPlayerTeam ( with the syntax highlighting and the link to the wiki ) One exemple here: viewtopic.php?f=91&t=32091&hilit=+getPlayerTeam#p339723 Can someone fix it please ? Thanks for all
-
I know but why killer == 57 and not killerWeapon == 57 ??
-
Hi, Try this: Server-Side: function mapsList() local resourceTable = getResources() triggerClientEvent ( "clearGridList", getRootElement() ) for resourceKey, resourceValue in ipairs(resourceTable) do local name = getResourceName(resourceValue) local type1 = getResourceInfo ( resourceValue, "type" ) if type1 == "map" then triggerClientEvent ( "sendMaps", getRootElement(), name) else cancelEvent() end end end addCommandHandler( "sendMaps", mapsList, false, false ) Client-Side: --- Put here all your GUI and use guiSetVisible to show or hide the GUI mapGridList = guiCreateGridList(7,12,183,350,false,tab6) mapsColumn = guiGridListAddColumn(mapGridList,"Maps",0.85) guiGridListSetSelectionMode(mapGridList,2) addEvent("sendMaps", true ) function sendmaps(name) row = guiGridListAddRow ( mapGridList ) guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) end addEventHandler( "sendMaps", getLocalPlayer(), sendmaps ) addEvent( "clearGridList", true ) function clearGridList() guiGridListClear( mapGridList ) end addEventHandler( "clearGridList", getLocalPlayer(), clearGridList )
-
This is a joke ? You want to script a RPG server and you doesn't know how to script a basic phone system ? The community is here to help other scripters with their own systems.
-
Hi, What you are trying to do in this line ?? killer == 57 And it's not function(killerweapon, killer) but function(killer, killerweapon) So I tried to repair your code but it is not very understandable ( but you can test it, it works ): addEventHandler( "onClientPlayerWasted", getRootElement( ), function(killer, killerweapon) if ( killerweapon == 54 ) then -- ??? ???? playSound( 'sounds/humans/EndScream.mp3', false) outputChatBox("1") elseif ( killerweapon == 56 ) then -- ???? ?? ??????? playSound( 'sounds/humans/PlayerPainBreathing.mp3', false) outputChatBox("2") elseif ( killerweapon == 53 ) then -- ???? ? ???? playSound( 'sounds/humans/hurt.mp3', false) outputChatBox("3") elseif ( killerweapon == 57 ) then survivorkillsounds = playSound( "sounds/humans/attack" .. tostring( math.random( 1, 4 ) ) .. ".mp3", x,y,z, false ) setSoundVolume(survivorkillsounds, 0.9) setSoundMaxDistance(survivorkillsounds, 10) outputChatBox("4") else zombiekillsounds = playSound( "sounds/zombies/attack" .. tostring( math.random( 1, 5 ) ) .. ".mp3", x,y,z, false ) setSoundVolume(zombiekillsounds, 0.9) setSoundMaxDistance(zombiekillsounds, 10) outputChatBox("5") end if ( killerweapon == 57 ) then local pTeam = getPlayerTeam" class="kw2">getPlayerTeam" class="kw2">getPlayerTeam(source) if not pTeam then return end local pTeamName = getTeamName(pTeam) if type(pTeamName) ~= "string" then return end if pTeamName == "Zombies" then -- ??? ???? ????? zombiediesounds = playSound( "sounds/zombies/die" .. tostring( math.random( 1, 3 ) ) .. ".mp3", x,y,z, false ) setSoundVolume(zombiediesounds, 0.9) setSoundMaxDistance(zombiediesounds, 10) outputChatBox("6") elseif pTeamName == "Survivors" then -- ??? ???? ????? survivordiesounds = playSound( "sounds/humans/dead" .. tostring( math.random( 1, 4 ) ) .. ".mp3", x,y,z, false ) setSoundVolume(survivordiesounds, 0.9) setSoundMaxDistance(survivordiesounds, 10) outputChatBox("7") end end end ) Can you explain each possiblities please ?
-
Hi, You can replay it like this: function playMySong( thePlayer, commandName ) playSound ( 'mysong.mp3' , true) end addCommandHandler( "play", playMySong, false, false ) addEventHandler ( "onClientResourceStart",getResourceRootElement(getThisResource()), playMySong ) Here the song is played when the resource is started, and when a player make the command /play You can also play the song in other functions like this: playMySong()
-
Hi, It's very simple, at this line: local x,y = getScreenFromWorldPosition(sx, sy, sz + 0.3) The function returns the relative position and the dxDrawImage need the absolute position ! So you have to convert this relative position to an absolute position. The full script ( with some little modifications ): function imagedraw() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix() for k, v in ipairs(getElementsByType("player")) do if(getElementData(v, "Admin") == true) then tx, ty, tz = getElementPosition(v) dist = getDistanceBetweenPoints3D( px, py, pz, tx, ty, tz ) if dist < 30.0 then if isLineOfSightClear(px, py, pz, tx, ty, tz, true, false, false, true, false, false, getLocalPlayer()) then local sx, sy, sz = getPedBonePosition(v, 5) local x,y = getScreenFromWorldPosition(sx, sy, sz+0.3) if ( x >= 0 and x <= 1 and y >= 0 and y <= 1 ) then x, y = AbsoluteToRelativ( x, y ) dxDrawImage ( x, y, 50, 50, "rang/admin.png" ) end end end end end end addEventHandler("onClientRender",getRootElement(),imagedraw) function AbsoluteToRelativ( X, Y ) local rX, rY = guiGetScreenSize() local x = X/rX local y = Y/rY return x, y end Except that I think that your script is correct.
-
Where is the name of the second player ? So try this: Server-Side: function komendavs ( thePlayer, commandName, name2 ) if ( name2 ) then local name1 = getPlayerName ( thePlayer ) local veh = getPedOccupiedVehicle ( thePlayer ) setElementPosition ( veh, 0, 0, 0 ) outputChatBox ( name1.." VS "..name2 ) -- For test triggerClientEvent ( "onImie1", name1, name2 ) else outputChatBox ( "/vs [Player's Name]" , thePlayer) end end addCommandHandler ( "vs", komendavs ) Client-Side: playersVS = "" function imie1( name1, name2 ) playersVS = name1.." VS "..name2 addEventHandler("onClientRender",getRootElement(),imie2) end addEvent ( "onImie1", true ) addEventHandler ( "onImie1", root, imie1 ) function imie2 () dxDrawText ( tostring(playersVS), dlug/2-dlug/4.8+dlug/11.52,wys/2-wys/3+wys/35,dlug,wys, tocolor ( 255, 255, 255, 255 ), 1.8, "clear" ) end It should works ( not tested too )
-
I'm agree, if you put an outputChatBox( "Alpha: "..getAlpha ), you will can noticed that it's not exactly 0.6 or 0.1 but something like 0.599863 or IDK So the Alpha is never exactly 0.6 or 0.1 Wojak is right, but change a little thing: if getAlpha <= 0.13 then setTimer(setMajorAlpha, 500, 6) elseif getAlpha >= 0.57 then setTimer(setMinorAlpha, 500, 6) end It's more secure like that
-
No it should works
-
Yeah I think too but I didn't realised immediately maybe try to put ' ' like this: executeSQLQuery("SELECT 'Attempts' FROM ... ") And can you put a screen of your table with the column Attempts plz ?
-
And most of all, do you have a sql server on your pc like Easy PHP or wamp ? EDIT: Except if you don't use the mySQL system
-
Thanks. No problem
