Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. even if he did post the right file, it's line 9. But then again, Simple01 already said what's wrong. The $players has never been defined in the given files nor has there been a call towards the server to get the playernames.
  2. How are you calling "registerPredkosc", since you're giving the function a player element as first argument ( plr ). If you're calling this for every single user that finishes the race and not before, you should add a check in the registered function to see if plr equals to the local player. something like; function registered(plr,vehicleP,timeP) if ( plr == getLocalPlayer() ) then if vehicleP and timeP then local text = getPlayerName(plr).."-"..getVehicleNameFromModel(vehicleP).." time: "..string.format("%.2f",timeP).."\n" if text then table.insert(drag,text) addText() end end if #drag > 5 then table.remove(drag, 1) end end end addEvent("registerPredkosc",true) addEventHandler("registerPredkosc",resourceRoot,registered)
  3. tosfera

    Solved

    That's true as far as I've used the default account system. I would suggest you to transfer all the characters from the usernames to lowercase to avoid people with weird account names. This'll also fix the; I can create several accounts, but not login with them since they don't exist.
  4. Chill your massive manboobs, jesus.. no need to go all badguy on him. If you can't handle people who don't understand a lot of LUA or if you lose your temper so freakin' fast, don't help them. There are others out there which can and will help them.. @OP; I've replied to your other topic, that should work.
  5. Is the robbery cancelled if the user walks? Or can they just walk where ever they want in the robbery's progress? If you want to do it in a squishy way, you can do something like this; function renderDistanceCheck () if ( robMarker [ localPlayer ] and isElement ( robMarker [ localPlayer ] ) and percent [ localPlayer ] < 100 ) then local x, y, z = getElementPosition ( robMarker [ localPlayer ] ); if ( getDistanceBetweenPoints3D ( x, y, z, getElementPosition ( localPlayer ) ) >= 100 and getElementInterior ( localPlayer ) == 0 ) then -- the player is way too far, cancel the robbery. end end end Make sure to also add this somewhere; addEventHandler ( "onClientRender", getRootElement(), renderDistanceCheck ); Add it when the robbery starts, remove it when the robbery is over or cancelled. (took some info from PMs )
  6. Just curious, what happens when you got 3 things in that table? Do you get 3x the first and then 2 others?
  7. compared them as strings, that did solve it. No need to create it as numbers since there is no way the money could be transformed with chars in it, too much protection for that on different locations.
  8. what if you create a shader and give that shader a solid color of the vehicle which you want? Not a reflect, just a pure color.
  9. That's possible but I wouldn't go for CodyL's way. That'll still create the sound for the player and will take some cpu usage for his client. I would rather trigger an event for every player that should hear the sound.
  10. tosfera

    Help

    try this; addEventHandler ( "onClientVehicleEnter", getRootElement(), function ( thePlayer, seat ) if ( thePlayer == getLocalPlayer() and seat == 0 ) then addEventHandler ( "onClientPreRender", getRootElement(), Speedometer ); end end ); Make sure to make the same one for onClientVehicleExit but then with removeEventHandler.
  11. tosfera

    Help

    Why do you want to bind it to the localPlayer if getRootElement() does the same trick. all you have to do is check if the first parameter equals to localPlayer.
  12. Totally disagree with that on so many levels. I'm a programmer for a living, using PDO, ADODB, MangoDB, RavenDB and a shit ton of other platforms for databases. You don't have to use mysql_free_result if you don't get data back, the variable is saved in your system's memory, you're cleaning this with the mysql_free_result. If you're using a delete query, no data is returned, no need to free the result. Only select queries or insert queries which returns the last ID needs a mysql_free_result. The rest is pure bullsh*t written in books which no one ever bothered to check. The thing about the db* functions is that you can execute more than 1 query at a time and therefore MTA *might have* cleaned the result at their side already without parsing it back to the script.
  13. You can't enable this without editing the core itself and they sure have their reasons why they disabled it in MTA. ^^
  14. Actually Bonus, mysql_free_result is the same as dbFree. It both releases the handler/result which has been saved in the memory until the query has released it itself.
  15. It's a mistake a lot of people make.. the if-statement doesn't work like that. You've to ask new questions all the time; if ( teamName ~= noTeams [ 1 ] and teamName ~= noTeams [ 2 ] ) then A better ( and easier ) approach would be to create it like this; noTeams = { [ "Console" ] = true, [ "Admin" ] = true, [ "Moderator" ] = true, [ "SuperModerator" ] = true }; if ( not noTeams [ teamName ] ) then
  16. It's currently an MTA bug indeed, if you want to fix this you should set the element's data to the anim of the player and update the player's animation while (s)he streams in.
  17. tosfera

    Few questions.

    create a new table ( you should know how to do this, if not use the spoiler ) After that, allow users to chat in those channels by either loading their nickname in there, or username, or id, or what ever the hell you want. Add a new command that allows them to switch to channels, create their channel or what so ever. Once they used the command, load their specific data into the table, or just their character. After they joined a channel, using a command to talk will output a message to all the users which are in that channel. A quick tiny example would be; local channels = { }; addCommandHandler ( "joinChannel", function ( thePlayer, _, channel ) if ( channel ) then if not ( channels [ channel ] ) then channels [ channel ] = { }; outputChatBox ( "Creating a new channel with the name: ".. channel, thePlayer ); end table.insert ( channels [ channel ], thePlayer ); setElementData ( thePlayer, "channel", channel ); else outputChatBox ( "Please provide us a channelname.", thePlayer ); end end ); addCommandHandler ( "cc", function ( thePlayer, _, ... ) local channel = getElementData ( thePlayer, "channel" ); if ( channels [ channel ] ) then if ( channels [ channel ] [ thePlayer ] ) then for i = 1, #channels [ channel ] do if ( not isElement ( channels [ channel ] [ i ] ) ) then channels [ channel ] [ i ] = nil; else outputChatBox ( "[".. channel .."] ".. getPlayerName ( thePlayer )..": ".. table.concat ( {...}, " " ), channels [ channel ] [ i ] ); end end end end end );
  18. That's in the php file, line 24. You're echoing $playerName but $playerName is an object. I think the player should have stats like ping, score, name, etc. I'm just not sure atm, you should try to call some functions like; echo $playerName->username; Even though, you're returning playerelements, not their names. If you would get the names of every single player on the server and return that as a table, your loop will work.
  19. What the actual f...? You're caching an animation which has been synced by MTA theirself. OP is telling us that the animation is being looped, not being desynced. Something that does make a light turn on in my head is the bug someone reported on the bugtracker ( can't find it atm ) where dead peds would keep staying after you stream then out/in after they died. Did the fix for peds mess up the animations for players?? edit; this report, #9112. It might also be caused for the users.
  20. Is your file located in a subfolder? Did you add the file as a client sided file in your xml? <file src="feltzer.txd" type="client" /> I didn't read the first post, my bad. If you're replacing a car that isn't working or turns out different than you thought, it might be the file that has been corrupted due to downloading/uploading/exporting. Try to use another model since this isn't really MTA related, more like.. the designer's fault. Another thing that designers love to do is modify their game with a sh*tload of shaders to make them look better, while you don't have these shaders on your game and it turns out as pretty cheap plastic.
  21. IIYAMA set the animation to a looping state, this might cause some unexpected results. Turn the looping off like so; setPedAnimation ( source, "SILENCED", "SilenceCrouchfire", -1, false, false, false, true )
  22. first create the gui with GuiCreateWindow, don't show it when it gets created with guiSetVisible. After that create a colshape, and add the event "onClientColshapeHit", make sure the element is the local player, then use guiSetVisible to show it.
  23. If it's a world object, it's going to be a bit harder to delete. Find the Object ID in the list of objects, create a new removeWorldObject thing and load the model in there yourself and increase the radius to around 100. This'll surely remove it. If it's a custom map, Deym has the right answer.
  24. tosfera

    Few questions.

    What i don't understand is why there are dbFree and dbPoll don't SELECT return it already? Example: m = dbQuery(connection,"SELECT x,y,z.....) can i do now: setElementPosition(element,m[1],m[2],m[3]) As the wiki states; Use the returned query handle with dbPoll to get the result, or dbFree if you don't want the result. Use dbPoll for select queries to get your result. Once you got your result loaded into variables, you can use those to get your data into functions.
  25. You only have to save the player his settings when he disconnects, make sure to see if he was actually logged in. If you're using paydays, save all the characters each hour. I would not recommend this though, it'll fire quite some queries so don't use a timeout for this. If you want to avoid the server from freezing, yes. Use callbacks, create a nice function that executes the query and takes a parameter as a callback function back to the actual resource, will keep things clear. Well, take a look at the setElementID again. If you save the ID on the player with setElementData when the event onClientColshapeHit has been triggered, you can always easily get the actual colshape back with; local colshape = getElementByID ( getElementData ( thePlayer, "tmpColShapeId" ) ) this way you don't have to loop over all the colshapes and you'll be able to retrieve them right away.
×
×
  • Create New...