Jump to content

the help Prieto topic


Recommended Posts

OK so I'm tired pf making new topics every time i need to know something so its better if i keep it to one topic alone that way i can use it of reference too.

1.

Q. is there a way to compile client side scripts? like if someone opens the file they don't see the code?

A. https://forum.multitheftauto.com/viewtop ... 76#p293078

2.

Q. how can i color the text that comes on the chat and how can i make it that something just shows for only one person and not everyone connected.

A. https://forum.multitheftauto.com/viewtop ... at#p293271

3.

why mta does not recognize lua edit 5.1 compiled files.

4.

how can i add txd like for paint jobs on a car not change, like the banshee it does not have Paint jobs but you can add them via the gta3.img but is it possible to add paint jobs in mta like new txd not replacing.

5.

Q. how does external downloading works, and wich files do i need to put on the external server does it have to be the whole server or just some files.

A. https://forum.multitheftauto.com/viewtop ... at#p293354

6.

Q. How can i make that people MUST register on the server before playing on the server, don't tell me the whole code just point me in the right direction, that's all i need

A. https://forum.multitheftauto.com/viewtop ... at#p293361

7.

Q.Does someone knows the id for the emmet ped cause i looked trough the wiki and couldn't find it, and looked trough the admin resource and nothing, so if someone knows this please let me know, thanks in advance.

A. https://forum.multitheftauto.com/viewtop ... 15#p293639

8.

Q. is really a problem not a question https://forum.multitheftauto.com/viewtop ... 33#p294133

9.

Q. how can i make the time in the game represent the time in the server and how can i specify some function to work at a desired time.

Edited by Guest
Link to comment

The main advantage of a compiler is that it makes your resource a bit faster to load and smaller to download. It doesn't really provide any security and you shouldn't expect it to. Put 'sensitive' code server-side.

Link to comment

There's no decompiler for lua 5.1, if I remember correctly. Though, regardless, in my opinion, there should at least be some sort of rudimentary protection system. (If there were client-side file I/O functions, we could easily make one.)

There's nothing wrong about sharing, but there should definitely be a choice in the matter, at least for the person who could've spent hours, days, weeks or months on making a resource just to have it stolen, edited to fill in someone else's name and used without payment, credits or even thanks.

Link to comment

Uncached scripts are one option, but with the obvious disadvantage of having to be redownloaded every time. Some kind of encryption might be better. Everytime I've brought this up people have started bitching about it being crackable, but it seems to me that even a flawed security system is better than no security system at all, and definitely a system that wasn't even designed for security.

It could also be made a little more unpredictable by encrypting on the fly, (before server -> client transmission,) choosing random encryption keys (based on an initial value to be chosen by a server owner.)

Link to comment

if you just need one color for the whole text you can use the color parameters in http://development.mtasa.com/index.php? ... putChatBox

bool outputChatBox ( string text, [ element visibleTo=getRootElement(), int r=255, int g=255, int b=255, bool colorCoded=false ] ) --255 255 255 == white

for more colors you can use hex codes with # (for example "#FF0000Hello" would make the Hello (and everything after it till the next hexcode comes) appear in red, however if you want to use it you need to enable color code with a "true" after the color parameters (see example)

as you can see theres also a element visible to parameter, for example when using a command for personal messages it could look similar to this:

function pmSendingFunction(player,command,targetplayer, ...) 
    local message = table.concat({...}, " ") 
    outputChatBox("PM from #FF0000"..getPlayerName(player).."#FFFFFF: "..message,getPlayerFromName(targetplayer),255,255,255,true) 
end 
  
addCommandHandler("pm",pmSendingFunction) 

however this is untested but should work

ah one more thing: you can also use outputChatBox client-side, in some/many cases this can be a better way to go just using

if blah == getLocalPlayer() then  
outputChatBox("hello")  
end 

well that depends on what you want to archive

Link to comment

ok to make more easy cause i saw the wiki examples and it was not what i needed but i really apreciate the help, so here's my code

function PlayerDied ( ) 
         
        local x = 2034.3935546875 
        local y = -1402.564453125 
        local z = 17.296909332275 
        local r = 202.57781982422 
         
        setTimer ( spawnPlayer, 60000, 1, source, x, y, z, r ) --spawn player after 1 minute in the hospital 
        -- i want the code below just to show to the guy who died and in some color 
        outputChatBox ( "Has sido gravemente herido si en 10 minutos no se presenta un medico" ) 
        outputChatBox ( "seras trasladado automaticamente al hospital" ) 
  
end 
  
addEventHandler ( "onPlayerWasted", getRootElement( ), PlayerDied )      

