Jump to content

Kevin_Linden

Members
  • Posts

    42
  • Joined

  • Last visited

Kevin_Linden's Achievements

Rat

Rat (9/54)

0

Reputation

  1. Thanks 5Op for the links. Here is what i have so far. I haven't ran it yet but i wanted to know what the community thinks of it so far. Its just a start. I might even want to open source this if its good when its done to my likings. I also am not sure if i have to many end in the spawn function but i think i might be okay with it. I guess the CarID could be the ElementID when the car got created from the store. If this looks great. Then i plan on to make it so it will add the settings to the ElementID. I think i'll have to use something like Setelement. The SQL i'm not really sure if its right or wrong. I just wrote this in NotePad, If not i could always use the SQLite Database Browser @ http://sqlitebrowser.sourceforge.net . I also think i'll be okay with scripting. I scripted in Lsl before. So i think i'm getting used to the Syntax. Then all the functions are on the wiki. function Spawn() --This will place all the cars on the map. local result = executeSQLQuery("SELECT car FROM Cars WHERE name=?", playerName) if(#result == 0) then outputChatBox ( "There is no cars on this server. You should spend your Money on some.", root, 255, 255, 255 ) else createVehicle (CarID , Carfloatx, Carfloaty, Carfloatz , carrx, carry, carrz , numberplate) end end addCommandHandler ("SpawnCars", Spawn) function createSQL() --keep this only in here temp. Then later we can delete this, so we don't replace the database. -- create our table, if it doesn't already exist executeSQLCreateTable ( "Cars", "CarId NUMERIC NOT NULL, Owner TEXT, Carfloatx VARCHAR(50),Carfloaty VARCHAR(50),Carfloatz VARCHAR(50), carrx VARCHAR(50), carry VARCHAR(50), carrz VARCHAR(50),Lights VARCHAR(3),Locked VARCHAR(3),PaintJob VARCHAR(50), numberplate VARCHAR( UNIQUE" ) end addCommandHandler ("createSQL", Spawn)
  2. How could i do a car system where people can buy cars, Each card would have a ID. They would be reswaned by a /reswanedcar command. Cars could also have the color changed/Mods. Also they wont explode when damaged. Also the heath of the car will be saves. Also /park would save the pos. With Locks/Unlocks also being saved. I'm not really sure how to go about doing this. I kind of have a idea of using a forloop in a sql database. The reswaning is the part i'm not really sure how that would work to put the cars on the map, Then load its data looping in a sql database. I'm also not sure how to read/write to a Sql database. Also making the car not damage to the point they explode. The rest i think i can do on my own. So i just need help with the three parts, I think so far. To get me started. The rest would be reading/writing to the car Id. Which i think would be easy after i get the 1st three things.
  3. Does the SA-MP emulator for MTA still work?
  4. There is the script. function pay(Player, command, who, amount) local person = getPlayerFromName ( who ) local playerMoney = getPlayerMoney (Player) if ( playerMoney >= tonumber (amount)) and (tonumber (amount) > 0) then givePlayerMoney (person, math.abs(tonumber(amount))) takePlayerMoney (Player, math.abs(tonumber(amount))) outputChatBox ( tostring (amount) .. "$ has been paid to " .. who, Player, 255, 0, 0, false) else outputChatBox ("You cannot pay more money than you have!", Player, 255, 0, 0, false) end end addCommandHandler ("pay", pay)
  5. Okay. How can i fix it so if i had -1000 and i get paid $5 i then have -1005 but i should have -995?
  6. givePlayerMoney (person, math.abs(tonumber(amount))) It workd before i did checks but i died like a million times when my friends and random people got on my server and killed me. So then i lost tons of money for hospital bills. So i had -$0011890 then someone pays me 5$ , I then have -$0011895 when i should of had -$0011885. Not sure how to prevent that. So right now the code does not work and if it did it would allow people who are negative to keep going negative with they get paid positive. function pay(Player, command, who, amount) local person = getPlayerFromName ( who ) local playerMoney = getPlayerMoney (Player) if ( playerMoney >= tonumber (amount)) and (tonumber (amount) > 0) then givePlayerMoney (person, math.abs(tonumber(amount))) takePlayerMoney (Player, math.abs(tonumber(amount))) outputChatBox ( tostring (amount) .. "$ has been paid to " .. who, Player, 255, 0, 0, false) else outputChatBox ("You cannot pay more money than you have!", Player, 255, 0, 0, false) end addCommandHandler ("pay", pay) Also does MTA care about upper and lowercase on a Linux server?
  7. Thanks 50p. I can now look them up on the wiki!
  8. How can i make a object/person that stands there all the time that you can click that pops up a gui?
  9. I'm using on onPlayerQuit, to save people data when people exit and it works, But if i type quit in the console. there data does not save. How can i fix that?
  10. It was because i was on a 64 bit os.
  11. I do cd /home/Kevin/mta ./mta-server Then i get $ /home/Kevin/mta/mta-server -sh: /home/Kevin/mta/mta-server: not found But its there if i do $ ls LICENSE README core.so mta-server xmll.la NOTICE core.la mods net.so xmll.so So its there. What should i do? More data if it helps $ ls -la total 2016 drwxr-xr-x 3 Kevin Kevin 4096 Mar 3 05:19 . drwxr-xr-x 11 Kevin Kevin 4096 Mar 3 05:04 .. -rw-r--r-- 1 Kevin Kevin 35821 Oct 24 19:33 LICENSE -rw-r--r-- 1 Kevin Kevin 6508 Oct 24 19:33 NOTICE -rw-r--r-- 1 Kevin Kevin 29 Oct 24 19:33 README -rwxr-xr-x 1 Kevin Kevin 846 Oct 25 13:04 core.la -rwxr-xr-x 1 Kevin Kevin 280622 Oct 25 13:04 core.so drwxr-xr-x 3 Kevin Kevin 4096 Mar 3 05:11 mods -rwxrwxr-x 1 Kevin Kevin 48981 Oct 25 13:04 mta-server -rwxr-xr-x 1 Kevin Kevin 942040 Oct 24 22:21 net.so -rwxr-xr-x 1 Kevin Kevin 921 Oct 25 13:04 xmll.la -rwxr-xr-x 1 Kevin Kevin 704813 Oct 25 13:04 xmll.so $ Even fails on my root account. I want to run it on my user account for more safety.
  12. Thanks! I had to change a few things but now it works find! I'm also looking for people to be part of creating the RP.
  13. Thanks. Look like i forgot a , and my ) Thanks
  14. Thanks. Now i'm trying to add it to save laction data but its not for some reason when i check the accounts.xml Here is the script -- Based Parts and/Or whole from Icedsun's Login GUI (logingui) by icedsun AND login_register By Dr4x -- Money System added by Kevin --Default spawn location, if you wish to use one... local spawnX = 1959 local spawnY = -1714 local spawnZ = 17 --Default welcome messages... local welcomeMessageNewUser = "Welcome to our server!" local welcomeMessageReturningUser = "Welcome back to the server!" function on4XLogin ( player, user, pass, thePreviousAccount, theCurrentAccount ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) local playermoney = getAccountData ( account, "acct.money" ) setPlayerMoney ( client, playermoney ) spawnPlayer(client,spawnX,spawnY,spawnZ) fadeCamera(client,true) outputChatBox(welcomeMessageReturningUser,client) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. end end addEvent( "on4XLogin", true ) addEventHandler( "on4XLogin", getRootElement(), on4XLogin ) function on4XRegister ( player, user, pass, email ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else account = addAccount ( user, pass ) setAccountData ( account, "email", email) setAccountData ( account, "acct.money","250") if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) spawnPlayer(client,spawnX,spawnY,spawnZ) setPlayerMoney ( client, "250" ) fadeCamera(client,true) outputChatBox(welcomeMessageNewUser,client) else outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end end end addEvent( "on4XRegister", true ) addEventHandler( "on4XRegister", getRootElement(), on4XRegister ) function removePlayerHandler() local playeraccount = getPlayerAccount ( source ) local x, y, z = getElementPosition( source ) local interior = getElementInterior( source ) local playermoney = getPlayerMoney ( source ) local rotation = getPedRotation ( source ) setAccountData ( playeraccount, "acct.money", source ) setAccountData(playeraccount, "savedX", x) setAccountData(playeraccount, "savedY", y) setAccountData(playeraccount, "savedZ", z) setAccountData(playeraccount, "savedInterior", interior) setAccountData(playeraccount, "Rotation", rotation) kickPlayer(source) end addEvent("removePlayer",true) addEventHandler("removePlayer",getRootElement(),removePlayerHandler)
  15. Yes but i want to save there rotation also, how can i do that?
×
×
  • Create New...