
xXMADEXx
Members-
Posts
2,718 -
Joined
-
Last visited
Everything posted by xXMADEXx
-
Thank you, and will i have to make a "triggerServerEvent" for the message to send to the player?
-
you should put in --LUA not Code
-
Hey guys, how can i make this, so that it will not send a message, if there is no text in "ed_msg"? And, how can i make it so that when they send a message, it will outputChatBox("You sent an SMS to "..who, but instead of it showing the player's id, it will show there name? -- GUI local resX,resY = guiGetScreenSize() local width,height = 422,217 local X = (resX/2) - (width/2) local Y = (resY/2) - (height/2) window = guiCreateWindow(X,Y,width,height,"Send A Message",false) guiWindowSetSizable(window,false) guiSetVisible(window,false) playerList = guiCreateGridList(10,25,403,109,false,window) guiGridListSetSelectionMode(playerList,2) column = guiGridListAddColumn(playerList,"Players",0.9) ed_msg = guiCreateEdit(89,138,320,38,"",false,window) btn_send = guiCreateButton(9,180,180,28,"Send!",false,window) btn_close = guiCreateButton(209,180,201,28,"Cancel",false,window) lbl_msg = guiCreateLabel(21,147,62,25,"Message:",false,window) guiSetProperty(btn_send,"HoverTextColour","ffffff000") guiSetProperty(btn_close,"HoverTextColour","fff000000") guiLabelSetColor(lbl_msg,0,255,0) guiSetFont(lbl_msg,"default-bold-small") guiEditSetMaxLength(ed_msg,80) -- Open GUI bindKey("h", "down", function ( ) guiSetVisible(window, not guiGetVisible ( window )) showCursor(guiGetVisible ( window )) if ( guiGetVisible ( window ) ) then guiGridListClear ( playerList ) if ( column ) then for id, player in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( playerList ) local r, g, b = getPlayerNametagColor ( player ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) guiGridListSetItemColor ( playerList, row, column, r, g, b ) end end end end ) -- Close Button addEventHandler("onClientGUIClick",btn_close, function () if (source == btn_close) then guiSetVisible(window, false) showCursor(false,false) end end ) -- Send function send() local who = guiGridListGetSelectedItem(playerList) local msg = tostring(guiGetText(ed_msg)) if (source == btn_send) then outputChatBox("Message sent to "..who,0,255,255) if (msg == "") then ouputChatBox("Error: You need to enter a message.",255,0,0) cancelEvent() end end end addEventHandler("onClientGUIClick",btn_send,send)
-
Hey guys, i am trying to get Valhalla working on my local host, but i cannot get past the login. And, if you turn off the account-system, the server will not function correctly. I am hosting XMATT on my computer, with the database, but it willnot connect.If you know how to fix it, please PM me, or add me on skype: topkidminer Here are my current acccount-system, and mysql scripts: < link removed >
-
dude, this is my script.
-
Didn't work
-
For some reason the gate dosn't open server.lua objct1 = createObject ( 980, -55, -95, 1013,0,0,90) setElementInterior(objct1,18) function gateOpen() moveObject (objct1, 500, -55, -95, 1005) playSoundFrontEnd(source, 1) triggerEvent(source,"message:addMessage",source,"Jail: Moving Main Gate.",255, 255, 0) end addEvent("jail.gate.open",true) addEventHandler("jail.gate.open",gateOpen) client.lua --Gate mrkr = createMarker( -54.1416015625, -91.8134765625, 1010.182800293, "cylinder", 8, 0, 255, 0, 80) setElementInterior(mrkr,18) window = guiCreateWindow(471,334,337,268,"Jail",false) guiSetAlpha(window,1) guiSetVisible(window,false) guiWindowSetMovable(window,false) guiWindowSetSizable(window,false) lbl = guiCreateLabel(9,28,316,109,"Open\nGate?",false,window) guiLabelSetColor(lbl,255,0,0) guiLabelSetHorizontalAlign(lbl,"center",false) guiSetFont(lbl,"sa-header") btn_accpt = guiCreateButton(9,198,157,61,"Yes",false,window) btn_close = guiCreateButton(167,198,157,61,"No",false,window) function onhit() guiSetVisible(window,true) showCursor(true) end addEventHandler("onClientMarkerHit",mrkr,onhit) function close() guiSetVisible(window,false) showCursor(false,false) end addEventHandler("onClientGUIClick",btn_close,close) function accept() triggerServerEvent("jail.gate.open") outputChatBox("Jail: Main gate opening...",255,255,0) guiSetVisible(window,false) showCursor(false,false) end addEventHandler("onClientGUIClick",btn_accpt,accept)
-
Hey guys, i am making a jail system. For some reason, if the "p2" is in a vehicle, it wont destroy it, and i dont know how to make it so that it will not jail an unknown player. any help? --[[ Author: RoG Scripting Team Name: RoG Jail System File: server.lua type: server Copywrite (c) Revolution of Gaming ]] function jail(p1,_,p2,...) local text = table.concat({...}, " ") local nick=getPlayerName(p1) local nick2=getPlayerFromName(p2) local data=getElementData(p1,"Job") -- if (data=="Staff") then if (p2) and (...) then if isPedInVehicle(p2) then destroyElement(getPedOccupiedVehicle(p2)) end setElementPosition(nick2,264.1982421875, 77.5634765625, 1001.0390625) setElementInterior(nick2,6) triggerClientEvent(getRootElement(),"message:addMessage",getRootElement(),getPlayerName(nick2) .." Has Been Jailed By Admin ".. nick .." For: ".. text, 255, 0, 0) destroyElement(vehicle) else triggerClientEvent(p1,"message:addMessage",p1,"Usage: /jail [name] [reason]", 255, 0, 0) end end end addCommandHandler("jail",jail)
-
How can i make it, so that when the time in the server turns to 0 that the gate moves up, and when the time turns to 6 the gate moves down? function myGate(player) gate = createObject(980, 1012.5, -902.5, 43, 0, 0, 95) local gateTimer = getTime() if (gateTimer == 0) then moveObject (gate, 500, 96.861328, 1915.637, 30 ) elseif (gateTimer == 6) then moveObject (gate, 500, 1012.5, -902.5, 43 ) end end
-
I would recommend Castillo, or 50p. They are prob the best scripters on MTA.
-
How can i make it, so that when someone spawns a car it locks it to team Military? I attempted it, but it didn't work: ----------- This Area Here. -------- function spawnVeh(id) local x, y, z = getElementPosition(source) local team = getTeamName(getPlayerTeam(source)) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, x, y, z) warpPedIntoVehicle ( source, vehicles[source] ) setVehicleColor( vehicles[source], 0, 255, 0 ) addEventHandler("onVehicleStartEnter", vehicles[source], -- Im not sure if i can do this. if (team=="Military")then else triggerClientEvent(source,"message:addMessage",source,"You are not in the Military!",255, 0, 0) cancelEvent() end) end addEvent("CreVehice_group_military",true) addEventHandler("CreVehice_group_military", root, spawnVeh)
-
Thank you castillo, but is there a way to get the selected player, and set him to the selected rank? Like, so there is a colum on the scoreboard named "VIP", and how can you make there VIP status to the rank that is selected for the player that is selected. (sorry, i dont really know how to explain it.) and make it on an ACL lock for lvl 5 and lvl 6
-
How can i fix it, so it will list all the in-game players in the colum_name on the 'PlayerList' grid. And how do i make it so that on createVIP_colum_rank in createVIP_grid_rank will have the ranks "Rich-Man, Gold, Silver, Bronze" ? createVIP_wnd = guiCreateWindow(357,172,475,425,"Make A VIP",false) guiWindowSetSizable(createVIP_wnd,false) guiSetVisible(createVIP_wnd,false) createVIP_bnt_makevip = guiCreateButton(9,382,221,34,"Make Him A VIP",false,createVIP_wnd) createVIP_bnt_cancel = guiCreateButton(234,382,221,34,"Cancel",false,createVIP_wnd) playerList = guiCreateGridList(14,22,443,182,false,createVIP_wnd) column_name = guiGridListAddColumn(playerList,"Player",0.-- s8) --> createVIP_grid_rank = guiCreateGridList(14,199,443,182,false,createVIP_wnd) createVIP_colum_rank = guiGridListAddColumn(createCIP_grid_rank,"Rank",0.-- s8) --> bindKey("F1", "down", function ( ) guiSetVisible(createVIP_wnd, not guiGetVisible ( createVIP_wnd )) showCursor(guiGetVisible ( createVIP_wnd )) if ( guiGetVisible ( createVIP_wnd ) ) then guiGridListClear ( playerList ) if ( column ) then for id, player in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( playerList ) local r, g, b = getPlayerNametagColor ( player ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( player ), false, false ) guiGridListSetItemColor ( playerList, row, column, r, g, b ) end end end end ) -- Open Menu --[[function open() guiSetVisible(createVIP_wnd,true) showCursor(true) end addCommandHandler("makevip", open) bindKey("F1","down",open)]] -- Close Menu function close() guiSetVisible(createVIP_wnd,false) showCursor(false,false) end addEventHandler("onClientGUIClick", createVIP_bnt_cancel, close)
-
Thanks, if fixed that old problem, But how can i make the xml file load correctly when i start the resource? function createFileHandler (player) myfile = xmlCreateFile("spawners.xml","spawners") --NewNode = xmlCreateChild(myfile, "spawner") xmlSaveFile(myfile) outputChatBox("spawners.xml has successfuly been created!", player, 0,255,0) end addCommandHandler ( "file", createFileHandler ) function onstart() xmlLoadFile ( "spawners.xml" ) end addEventHandler("onResourceStart", onstart) function createspawners (player) if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "lvl 5" ) ) then local x, y, z = getElementPosition ( player ) -- local rot = getPedRotation ( player ) local int = getElementInterior ( player ) local dim = getElementDimension ( player ) local file = xmlLoadFile("spawners.xml") if (file) then local newChild = xmlCreateChild ( file, "spawners", 0 ) xmlNodeSetAttribute ( newChild, "x", x ) xmlNodeSetAttribute ( newChild, "y", y ) xmlNodeSetAttribute ( newChild, "z", z ) xmlNodeSetAttribute ( newChild, "int", int ) xmlNodeSetAttribute ( newChild, "dim", dim ) created = createMarker (x, y, z-1, "cylinder", 2, 255, 0, 0, 200) setElementInterior ( created, int ) outputChatBox ( "Marker has successfully been created!", player, 0, 255, 0 ) addEventHandler("onMarkerHit",created,showGUI) xmlSaveFile(file) else outputChatBox ( "Spawners: spawners.xml has failed to load! Fixing problem now.", player, 255, 0, 0 ) xmlCreateChild(file, "spawner") end else outputChatBox ( "Spawners: This command is only for admins!", player, 255, 0, 0 ) end end addCommandHandler ( "create", createspawners )
-
I have made this script, the xml file will create fine, but when i type /create it will not insert the data. Please help. function createFileHandler (player) myfile = xmlCreateFile("spawners.xml","spawners") NewNode = xmlCreateChild(myfile, "spawner") xmlSaveFile(myfile) outputChatBox("spawners.xml has successfuly been created!", player, 0,255,0) end addCommandHandler ( "file", createFileHandler ) function createspawners (player) if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "lvl 5" ) ) then local x, y, z = getElementPosition ( player ) -- local rot = getPedRotation ( player ) local int = getElementInterior ( player ) local dim = getElementDimension ( player ) local file = xmlLoadFile("spawners.xml") if (file) then local newChild = xmlFindChild ( file, "spawners", 0 ) xmlNodeSetAttribute ( newChild, "x", x ) xmlNodeSetAttribute ( newChild, "y", y ) xmlNodeSetAttribute ( newChild, "z", z ) xmlNodeSetAttribute ( newChild, "int", int ) xmlNodeSetAttribute ( newChild, "dim", dim ) created = createMarker (x, y, z-1, "cylinder", 2, 255, 0, 0, 200) setElementInterior ( created, int ) outputChatBox ( "Marker has successfully been created!", player, 0, 255, 0 ) else outputChatBox ( "Spawners: spawners.xml has failed to load! Fixing problem now.", player, 255, 0, 0 ) xmlCreateChild(myfile, "spawner") end else outputChatBox ( "Spawners: This command is only for admins!", player, 255, 0, 0 ) end end addCommandHandler ( "create", createspawners )
-
Is there a way so that if someone types an unknow command that the server will output to them "Server: Error that command does not exist" ? If it is, how would i do this?
-
Can someone help me make it so that this gui works properly? I want it so that it only works for Police, FBI, MIlitary, and Swat. And, i am not sure how to make the colums work. I only got the "player" colum working. Thanks in advance. function cancelPedDamage ( attacker ) cancelEvent() end addEventHandler ( "onClientPedDamage", getRootElement(), cancelPedDamage ) police_window = guiCreateWindow(350,205,728,380,"RoG Police Window",false) guiSetVisible(police_window, false) guiSetAlpha(police_window,1) guiWindowSetSizable(police_window,false) playerList = guiCreateGridList(14,34,699,272,false,police_window) column_name = guiGridListAddColumn(playerList,"Name",0.2) column_team = guiGridListAddColumn(playerList,"Team",0.2) column_wanted = guiGridListAddColumn(playerList,"Wanted-Level",0.2) police_closeBTN = guiCreateButton(163,325,416,36,"Close",false,police_window) bindKey("F4", "down", function ( ) --local playerTeam = getPlayerTeam ( source ) --if ( playerTeam == "Police" ) or ( playerTeam == "Military" ) or ( playerTeam == "FBI" ) or ( playerTeam == "Swat" ) then guiSetVisible(police_window, not guiGetVisible ( police_window )) showCursor(guiGetVisible ( police_window )) if ( guiGetVisible ( police_window ) ) then guiGridListClear ( playerList ) if ( column_name ) then for id, player in ipairs ( getElementsByType ( "player" ) ) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column_name, getPlayerName ( player ), false, false ) guiGridListSetItemColor ( playerList, row, column_name, 255, 0, 0 ) end end if ( column_team ) then for i,team in ipairs(teams) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column_team, getTeamName(getPlayerTeam(player)), false, false ) guiGridListSetItemColor ( playerList, row, column_team, 255, 0, 0 ) end end end --end end ) -- Close Button function close() guiSetVisible(police_window, false) showCursor(false,false) end addEventHandler("onClientGUIClick", police_closeBTN, close)
-
I'm just curious, but is Towncivilian a develuper for MTA? Like, actually a coder for the DLL files and stuff? Anyway, Happy Birthday!
-
I cannot get what i need out of it.
-
Try this code (i have not tested it) function createMyTeam(player,cmd,...,c1,c2,c3) -- Discribes the command local text = table.concat({...}, " ") -- Get text for team name myTeam = createTeam(...,c1,c2,c3) -- Create the team setPlayerTeam(player,myTeam) -- Set Play to the team that they have just created end -- ends function addCommandHandler("createteam", createMyTeam) -- Command --[[ The command Syntax is /createteam teamname colorRed colorGreen colorBlue For Example: /createteam 255 255 0 --]]
-
How can i make it so that when the player quits, it will save the players "job" (Job on scoreboard), and when someone joins it will set the account data to the job colum that they left on. Here is my server side code: function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") local playerWeaponID0 = getAccountData (theCurrentAccount, "funmodev2-weaponID0") local playerWeaponID1 = getAccountData (theCurrentAccount, "funmodev2-weaponID1") local playerWeaponID2 = getAccountData (theCurrentAccount, "funmodev2-weaponID2") local playerWeaponID3 = getAccountData (theCurrentAccount, "funmodev2-weaponID3") local playerWeaponID4 = getAccountData (theCurrentAccount, "funmodev2-weaponID4") local playerWeaponID5 = getAccountData (theCurrentAccount, "funmodev2-weaponID5") local playerWeaponID6 = getAccountData (theCurrentAccount, "funmodev2-weaponID6") local playerWeaponID7 = getAccountData (theCurrentAccount, "funmodev2-weaponID7") local playerWeaponID8 = getAccountData (theCurrentAccount, "funmodev2-weaponID8") local playerWeaponID9 = getAccountData (theCurrentAccount, "funmodev2-weaponID9") local playerWeaponID10 = getAccountData (theCurrentAccount, "funmodev2-weaponID10") local playerWeaponID11 = getAccountData (theCurrentAccount, "funmodev2-weaponID11") local playerWeaponID12 = getAccountData (theCurrentAccount, "funmodev2-weaponID12") local playerWeaponAmmo0 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo0") local playerWeaponAmmo1 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo1") local playerWeaponAmmo2 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo2") local playerWeaponAmmo3 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo3") local playerWeaponAmmo4 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo4") local playerWeaponAmmo5 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo5") local playerWeaponAmmo6 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo6") local playerWeaponAmmo7 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo7") local playerWeaponAmmo8 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo8") local playerWeaponAmmo9 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo9") local playerWeaponAmmo10 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo10") local playerWeaponAmmo11 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo11") local playerWeaponAmmo12 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo12") local scorejob = getElementData(theCurrentAccount, "Job") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setTimer (setElementHealth, 50, 1, source, playerHealth) setTimer (setPedArmor, 50, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 50, 1, source, playerWanted) giveWeapon(source, playerWeaponID0, playerWeaponAmmo0, true) giveWeapon(source, playerWeaponID1, playerWeaponAmmo1, true) giveWeapon(source, playerWeaponID2, playerWeaponAmmo2, true) giveWeapon(source, playerWeaponID3, playerWeaponAmmo3, true) giveWeapon(source, playerWeaponID4, playerWeaponAmmo4, true) giveWeapon(source, playerWeaponID5, playerWeaponAmmo5, true) giveWeapon(source, playerWeaponID6, playerWeaponAmmo6, true) giveWeapon(source, playerWeaponID7, playerWeaponAmmo7, true) giveWeapon(source, playerWeaponID8, playerWeaponAmmo8, true) giveWeapon(source, playerWeaponID9, playerWeaponAmmo9, true) giveWeapon(source, playerWeaponID10, playerWeaponAmmo10, true) giveWeapon(source, playerWeaponID11, playerWeaponAmmo11, true) giveWeapon(source, playerWeaponID12, playerWeaponAmmo12, true) setElementData(source, "Job", true) setCameraTarget (source, source) fadeCamera(source, true, 2.0) else spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0,78, 0, 0) setPlayerMoney (source, 200) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x,y,z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) setAccountData (account, "funmodev2-weaponID0", getPedWeapon (source, 0)) setAccountData (account, "funmodev2-weaponID1", getPedWeapon (source, 1)) setAccountData (account, "funmodev2-weaponID2", getPedWeapon (source, 2)) setAccountData (account, "funmodev2-weaponID3", getPedWeapon (source, 3)) setAccountData (account, "funmodev2-weaponID4", getPedWeapon (source, 4)) setAccountData (account, "funmodev2-weaponID5", getPedWeapon (source, 5)) setAccountData (account, "funmodev2-weaponID6", getPedWeapon (source, 6)) setAccountData (account, "funmodev2-weaponID7", getPedWeapon (source, 7)) setAccountData (account, "funmodev2-weaponID8", getPedWeapon (source, -- s8) -->) setAccountData (account, "funmodev2-weaponID9", getPedWeapon (source, 9)) setAccountData (account, "funmodev2-weaponID10", getPedWeapon (source, 10)) setAccountData (account, "funmodev2-weaponID11", getPedWeapon (source, 11)) setAccountData (account, "funmodev2-weaponID12", getPedWeapon (source, 12)) setAccountData (account, "funmodev2-weaponAmmo0", getPedTotalAmmo (source, 0)) setAccountData (account, "funmodev2-weaponAmmo1", getPedTotalAmmo (source, 1)) setAccountData (account, "funmodev2-weaponAmmo2", getPedTotalAmmo (source, 2)) setAccountData (account, "funmodev2-weaponAmmo3", getPedTotalAmmo (source, 3)) setAccountData (account, "funmodev2-weaponAmmo4", getPedTotalAmmo (source, 4)) setAccountData (account, "funmodev2-weaponAmmo5", getPedTotalAmmo (source, 5)) setAccountData (account, "funmodev2-weaponAmmo6", getPedTotalAmmo (source, 6)) setAccountData (account, "funmodev2-weaponAmmo7", getPedTotalAmmo (source, 7)) setAccountData (account, "funmodev2-weaponAmmo8", getPedTotalAmmo (source, -- s8) -->) setAccountData (account, "funmodev2-weaponAmmo9", getPedTotalAmmo (source, 9)) setAccountData (account, "funmodev2-weaponAmmo10", getPedTotalAmmo (source, 10)) setAccountData (account, "funmodev2-weaponAmmo11", getPedTotalAmmo (source, 11)) setAccountData (account, "funmodev2-weaponAmmo12", getPedTotalAmmo (source, 12)) setElementData(account, "Job") end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) if not( isGuestAccount (getPlayerAccount(source)) ) then local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) fadeCamera (source, false) setTimer (spawnPlayer, 1000, 1, source, 2036.1735839844, -1413.0563964844, 16.9921875, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 1250, 1, source, source) setTimer (fadeCamera, 2000, 1, source, true) setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) --- function setTeam() local account = getPlayerAccount(source) -- gets players account local team = getAccountData (account, "team") -- gets players team if (team) and getTeamFromName(team) then setPlayerTeam(source, getTeamFromName(team)) -- sets players team end end addEventHandler("onPlayerLogin",root,setTeam) -- sets players team on login function save() local team = getPlayerTeam(source) -- Gets the players team local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then -- Checks to see if the player is a guest or not setAccountData(account, "team", getTeamName(team)) --saves team end end addEventHandler("onPlayerQuit", getRootElement(), save) -- saves team on quit
-
You should read the MTA wiki.