Edited by Guest
Link to comment
function PlayerDied ( ) 
         
         local x = 2034.3935546875 
         local y = -1402.564453125 
         local z = 17.296909332275 
         local r = 202.57781982422 
         
         setTimer ( spawnPlayer, 60000, 1, source, x, y, z, r ) --spawn player after 1 minute in the hospital 
         -- i want the code below just to show to the guy who died and in some color 
         outputChatBox ( "Has sido gravemente herido si en 10 minutos no se presenta un medico",source,255,0,0 ) --source is the player element which died so we take him as the element it should be visible to | 255,0,0 would make this text red 
         outputChatBox ( "seras trasladado automaticamente al hospital",source,0,255,0 ) --same here, except that 0,255,0 would make this text green 
   
 end 
   
 addEventHandler ( "onPlayerWasted", getRootElement( ), PlayerDied )   

Link to comment

5. basically you just need some webspace, the external download can provide much more speed that an average dedicated server can but usually less than a root server. all client-side files +images+help.xml+sounds+models+textures+[...] need to be uploaded. serverside script files and the meta.xml DON'T need to be uploaded.

i recommend you not to use it atm, many people have random problems downloading from them and the overall benefit is small as long as you don't have too much music, sounds, images and models.

Link to comment
5. basically you just need some webspace, the external download can provide much more speed that an average dedicated server can but usually less than a root server. all client-side files +images+help.xml+sounds+models+textures+[...] need to be uploaded. serverside script files and the meta.xml DON'T need to be uploaded.

i recommend you not to use it atm, many people have random problems downloading from them and the overall benefit is small as long as you don't have too much music, sounds, images and models.

thanks for your help.

new question ppl haha i know i ask a lot but i have to learn on way or another,

https://forum.multitheftauto.com/viewtop ... at#p293076

question number 6

Link to comment

Q: #6

A: You need to check if they are already registered using Account functions

- http://development.mtasa.com/index.php? ... _functions

If you want to register players using GUI then you'll need Event functions, to trigger server-side events and GUI functions

- http://development.mtasa.com/index.php? ... _functions

- http://development.mtasa.com/index.php? ... _functions

- or https://forum.multitheftauto.com/viewtop ... 91&t=24122

Link to comment

Also a bit more on 6. You could just make a login screen which triggers onPlayerJoin. Login screen has logging in and registering part. So if he's registered, force him to login, if not registered, force to register and login or leave the server.

Link to comment
Q: #6

A: You need to check if they are already registered using Account functions

- http://development.mtasa.com/index.php? ... _functions

If you want to register players using GUI then you'll need Event functions, to trigger server-side events and GUI functions

- http://development.mtasa.com/index.php? ... _functions

- http://development.mtasa.com/index.php? ... _functions

- or https://forum.multitheftauto.com/viewtop ... 91&t=24122

thanks I'm learning little by little.

Link to comment
  • 2 weeks later...

So i have i little problem with this trying to play a sound when the car starts and im using playSound3D so nott everyone on the server hears the sound only the close by players.

Server side

function car ( playerInCar )
vehicle = getPedOccupiedVehicle ( playerInCar )
	seat = getPedOccupiedVehicleSeat ( playerInCar )
	eState = getVehicleEngineState ( vehicle )
--local a,b,c = getElementPosition ( vehicle )
 
if ( vehicle ) then 
if  ( seat == 0 ) then 
if ( eState == true ) then
setVehicleEngineState ( vehicle, false )
else
setTimer ( setVehicleEngineState, 2000, 1, vehicle, true )
--posi = getElementPosition ( vehicle )
triggerClientEvent ( playerInCar, "onCarStart", playerInCar )
end
end
end
end
addCommandHandler ( "motor", car )

Client Side

function carSound ( )
local x, y, z = getElementPosition ( playerInCar )
playSound3D ( "files/sounds/engine.wav", x, y, z )
end
addEvent ( "onCarStart", true )
addEventHandler ( "onCarStart", getRootElement(), carSound )

Link to comment

so, you want that those players who stays near car, heared an engine sound, right? then you need to trigger event for all players on server.

i think line 14 should be:

triggerClientEvent ( getRootElement(), "onCarStart", playerInCar )

well, as i can see on wiki, the first argument is optional, so you can leave it, or put there rootElement, like i did just for explanation, that this event will be triggered for all players :)

Link to comment
so, you want that those players who stays near car, heared an engine sound, right? then you need to trigger event for all players on server.

i think line 14 should be:

triggerClientEvent ( getRootElement(), "onCarStart", playerInCar )

well, as i can see on wiki, the first argument is optional, so you can leave it, or put there rootElement, like i did just for explanation, that this event will be triggered for all players :)

i forgot to metion the problem i have us in the getElementPostion it says badargument.

Link to comment

in client side?

there should be 'source' cse the source of your event is player for which was triggered event.

local x, y, z = getElementPosition ( source )

But then you should trigger your event only for this player who starts engine of vehicle, so, ignore my previous post.

Link to comment
...

9.

Q. how can i make the time in the game represent the time in the server and how can i specify some function to work at a desired time.

- http://development.mtasa.com/index.php?title=SetTime

- http://development.mtasa.com/index.php? ... teDuration

- to call a function at specific time you need to make a timer that calls a function which checks the time. Or whenever you change the time with setTime check what time you're setting and call the function.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...