Jump to content

cokacola

Members
  • Posts

    107
  • Joined

  • Last visited

Everything posted by cokacola

  1. hmm.. "attempt to compare number with nil" ehh.. is it not returning the player money / money to take? because i am entering the money parameter and the player has 0 money to test(i might try with money but usually it returns 0 if the player has no money, and then they should go to jail) this line: if ( gpm < money) then its line 4 in my original post's code
  2. okay got a new problem, i am trying to use this script, but it keeps telling me it can't check boolean againts a string, but i thought getPlayerMoney(thePlayer) returned a number --Cop ticket system - type /ticket [playername] [money] [reason] to give a player a ticket. It will take money from them automaticly, but if they do not have the money, it will jail them for 60 seconds function ticket ( badPlayer, money, reason ) local gpm = getPlayerMoney(badPlayer) if ( gpm < money) then setElementPosition ( badPlayer, 198.8221, 162.0566, 1003.0299 ) setElementInterior ( badPlayer, 3 ) takeAllWeapons ( badPlayer ) --remove all of the players weapons setTimer ( setElementPosition, 60000, 1, badPlayer, 2335.9614, 2454.5168, 14.9687 ) setTimer ( setElementInterior, 60000.0, 1, badPlayer, 0 ) outputChatBox ( "You've been finned " .. money .. " by a cop, you could not afford the fine and have been sent to jail for 1 minute.", badPlayer, 0, 100, 255 ) else takePlayerMoney(badPlayer, price) outputChatBox("You've been fined $150 - by a cop, for: " .. reason .. ".", badPlayer) end end addCommandHandler ( "ticket", ticket )
  3. so source......... that would make a hell of a lot of sense and i know i am passing parameters because i am using other scripts i made and i am pretty shore i am so what is a player function.. because i thought i saw the wiki using source for players ^.^ Edit: this is what i have so far: --Player mail system function createSQLOnStart () -- create our table, if it doesn't already exist executeSQLCreateTable ( "playermail", "playerto TEXT, mailmessage TEXT, mailsubject TEXT, mailread TEXT, mailfrom TEXT" ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()),createSQLOnStart ) function sendMail (sourcePlayer, command, plrToName, title, message ) playerTo = getPlayerFromNick( plrToName ) plrTo = playerTo plrTitle = title plrMessage = message res = executeSQLInsert ( "playermail", "'" .. playerTo .. ",'" .. plrMessage .. "','" .. plrTitle .. "', '0'" ) if ( res ) then outputChatBox ("Mail Sent", source) else outputChatBox ("Failed to send mail", source) end end addCommandHandler("sendmail", sendMail) function checkmail (sourcePlayer) sourcename = getPlayerFromNick( sourcePlayer ) result = executeSQLSelect ( "playermail", "playerto", "mailmessage", "mailtitle", "mailread", "playerto = '" .. sourceName .. "', mailread = '1'" ) if ( result == false ) then outputChatBox ( "No new mail found", playerTo ) else outputChatBox ( "New Mail Found, Subject: " .. result[1][3], thePlayer ) outputChatBox ( "Message: " .. result[1][2], thePlayer ) outputChatBox ( "From: " .. result[1][5], thePlayer ) executeSqlUpdate ( "playermail", "mailread = '1'", "playerto = '" .. thePlayer .. "', mailsubject = '" .. result[1][3] .. "', mailmessage = '" .. result[1][2] .. "'" ) end addCommandHandler("checkmail", checkmail) end /checkmail does nothing, and /sendmail [playername] [title] [message] gives an error: attempt to concatenate global 'playerTo'
  4. if you mean why should i make the script, its because i cannot find any mail scripts or cop ticket scripts and i don't know why checkmail won't work eather... it wont even say "no mail found" or display the mail...it needs a killing
  5. Hello, i have been trying to make a mail system for my server, i have a few things.. okay, first, here is my script so far(it renderes without errors and creates the DB) --Player mail system function createSQLOnStart () -- create our table, if it doesn't already exist executeSQLCreateTable ( "playermail", "playerto TEXT, mailmessage TEXT, mailsubject TEXT, mailread TEXT, mailfrom TEXT" ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()),createSQLOnStart ) function sendMail (playerTo, title, message, from) res = executeSQLInsert ( "playermail", "'" .. playerTo .. ",'" .. message .. "','" .. title .. "', '0', '" .. from .. "'" ) if ( res ) then outputChatBox ("Mail Sent", source) else outputChatBox ("Failed to send mail", source) end end addCommandHandler("sendmail", sendMail) function checkmail () sourcename = getClientName ( source ) result = executeSQLSelect ( "playermail", "playerto", "mailmessage", "mailtitle", "mailread", "mailfrom", "playerto = '" .. sourcename .. "', mailread = '1'" ) if ( result == false ) then outputChatBox ( "No new mail found", source ) else outputChatBox ( "New Mail Found, Subject: " .. result[1][3] ) outputChatBox ( "Message: " .. result[1][2] ) outputChatBox ( "From: " .. result[1][5] ) executeSqlUpdate ( "playermail", "mailread = '1'", "playerto = '" .. sourcename .. "', mailsubject = '" .. result[1][3] .. "', mailmessage = '" .. result[1][2] .. "'" ) end addCommandHandler("checkmail", checkmail) end Okay, so in-game "/sendmail" and "/checkmail" do nothing(not actually shore on sendmail because it has no output) so i dunno why i does nothing. Secondly, is there a way i can make it so only admins can send mail, and if this is possible, make it so the server can auto send mail(because cops can give out tickets, so i am also trying to work out how to make a ticket script force you to pay after 2 game days or jails you, i need help on where to start, i already have a jail script i can use) so yea, got a few things i need help with, but mainly, i need it to work thanks! EDIT: may i ask what this means? when i try to use sendmail, this happons in server console: "Error: *pathtoscript*:266 attempting to concatenate global 'playerto' " I am passing all required parameters (tried typing bizzycola and for my id '0' still getting nothing, also checkmail won't even say "no new mail" it also does nothing, but returns no errors Edit2: forgot 1 more thing, is there a way to tell if someone is putting out a fire?(for job script i am also making) oh and also, anyone who solves my problems / answers my questions gets in the credits..(i am going to make a /credits or something) and no, i am not asking you to write my scripts for me Edit3: if anyone knows how, i think the script would work better usig a text file,, but i don't know how to use text files with my script yet, oh and 1 other thing, when the script works, feel free to use it...credit would be nice, but not required...
  6. ahh I am opening it as an exe file... double click, and select the directory. It just gives the error.
  7. okay, i downloaded the nightly build, the data exe file and the resources from google code. I can install the nightly build exe, and extract the resources but the required data file wont install. it says its a 7z-zip extractor but 7z-zip says it cannot open it as an archive when i press the extract button. any help is welcome Also, i downloaded it twice, and tried on 2 PC's, it just says it cant open it as an archive. filename: "multitheftauto_data-r188.exe" Error #0, message: "Can not open file 'C:\multitheftauto_data-r188.exe' as archive" P.s, i did try it in other folders an xtracting it elsewhere...allways same message, thanks.
  8. is there somewhere in the wiki i can find onVehicleDamage - it doesn't appear to be there...
  9. okay thanks didn't notice there was a vehicle damage function but the car engine state works as i have /engine to start and stop the engine(found it here, but understand how it works ) thanks! Edit: Okay, I tried it, and it doesn't do anything...here is my code, and i smashed into many a wall with the car function stopEngine() setVehicleEngineState2(source, false) end addEventHandler("onVehicleDamage",getRootElement(),stopEngine) say...just does nothing EDIT: okay it works now, but its really easy to break a car.. just tap a pole and the engine stops, is it possible to make it so you'd have to hit something hard for it to stop?
  10. okay, hello, just wondering if it is possible to stop a car engine when you crash into something solid... they can start engine again, as i have a /engine script i found, but just wondered if you can stop car engine when crashing not really shore you can, but i'd like to try
×
×
  • Create New...