Jump to content

botanist

Members
  • Posts

    613
  • Joined

  • Last visited

Everything posted by botanist

  1. Thanks But when one problem is fixed, another will be created.. Why does my elegy not replace? Clientscript: function replaceModels() outputChatBox("Replacing...") --I even don't get this message --Nissan Skyline into Elegy txd = engineLoadTXD ( "elegy.txd" ) engineImportTXD ( txd, 562 ) dff = engineLoadDFF ( "elegy.dff", 562 ) engineReplaceModel ( dff, 562 ) end addEventHandler("onClientPlayerJoin", getRootElement(), replaceModels) Meta: <meta> <info author="theguywhomadethemodels" version="1.0.0" type="script" /> <script src="import.lua" type="client" /> <file src="elegy.txd" /> <file src="elegy.dff" /> </meta>
  2. Awesome, command is working now But there's still a problem. Serverscript: addEventHandler( "givePortalGun", getRootElement(), function( ) giveWeapon( source, 31, 1100 ) end ) addEvent( "givePortalGun", true ) addEventHandler( "resupplyAmmo", getRootElement(), function( ) giveWeaponAmmo( source, 31, 1 ) end ) addEvent( "resupplyAmmo", true ) But when I try to trigger these serverevents with the Clientscript, it won't work. thisPlayer = getLocalPlayer( ) triggerServerEvent ( "resupplyAmmo", thisPlayer ) --And triggerServerEvent ( "givePortalGun", thisPlayer )
  3. When I look at my script, it looks fine. So I don't know the problem. rootElement = getRootElement() thisPlayer = getLocalPlayer() local portalBool local portalMarker1 local portalMarker2 addEventHandler("onClientPlayerJoin", rootElement, function() portalBool = 0 portalMarker1 = 0 portalMarker2 = 0 end ) addEventHandler("onClientPlayerQuit", rootElement, function() portalBool = 0 portalMarker1 = 0 portalMarker2 = 0 destroyElement( portalMarker1 ) destroyElement( portalMarker2 ) end ) addEventHandler( "onClientPlayerWeaponFire", thisPlayer, function( weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if portalBool == 1 then if weapon == 31 then if not hitElement == "player" then if getKeyState( "1" ) == true then destroyElement( portalMarker1 ) portalMarker1 = createMarker( hitX, hitY, hitZ, "corona", 4, 0, 125, 35, 200 ) end if getKeyState( "2" ) == true then destroyElement( portalMarker2 ) portalMarker2 = createMarker( hitX, hitY, hitZ, "corona", 4, 180, 0, 0, 200 ) end end end end end ) addCommandHandler ( "portal", function( commandName ) if portalBool == 0 then portalBool = 1 outputChatBox( "Portalgun turned on." ) end if portalBool == 1 then portalBool = 0 destroyElement( portalMarker1 ) destroyElement( portalMarker2 ) outputChatBox( "Portalgun turned off." ) end outputChatBox( "Command done." ) end ) The problem I get is in the command. The only message I get is "Command done.", and nothing else. Why does the rest of the command not work?
  4. Ok, thank you! Now I understand it
  5. Is this event called when a player connects (I thought this was after doubleclicking the server than, am I right?? (Than loading game, than joining I thought.)) or when the resource starts? Some wiki pages confuse me.
  6. Okay, thank you all So in fact, this is what I need to do?: Resource 1: addEventHandler("onPlayerWasted", getRootElement(), function ( ammo, attacker, weapon, bodypart ) setElementData( source, "Status", "DEAD" ) --This triggerEvent( "onMyEvent", getRootElement(), source ) --This call(getResourceFromName("resource2"), "setSpectating", true , source) --This end ) Resource 2: addEvent ( "onMyEvent", true ) function myEventHandler ( source ) --some code end addEventHandler ( "onMyEvent", getRootElement(), myEventHandler ) function setSpectating( theBool, source) --some code end
  7. Okay But I saw also something about exporting function. Is that for when i want to do this: Resource 1 contains a function called function doSomethingLol( source ), and I want to trigger that in resource 2 when I spawn. Do I have to do something important or can I just do this?
  8. Hi, I want to know something. Is it possible to create 2 resources which work together? Like resource 1 has an event, but resource 2 says when that event have to be triggered. And when I use setElementData ( someElement, "someData", someValue ), can I use getElementData ( someElement, "someData" ) in another resource?
  9. Ok, fuck << lawl badword replacer, but the texture isn't replacing too..
  10. Hi, Now I'm thinking about, is it possible to replace a weapon? Until now, it won't work by me. My script: function onPlayerWeaponConnect() txd = engineLoadTXD ( "silenced.txd" ) engineImportTXD ( txd, 347 ) dff = engineLoadDFF ( "silenced.dff", 0 ) engineReplaceModel ( dff, 347 ) end addEventHandler("onClientResourceStart", getRootElement(), onPlayerWeaponConnect) I defined the models in meta.xml and I've placed them in the resource. But they doesn't replace. Is this because MTA haven't support for custom weapons or am I doing something wrong?
  11. I use 1 / playerdeaths, because divide by 0 is impossible. But what you say is also true, the answer would be not what I want. But I changed it: 1/playerdeaths/2 Indeed playerdeaths would be never 0, because this is only called when the player dies. But that doesn't matter. My numbers still won't have 2 decimals. I still don't know what to do.
  12. EDIT: Result after 3 deaths, 0 kills: 0.330000013 Code: local playerkills = getElementData ( source, "Kills" ) local playerdeaths = getElementData ( source, "Deaths" ) + 1 if playerkills == 0 then local playerratio = 1/playerdeaths setElementData ( source, "Ratio", tonumber( ("%.2f"):format(playerratio) ) else local playerratio = playerkills/playerdeaths setElementData ( source, "Ratio", tonumber( ("%.2f"):format(playerratio) ) end So the result is different, but it isn't what I want. What to do now?
  13. Some code in onPlayerWasted: local playerkills = getElementData ( source, "Kills" ) local playerdeaths = getElementData ( source, "Deaths" ) + 1 if playerkills == 0 then local playerratio = 1/playerdeaths tonumber( ("%.2f"):format(playerratio) ) setElementData ( source, "Ratio", playerratio ) else local playerratio = playerkills/playerdeaths tonumber( ("%.2f"):format(playerratio) ) setElementData ( source, "Ratio", playerratio ) end But, it returns when I died three times and I haven't killed still 0.333343, and I don't know where that four can come from. Is this script wrong, or am I doing it wrong?
  14. <acl> <group name="Admin"> <acl name="Moderator" /> <acl name="SuperModerator" /> <acl name="Admin" /> <acl name="RPC" /> <object name="resource.admin" /> <object name="resource.webadmin" /> <object name="user.=USP=Remi-X[NL]" /> </group> </acl> That's what my ACL says in the admingroup. In the resource "Admin" stays the register command.
  15. Ehm, there's nothing over there that can help me.
  16. Hi, I don't think I can say a lot about this. But the point is, addAccount doesn't work. Every time I use it, it will result in a error in the console, Access denied. But why? -Windows Vista Home Premium. -I use it for the register functien. My register is like the first example on addAccount at the wiki. -Thought "Read-Only" is off, but I don't know this sure with Vista. -UAC is disabled.
  17. botanist

    Loops

    Yes, I know its better to use a .map file, but it was bugging a LOT. I don't know why, but the first round in stealth you play that map, you see the objects, and after that, you won't see the objects anymore untill I restart the map. Than I tried to create the objects with lua and setElementInterior. Just tested with local object 1 = createObject(...). Result? That works. That's why I'm using this objects in a LUA file. EDIT: Solution was to use this. (Map works now ) addEventHandler('onResourceStart', resourceRoot, function() object = {} table.insert( object, createObject ( 7191, 265.10437011719, 191.24276733398, 1009.1465454102, 270, 0, 0 ) ) table.insert( object, createObject ( 7191, 246.921875, 194.00668334961, 1009.1465454102, 270, 0, 90 ) ) --And more and more objects for o=0, 117 do setElementInterior( object[ o ], 3 ) end end @Below me: Thank you
  18. botanist

    Loops

    Hi I've searched this site, the wiki and Google for some explanation, but I didn't find anything. What I want is to create a loop like this: addEventHandler('onResourceStart', resourceRoot, function() object = { createObject ( 7191, 265.10437011719, 191.24276733398, 1009.1465454102, 270, 0, 0 ) } object = { createObject ( 7191, 246.921875, 194.00668334961, 1009.1465454102, 270, 0, 90 ) } --And more and more objects for o=0, 117 do setElementInterior( object[ o ], 3 ) --But this loop doesn't work end end )
  19. AWESOME, thank you Just two things left, how do I hide the image? And how do I put the image completely at the background? So if someone is new, and he wants to choose his team, he can't click on it now, because that image is in front of that gui. So I want that image behind it, always. How? And a little question if someone knows, which X-Y point is the middle of the screen, to show my image in the middle?
  20. Ok, I read it again, and I did the following: Client: addEvent( "showRedWinImage", true ) function handleRedWinImage () guiCreateStaticImage( 20, 200, 640, 480, "redwin.png", false ) --Positions are for testing, I don't know the exact middle of the screen end addEventHandler( "showRedWinImage", getRootElement(), handleRedWinImage ) addEvent( "showBlueWinImage", true ) function handleBlueWinImage () guiCreateStaticImage( 20, 200, 640, 480, "bluewin.png", false ) --Positions are for testing, I don't know the exact middle of the screen end addEventHandler( "showBlueWinImage", getRootElement(), handleBlueWinImage ) addEvent( "showTieWinImage", true ) function handleTieWinImage () guiCreateStaticImage( 20, 200, 640, 480, "tiewin.png", false ) --Positions are for testing, I don't know the exact middle of the screen end addEventHandler( "showTieWinImage", getRootElement(), handleTieWinImage ) Server: --Replaced textDisplayAddObserver( redwinsdisplay, thisplayer ) with triggerClientEvent ( thisplayer , "showRedWinImage"), and so on for blue and tie function stealthroundended( timerID, player ) if playingaround == 1 then if ( tostring(timerID) == tostring(roundfinish) ) then if team1survivers > team2survivers then local alltheplayers = getElementsByType("player") for index, thisplayer in ipairs(alltheplayers) do triggerClientEvent ( thisplayer , "showRedWinImage") end local teampoints = getElementData ( team1, "Score" ) setElementData ( team1, "Score", teampoints+1 ) end end end end Meta.xml: <file src="redwin.png" /> <file src="bluewin.png" /> <file src="tiewin.png" /> ------------------------------------------------------ Example of one of these pictures. Size: 640X480 PX, 25,8 KB But the picture doesn't show. What's wrong than?
  21. Hi, I want to show images for the client, but they must be called with the server. But how do is do this? It's for my stealth server. When a round ends, I want to show a image instead of some text. I thought about doing this: Client: function showClientRedWins() guiCreateStaticImage( 123, 123, 123, 123, "image.png", false ) end Server: triggerClientEvent ( something-here? "showClientRedWins" something-here? ) But am I doing this right? And what must I fill in for "something-here"?
  22. What the title says, am I allowed to use the Stealth maps which MTA created in SA:MP?
  23. Hi, I have a problem with my objects. I have around 750 objects, and some doesn't appear normally when I'm using the Race mode. But, when I'm in the editor, there are still some objects missing. Then, when I'm going into the test mode, I CAN see the objects! How strange! Is there a way to solve this? Here's a code of my map.
×
×
  • Create New...