-stolka-
Members-
Posts
144 -
Joined
-
Last visited
Everything posted by -stolka-
-
the debugscript reports bad agrumnet line 115, expected account at argument 1 ------------------------------------------------------------------------------------ -- PROJECT: N/A -- RIGHTS: All rights reserved by developers -- FILE: groupSystem/group.slua -- DEVELOPER: Sebbe (Smart) ------------------------------------------------------------------------------------ local groupTable = {} local log = true -- Set this to false if you don't want group stuff to be logged in your server.log local debugInfo = true -- Set this to false if you don't want to see see group logs in your debug mode. local GAC = {} -- index = account (string), [1] = group name, [2] = rank, [3] = warning level, [4] = date Joined, [5] = last time online (Not Available) local users = {} local myGang = {} local char = "[^0-9a-zA-Z_]" local rankCache = {} local db = dbConnect("sqlite", "/database.db") dbExec(db, "CREATE TABLE IF NOT EXISTS groupmember (account TEXT, groupName TEXT, rank TEXT, warningLvl TEXT, joined TEXT, lastTime TEXT)") dbExec(db, "CREATE TABLE IF NOT EXISTS groups (name TEXT, leader TEXT, message TEXT, chatcolor TEXT, notecolor TEXT, date TEXT, turfcolor TEXT)") dbExec(db, "CREATE TABLE IF NOT EXISTS groupRanks (groupName TEXT, name TEXT, permissions TEXT)") --Some misc functions _outputDebugString = outputDebugString function outputDebugString(string) if (debugInfo) then _outputDebugString(string) end end function getTime() local time = getRealTime() local date = string.format("%02d/%02d/%02d", time.monthday, (time.month+1), (time.year-100) ) local time = string.format("%02d:%02d", time.hour, time.minute) return date, time end MTAoutput = outputChatBox function outputChatBox(message, player, r, g, b, bool) if (isElement(message) and getElementType(message) == "player") then MTAoutput(player, message, r, g, b, bool) else outputChatBox(message, player, r, g, b, bool) end end function groupLog(group, message) if (log) then outputServerLog("GROUP: "..group.." - "..message) end if (debugInfo) then outputDebugString("GROUP: "..group.." - "..message) end end --Lets start local permToTable = { [1] = "invite", [2] = "promote", [3] = "demote", [4] = "kick", [5] = "warn", [6] = "delete", [7] = "deposit", [8] = "withdraw", [9] = "editInfo", [10] = "viewLog", [11] = "viewBlacklist", [12] = "addBlaclist", [13] = "changeTurfColor", [14] = "modifyAlliance", [15] = "modifyRanks", } function account(plr) if (plr and isElement(plr)) then accP = getPlayerAccount(plr) return getAccountName(accP) end end function loadGroupRanks(query) local the_table = dbPoll(query, 0) if (the_table) then for ind, data in pairs(the_table) do if (not rankCache[data.groupName]) then rankCache[data.groupName] = {} end if (not rankCache[data.groupName][data.name]) then rankCache[data.groupName][data.name] = {} end local JSONtable = fromJSON(data.permissions) for ind, value in pairs(JSONtable) do if (value and ind) then rankCache[data.groupName][data.name][ind] = true end end end end end dbQuery(loadGroupRanks, db, "SELECT * FROM groupRanks") function loadGroupStuff(query) local g_table = dbPoll(query, 0) if (not g_table) then return end for ind, data in ipairs(g_table) do groupTable[data.name] = {data.leader, data.message, data.chatcolor, data.notecolor, data.date, data.turfcolor} end end dbQuery(loadGroupStuff, db, "SELECT * FROM groups") function loadClientGroup(query) local g_table = dbPoll(query, 0) if (not g_table) then return end for ind, data in ipairs(g_table) do local player = getAccountPlayer(getAccount(data.account)) users[data.groupName] = {} table.insert(users[data.groupName], data.account) if (player) then setElementData(player, "Group", data.groupName) myGang[player] = data.groupName end GAC[data.account] = {data.groupName, data.rank, data.warningLvl, data.joined, data.lastTime or 0} end end dbQuery(loadClientGroup, db, "SELECT * FROM groupmember") function addRank(group, rank, permissionTable) if (not rankCache[group]) then rankCache[group] = {} end --rankCache[group][rank] = {fromJSON(permissionTable)} dbExec(db, "INSERT INTO groupRanks VALUES (?, ?, ?)", tostring(group), tostring(rank), permissionTable) dbQuery(loadGroupRanks, db, "SELECT * FROM groupRanks") end function removeRank(group, rank) if (not rankCache[group]) then return true end if (rankCache[group][rank]) then rankCache[group][rank] = nil dbExec(db, "DELETE FROM groupRanks WHERE name=? AND groupName=?", tostring(rank), tostring(group)) dbQuery(loadGroupRanks, db, "SELECT * FROM groupRanks") return true end end function isRank(group, rank) if (not rankCache[group]) then return false end return rankCache[group][rank] end function groupMemberLogin() if (GAC[account(source)]) then myGang[source] = GAC[account(source)][1] setElementData(source, "Group", GAC[account(source)][1]) end end addEventHandler("onPlayerLogin", root, groupMemberLogin) function getGroupMembers(group) local temp = {} for ind, data in pairs(users) do if (ind == group) then table.insert(temp, data[1]) end end return temp end function getPlayerGroup(player) if (not GAC[account(player)]) then return false end return GAC[account(player)][1] end function getPlayerGroupRank(player) if (not GAC[account(player)]) then return false end return GAC[account(player)][2] end function getPlayerWarningLevel(player) if (not GAC[account(player)]) then return false end return GAC[account(player)][3] end function getPlayerJoinDate(player) if (not GAC[account(player)]) then return false end return GAC[account(player)][4] end function getHexCode(r, g, b) if (r and g and b) then return string.format("#%.2X%.2X%.2X", r, g, b) end end function getGroupChatColor(group) if (not groupTable[group]) then return 255, 255, 255 end local color = fromJSON(groupTable[group][3]) return color[1], color[2], color[3] end function outputGroupMessage(message, group) for ind, data in pairs(GAC) do if (data[1] == group) then local acc = getAccount(ind) if (getAccountPlayer(acc)) then local color = fromJSON(groupTable[group][3]) local hex = getHexCode(color[1], color[2], color[3]) outputChatBox(hex.."("..group..") #FFFFFF"..message, getAccountPlayer(acc), 255, 255, 255, true) end end end end function checkGroupAccess(player, actionID) local rank = getPlayerGroupRank(player) local group = getPlayerGroup(player) if (not rankCache[group]) then return false end if (rankCache[group] and rankCache[group][rank]) then if (tostring(actionID)) then for ind, data in pairs(permToTable) do if (data == actionID) then actionID = ind break end end end local actionID = tonumber(actionID) if (rankCache[group][rank][actionID]) then return true end end end function getPermissionCount(group, rank) if (not rankCache[group]) then return false end local count = 0 if (rankCache[group] and rankCache[group][rank]) then for ind, data in pairs(rankCache[group][rank]) do count = count + 1 end end return count end function getGroupRankCount(group) if (not rankCache[group]) then return end local count = 0 for ind, v in pairs(rankCache[group]) do count = count + 1 end return
-
line 96
-
the debug just reports this.. how can i fix it? local turfPos = { { 2133.1950683594, 633.66455078125, 0, 197.5, 92, 90 }, { 2486.5935058594, 678.20172119141, 0, 245, 133, 30 }, { 1856.2864990234, 627.07629394531, 0, 138.25, 152.75, 90 }, { 1576.8956298828, 662.84362792969, 0, 181, 120.5, 90 }, { 1577.6783447266, 943.66607666016, 0, 190, 190, 90 }, { 1383.4364013672, 909.61499023438, 0, 142, 230, 90 }, { 956.94744873047, 1011.635925293, 0, 220, 140, 90 }, { 1017.7476196289, 1203.4068603516, 0, 180, 165, 90 }, { 1017.623046875, 1383.4741210938, 0, 190, 290, 90 }, { 917.99707031253, 1623.6003417969, 0, 80, 220, 90 }, { 1017.7178955078, 1862.6740722656, 0, 140, 180, 90 }, { 912.50573730469, 1958.6761474609, 0, 90, 230, 90 }, { 1017.3455200195, 2063.38671875, 0, 150, 300, 90 }, { 1300.7644042969, 2095.5100097656, 0, 200, 140, 90 }, { 1398.1997070313, 2323.5505371094, 0, 160, 65, 90 }, { 1578.1955566406, 2284.0825195313, 0, 180, 110, 90 }, { 1237.6285400391, 2581.4663085938, 0, 450, 130, 90 }, { 1780.478515625, 2567.2121582031, 0, 130, 130, 90 }, { 1698.2750244141, 2724.494140625, 0, 200, 150, 90 }, { 2237.9494628906, 2723.7814941406, 0, 180, 110, 90 }, { 2498.6853027344, 2704.6188964844, 0, 300, 140, 90 }, { 2798.1267089844, 2303.9643554688, 0, 120, 300, 90 }, { 2557.5688476563, 2243.4963378906, 0, 100, 230, 90 }, { 2532.5830078125, 2063.4118652344, 0, 100, 150, 90 }, { 2558.1779785156, 1624.0816650391, 0, 100, 300, 90 }, { 2437.685546875, 1483.7209472656, 0, 160, 120, 90 }, { 2077.7106933594, 1203.5559082031, 0, 340, 170, 90 }, { 2082.3193359375, 979.23583984375, 0, 270, 210, 90 } } local areaPos = { { 2130, 630, 200, 100 }, { 2488.8793945313, 680.78289794922, 250, 130 }, { 1858, 623, 140, 165 }, { 1577, 663, 180, 130 }, { 1577, 943, 185, 190 }, { 1383, 909, 120, 230 }, { 956, 1011, 220, 140 }, { 1017, 1203, 180, 165 }, { 1017, 1383, 190, 290 }, { 917, 1623, 80, 220 }, { 1017, 1862, 140, 180 }, { 912, 1958, 90, 240 }, { 1017, 2063, 150, 300 }, { 1300, 2092, 200, 140 }, { 1398, 2323, 160, 65 }, { 1578, 2284, 180, 110 }, { 1237, 2581, 450, 130 }, { 1780, 2567, 130, 130 }, { 1698, 2724, 200, 150 }, { 2237, 2723, 180, 110 }, { 2498, 2704, 300, 140 }, { 2798, 2303, 120, 300 }, { 2557, 2243, 100, 230 }, { 2532, 2063, 100, 150 }, { 2558, 1624, 100, 300 }, { 2437, 1483, 160, 120 }, { 2077, 1203, 340, 170}, { 2082, 979, 270, 210 } } local turfElement = {} local turfTimer = {} checkComplete = false language = "English" -- Pon "Spanish" para español -- Put "English" for english text addEventHandler("onResourceStart", resourceRoot, function() executeSQLQuery("CREATE TABLE IF NOT EXISTS Turf_System ( Turfs TEXT, GangOwner TEXT, r INT, g INT, b INT)") local check = executeSQLQuery("SELECT * FROM Turf_System" ) if #check == 0 then for i=1,#turfPos do executeSQLQuery("INSERT INTO Turf_System(Turfs,GangOwner,r,g,b) VALUES(?,?,?,?,?)", "Turf["..tostring(i).."]", "Nadie", 0, 255, 0) end end for i,v in ipairs(turfPos) do local sqlData = executeSQLQuery("SELECT * FROM Turf_System WHERE Turfs=?", "Turf["..tostring(i).."]") local turfCol = createColCuboid(unpack(v)) setElementData(turfCol, "getTurfGang", sqlData[1].GangOwner) local arg1,arg2,arg3,arg4 = unpack(areaPos[i]) local turfArea = createRadarArea(arg1, arg2, arg3, arg4, sqlData[1].r, sqlData[1].g, sqlData[1].b, 175) turfElement[turfCol] = {turfCol, turfArea, i} end if language == "Spanish" then outputDebugString("Sistema de turf by Sasuke* ha iniciado correctamente!") else outputDebugString("Turf System by Sasuke* was started correctly!") end end ) function radar ( player ) local turf,area,id = unpack(turfElement[player]) if turf and area and source == turf then local playerGang = getElementData ( player, "gang" ) local turfGang = executeSQLQuery("SELECT GangOwner FROM Turf_System WHERE Turfs=?", "Turf["..tostring(id).."]" ) if ( turfGang[1].GangOwner == playerGang ) then if language == "Spanish" then outputChatBox("Este territorio ya pertenece a "..turfGang[1].GangOwner or "Nadie", player, 0, 255, 0, false) else outputChatBox("This territory already belongs to "..turfGang[1].GangOwner or "None", player, 0, 255, 0, false) end else if not getPlayerTeam(player) then return end local team = getPlayerTeam ( player ) if ( getTeamName( team ) == "Criminal" ) then local playerGang = exports [ "groupsys" ]:getPlayerGroup ( player ) if ( isTimer ( turfTimer[source] ) ) then return end if ( playerGang ) then local r, g, b = unpack ( exports [ "groupsys" ]:getGroupChatColor ( playerGang ) ) setRadarAreaFlashing ( area, true ) if turfGang[1].GangOwner ~= "Nadie" then if language == "Spanish" then outputChatBox("Entraste En La Zona De Turf de "..turfGang[1].GangOwner..". Espera 2 Minutos Para Poder Conquistar El Turf Y Ganar 4k", player, 0, 255, 0, false) else outputChatBox("You enter into de "..turfGang[1].GangOwner.."'s turf zone. Wait 2 minutes to capture the turf and win 4k", player, 0, 255, 0, false) end else if language == "Spanish" then outputChatBox("Este Turf Aun No Pertenese A Nadie. Espera 2 Minutos Para Poder Conquistar El Turf Y Ganar 4k", player, 0, 255, 0, false) else outputChatBox("This turf do not belong to anyone. Wait 2 minutes to capture the turf and win 4k", player, 0, 255, 0, false) end end turfTimer[source] = setTimer ( function ( ) local beachTurfCplayers = getElementColShape ( turf ) local players = getElementsWithinColShape ( turf, "player" ) setRadarAreaColor ( area, tonumber(r), tonumber(g), tonumber(b), 175 ) for _, player in ipairs ( players ) do if getElementData(player, "gang") == playerGang then if language == "Spanish" then outputChatBox("Felicidades Conquistaste El Turf +4K!", player, 0, 255, 0, false) else outputChatBox("Congratulations. You capture the turf. +4K!", player, 0, 255, 0, false) end triggerClientEvent("onTakeTurf", player) givePlayerMoney ( player, 4000 ) executeSQLQuery("UPDATE Turf_System SET GangOwner=?,r=?,g=?,b=? WHERE Turfs=?", playerGang, tonumber(r), tonumber(g), tonumber(b), "Turf["..tostring(id).."]" ) -- setElementData ( turf, "getTurfGang", playerGang ) end end setRadarAreaFlashing ( area, false ) end ,120000, 1) -- 120000 end end end end end addEventHandler ( "onColShapeHit", root, radar )
-
I have no clue, haven't played MTA in ages. r,g b = getGroupChatColor(groupString) Thanks for the positive feedback! is the argument the group name?
-
whaat is the exported function to get the turf color? i mean the function that returns with r,g,b?
-
is there any turf system which works with this groups sysstem?
-
is there any turf system which works with this group system? https://community.multitheftauto.com/in ... ls&id=8291
-
it's trigged at line 55 client... and it looks coorrect
-
error line 18 compare number nil with a number
-
i can't buy new cars! the debug reports error line 21 server, attempt to arithmetic fieald on "id" a string value... why? server function make_db () executeSQLQuery ("CREATE TABLE IF NOT EXISTS dealercars (id NUMERIC, owner TEXT, model NUMERIC, name TEXT, health NUMBERIC, paintjob NUMERIC, color NUMERIC, upgrades NUMERIC)") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), make_db) local dealerMarker1 = createMarker(2131.75, -1148.138671875, 23.406946182251, "cylinder", 2, 0, 255, 0, 255) createBlipAttachedTo(dealerMarker1, 55, 2, 0, 0, 0, 0, 0, 300) function open_dealer_server (hitElement) if source == dealerMarker1 then triggerClientEvent(hitElement, "open_dealer_wdw", root) triggerClientEvent(hitElement, "list_dealer_cars", root) end end addEventHandler("onMarkerHit", getRootElement(), open_dealer_server) function buy_car_from_dealer (owner,model,name,money) if getPlayerMoney(owner) >= tonumber(money) then local ID = executeSQLQuery("SELECT * FROM dealercars") for i,v in ipairs(ID) do carid = v.id+1 end local account = getAccountName(getPlayerAccount(owner)) local modela = getVehicleModelFromName(model) local carbought = executeSQLQuery("INSERT INTO dealercars(id,owner,model,name,health,paintjob,color,upgrades) VALUES(?,?,?,?,?,?,?,?)", carid, tostring(account), tonumber(modela), tostring(model), 1000, 0, 0, 0) takePlayerMoney(owner, money) setElementData(owner, "gotCar", "no") outputChatBox("Congratulations you've bought a "..model.." for "..money, owner, 0, 255, 0) else outputChatBox("You don't have enough money", owner, 255, 0, 0) end end addEvent("buy_dealer_car", true) addEventHandler("buy_dealer_car", getRootElement(), buy_car_from_dealer) ---------------------------------------------- --------------- Spawner Panel ---------------- ---------------------------------------------- function keybindpla () for i,v in ipairs(getElementsByType("player")) do bindKey(v, "f2", "down", open_spawner_pla) setElementData(v, "gotCar", "no") end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), keybindpla) addEventHandler("onPlayerLogin", getRootElement(), keybindpla) function open_spawner_pla (source) triggerClientEvent(source, "open_spawner_wdw", root) end function list_owned_cars_server (player) local playerAcc = getAccountName(getPlayerAccount(player)) local carlmao = executeSQLQuery("SELECT * FROM dealercars WHERE owner=?", playerAcc) for i,k in ipairs(carlmao) do triggerClientEvent(player, "list_owned_cars", root, k.name, k.health) end end addEvent("list_owned_cars_S", true) addEventHandler("list_owned_cars_S", getRootElement(), list_owned_cars_server) function spawn_car_pleaseD (ownerName,carName) if getElementData(ownerName, "gotCar") == "no" then local gayowner = getAccountName(getPlayerAccount(ownerName)) local carModel = getVehicleModelFromName(carName) local x,y,z = getElementPosition(ownerName) OwnerVehicle = createVehicle(carModel, x, y, z) setTimer(warpPedIntoVehicle, 50, 1, ownerName, OwnerVehicle) setElementData(OwnerVehicle, "owner", tostring(gayowner)) setElementData(ownerName, "gotCar", "yes") local carlma = executeSQLQuery("SELECT * FROM dealercars WHERE owner=?", gayowner) else outputChatBox("You don't own a car", ownerName, 255, 0, 0) end end addEvent("spawn_dealer_car", true) addEventHandler("spawn_dealer_car", getRootElement(), spawn_car_pleaseD) function destroy_car_pleaseD (ownerName) pedCar = getPedOccupiedVehicle(ownerName) gayownerAcc = getAccountName(getPlayerAccount(ownerName)) if isPedInVehicle(ownerName) == true then if getElementData(ownerName, "gotCar") == "yes" and getElementData(pedCar, "owner") == gayownerAcc then CurrentCar = getPedOccupiedVehicle(ownerName) destroyElement(CurrentCar) setElementData(ownerName, "gotCar", "no") else outputChatBox("You can't park a car you don't own", ownerName, 255, 0, 0) end else outputChatBox("You aren't in a vehicle", ownerName, 255, 0, 0) end end addEvent("destroy_dealer_car", true) addEventHandler("destroy_dealer_car", getRootElement(), destroy_car_pleaseD) client dealerwdw = guiCreateWindow(0.19, 0.19, 0.57, 0.70, "", true) guiWindowSetSizable(dealerwdw, false) dealerwdwgrid = guiCreateGridList(0.02, 0.05, 0.97, 0.83, true, dealerwdw) guiGridListAddColumn(dealerwdwgrid, "Car", 0.5) guiGridListAddColumn(dealerwdwgrid, "Price", 0.5) dealerwdwclosebtn = guiCreateButton(0.01, 0.88, 0.34, 0.09, "Close", true, dealerwdw) guiSetProperty(dealerwdwclosebtn, "NormalTextColour", "FFAAAAAA") dealerwdwbuybtn = guiCreateButton(0.65, 0.88, 0.34, 0.09, "Buy", true, dealerwdw) guiSetProperty(dealerwdwbuybtn, "NormalTextColour", "FFAAAAAA") guiSetVisible(dealerwdw, false) function open_dealer_panel () if guiGetVisible(dealerwdw) == false then guiSetVisible(dealerwdw, true) showCursor(true) end end addEvent("open_dealer_wdw", true) addEventHandler("open_dealer_wdw", getRootElement(), open_dealer_panel) DealerVehicles = { {"Admiral", 50000}, {"Comet", 1000000}, {"Infernus", 3000000}, {"Bullet", 1500000}, {"Sultan", 1000000}, {"Huntley", 750000}, {"Sabre", 1000000}, } function list_cars () guiGridListClear(dealerwdwgrid) for i,v in ipairs(DealerVehicles) do local row = guiGridListAddRow(dealerwdwgrid) guiGridListSetItemText(dealerwdwgrid, row, 1, v[1], false, false) guiGridListSetItemText(dealerwdwgrid, row, 2, v[2], false, false) end end addEvent("list_dealer_cars", true) addEventHandler("list_dealer_cars", getRootElement(), list_cars) function dealer_panel_clicked () if source == dealerwdwclosebtn and guiGetVisible(dealerwdw) == true then guiSetVisible(dealerwdw, false) showCursor(false) guiGridListClear(dealerwdwgrid) end end addEventHandler("onClientGUIClick", dealerwdw, dealer_panel_clicked) function dealer_panel_buy (player) if source == dealerwdwbuybtn then local row = guiGridListGetSelectedItem(dealerwdwgrid) triggerServerEvent("buy_dealer_car", getLocalPlayer(), getLocalPlayer(), guiGridListGetItemText(dealerwdwgrid, row, 1), guiGridListGetItemText(dealerwdwgrid, row, 1), guiGridListGetItemText(dealerwdwgrid, row, 2)) end end addEventHandler("onClientGUIClick", dealerwdw, dealer_panel_buy) ---------------------------------------------- --------------- Spawner Panel ---------------- ---------------------------------------------- spawncarwdw = guiCreateWindow(0.19, 0.19, 0.57, 0.70, "", true) guiWindowSetSizable(spawncarwdw, false) spawncarwdwgrid = guiCreateGridList(0.02, 0.05, 0.97, 0.83, true, spawncarwdw) guiGridListAddColumn(spawncarwdwgrid, "Car", 0.5) guiGridListAddColumn(spawncarwdwgrid, "Health", 0.5) spawncarwdwclosebtn = guiCreateButton(0.01, 0.89, 0.19, 0.09, "Close", true, spawncarwdw) spawncarwdrefwdw = guiCreateButton(0.23, 0.89, 0.24, 0.09, "Refresh List", true, spawncarwdw) spawncarwdwspwnwdw = guiCreateButton(0.52, 0.89, 0.24, 0.09, "Spawn Car", true, spawncarwdw) spawncarwdwparkbtn = guiCreateButton(0.78, 0.89, 0.21, 0.09, "Park Car", true, spawncarwdw) guiSetVisible(spawncarwdw, false) function open_spawner_panel () if guiGetVisible(spawncarwdw) == false then guiSetVisible(spawncarwdw, true) showCursor(true) guiGridListClear(spawncarwdwgrid) triggerServerEvent("list_owned_cars_S", getLocalPlayer(), getLocalPlayer()) elseif guiGetVisible(spawncarwdw) == true then guiSetVisible(spawncarwdw, false) showCursor(false) end end addEvent("open_spawner_wdw", true) addEventHandler("open_spawner_wdw", getRootElement(), open_spawner_panel) function vehicle_spawner_panel () if source == spawncarwdwclosebtn and guiGetVisible(spawncarwdw) == true then guiSetVisible(spawncarwdw, false) showCursor(false) guiGridListClear(spawncarwdwgrid) end if source == spawncarwdrefwdw then guiGridListClear(spawncarwdwgrid) triggerServerEvent("list_owned_cars_S", getLocalPlayer(), getLocalPlayer()) end if source == spawncarwdwspwnwdw then local row = guiGridListGetSelectedItem(spawncarwdwgrid) triggerServerEvent("spawn_dealer_car", getLocalPlayer(), getLocalPlayer(), guiGridListGetItemText(spawncarwdwgrid, row, 1)) end if source == spawncarwdwparkbtn then triggerServerEvent("destroy_dealer_car", getLocalPlayer(), getLocalPlayer()) end end addEventHandler("onClientGUIClick", spawncarwdw, vehicle_spawner_panel) function list_cars_you_own (vehiclemodel,vehicleHealth) local row = guiGridListAddRow(spawncarwdwgrid) guiGridListSetItemText(spawncarwdwgrid, row, 1, tostring(vehiclemodel), false, false) guiGridListSetItemText(spawncarwdwgrid, row, 2, tonumber(vehicleHealth), false, false) end addEvent("list_owned_cars", true) addEventHandler("list_owned_cars", getRootElement(), list_cars_you_own)
-
what do you mean?
-
why hte screen remains black ? client wdwLogin_Pannel = {} tabPannel_Main = {} tab_Login = {} tab_Register = {} GuestEnable = false--Can a Player play as Guest, or no. [true/false] function open_log_reg_pannel() if not(isElement(wdwLogin_Pannel)) then local sWidth,sHeight = guiGetScreenSize() -- The variables local Width,Height = 473,284 --Ширина, Высота окна local X = (sWidth/2) - (Width/2) --Получение центра по X (По ширине экрана) local Y = (sHeight/2) - (Height/2) --Получение центра по Y (Высоте экрана) wdwLogin_Pannel = guiCreateWindow(X,Y,Width,Height,"Login Pannel",false) guiWindowSetSizable(wdwLogin_Pannel,false) tabPannel_Main = guiCreateTabPanel(9,23,455,251,false,wdwLogin_Pannel) tab_Login = guiCreateTab("Login",tabPannel_Main) lbl_Login = guiCreateLabel(103,72,42,19,"Login:",false,tab_Login) guiLabelSetVerticalAlign(lbl_Login,"center") guiLabelSetHorizontalAlign(lbl_Login,"right",false) guiSetFont(lbl_Login,"default-bold-small") edit_Login = guiCreateEdit(156,72,169,23,"",false,tab_Login) --Поле ввода логина edit_password = guiCreateEdit(156,106,169,23,"",false,tab_Login) --Поле ввода пароля guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) lbl_Password = guiCreateLabel(48,106,96,19,"Password:",false,tab_Login) guiLabelSetVerticalAlign(lbl_Password,"center") guiLabelSetHorizontalAlign(lbl_Password,"right",false) guiSetFont(lbl_Password,"default-bold-small") lbl_top_info = guiCreateLabel(109,6,244,35,"Please write your username and password.",false,tab_Login) guiLabelSetColor(lbl_top_info,68,255,134) guiLabelSetVerticalAlign(lbl_top_info,"center") guiLabelSetHorizontalAlign(lbl_top_info,"center",false) lbl_about_legth = guiCreateLabel(142,42,184,18,"Max Length: 25 symbols",false,tab_Login) guiLabelSetColor(lbl_about_legth,253,255,68) guiLabelSetVerticalAlign(lbl_about_legth,"center") guiLabelSetHorizontalAlign(lbl_about_legth,"center",false) checkbox_save = guiCreateCheckBox(329,110,100,20,"(Save)",false,false,tab_Login) guiSetFont(checkbox_save,"default-small") btn_Login = guiCreateButton(164,162,147,41,"Login",false,tab_Login) guiSetFont(btn_Login,"default-bold-small") login_tab_error_msg = guiCreateLabel(31,131,419,25,"Error_login_tab",false,tab_Login) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") --Guest func if GuestEnable == true then btnGuest = guiCreateButton(29,168,94,32,"Play as Guest",false,tab_Login) guiSetFont(btnGuest,"default-small") guiSetVisible(btnGuest,true) else if isElement(btnGuest) then guiSetVisible(btnGuest,false) end btnGuest = nil end tab_Register = guiCreateTab("Register",tabPannel_Main) lbl_account_name = guiCreateLabel(43,39,119,21,"Account Name:",false,tab_Register) guiLabelSetVerticalAlign(lbl_account_name,"center") guiLabelSetHorizontalAlign(lbl_account_name,"right",false) guiSetFont(lbl_account_name,"default-bold-small") lbl_reg_top_info = guiCreateLabel(66,5,364,31,"Please, fill in all fields! (Don't use \"!@#$\"%'^&*()\")",false,tab_Register) guiLabelSetColor(lbl_reg_top_info,255,234,55) guiLabelSetVerticalAlign(lbl_reg_top_info,"center") guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) edit_account_name = guiCreateEdit(172,40,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit_account_name,25) lbl__reg_tab_password = guiCreateLabel(43,71,119,21,"Password:",false,tab_Register) guiLabelSetVerticalAlign(lbl__reg_tab_password,"center") guiLabelSetHorizontalAlign(lbl__reg_tab_password,"right",false) guiSetFont(lbl__reg_tab_password,"default-bold-small") edit__reg_tab_password = guiCreateEdit(172,71,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit__reg_tab_password,25) edit__reg_tab_Repassword = guiCreateEdit(172,102,176,23,"",false,tab_Register) guiEditSetMaxLength ( edit__reg_tab_Repassword,25) lvl_reg_tab_Repassword = guiCreateLabel(43,102,119,21,"Repeat password:",false,tab_Register) guiLabelSetVerticalAlign(lvl_reg_tab_Repassword,"center") guiLabelSetHorizontalAlign(lvl_reg_tab_Repassword,"right",false) guiSetFont(lvl_reg_tab_Repassword,"default-bold-small") btn_reg_tab_register = guiCreateButton(153,161,174,42,"Confirm & register!",false,tab_Register) guiSetFont(btn_reg_tab_register,"default-bold-small") reg_tab_error_msg = guiCreateLabel(66,129,364,31,"Error_reg_ttab",false,tab_Register) guiLabelSetColor(reg_tab_error_msg,255,20,0) guiLabelSetVerticalAlign(reg_tab_error_msg,"center") guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false) guiSetFont(reg_tab_error_msg,"default-bold-small") guiSetVisible(wdwLogin_Pannel,true) setCameraMatrix(1468, -919, 100) --guiSetInputEnabled(true) showCursor(true) --Изменение надписей: guiSetText(reg_tab_error_msg, "") --Поле ошибки в Reg табе guiSetText(login_tab_error_msg, "") --Поле ошибки в Login табе local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) end --Эвенты addEventHandler("onClientGUIClick",btn_Login,onClickBtnLogin) addEventHandler("onClientGUIClick",btn_reg_tab_register,onClickBtnRegister) if GuestEnable == true then addEventHandler("onClientGUIClick",btnGuest,onClickGuest) end --else --destroyElement(wdwLogin_Pannel) --guiSetInputEnabled(false) --wdwLogin_Pannel = nil --showCursor(false) end end function start_cl_resource() --При старте open_log_reg_pannel() end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource) function loadLoginFromXML() --Загрузка логина и пароля из XML local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) --Сохрание логина и пароля в XML local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() --Сохрание логина и пароля в XML local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function onClickBtnLogin(button,state) --При нажатии на кнопку Login if(button == "left" and state == "up") then if (source == btn_Login) then username = guiGetText(edit_Login) password = guiGetText(edit_password) if guiCheckBoxGetSelected ( checkbox_save ) == true then checksave = true else checksave = false end triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end
-
there are no errsors reported in the debugscript but the panesl doesnt dispay my saved password why? client --//Register / Login panel function createLoginPanel() fadeCamera(true, 6, 0, 0, 0) setCameraMatrix(-1475.5, 831.18, 65.5, -1487.5, 800.18, 65.5) showPlayerHudComponent("radar", false) showPlayerHudComponent("area_name", false) local player = string.gsub(getPlayerName(getLocalPlayer()),"#%x%x%x%x%x%x", "") function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end window = guiMyCwindow(417,270,"Login Panel") gang_lbl = guiCreateLabel(16,31,385,19,"'Welcome to the CAOS '",false,window) guiLabelSetHorizontalAlign(gang_lbl,"center",false) guiSetFont(gang_lbl,"default-bold-small") tabs = guiCreateTabPanel(16,54,388,186,false,window) login_tab = guiCreateTab("Login",tabs) lblLogin = guiCreateLabel(10,11,99,24,"Login:",false,login_tab) lblReg = guiCreateLabel(8,38,78,23,"Password:",false,login_tab) remember = guiCreateCheckBox(6,58,109,23,"Remember me?",false,false,login_tab) guiCheckBoxSetSelected(remember,true) login_edit = guiCreateEdit(96,7,212,23,"",false,login_tab) --guiEditSetReadOnly(login_edit,true) pass_edit = guiCreateEdit(95,36,214,23,"",false,login_tab) guiEditSetMasked(pass_edit,true) welcome1 = guiCreateLabel(29,90,336,55,"CAOS RP",false,login_tab) guiLabelSetHorizontalAlign(welcome1,"center",false) guiSetFont(welcome1,"sa-header") login_Btn = guiCreateButton(310,8,75,51,"Login",false,login_tab) reg_tab = guiCreateTab("Register",tabs) reg_lbl = guiCreateLabel(15,15,47,18,"Login:",false,reg_tab) reg_edit = guiCreateEdit(115,10,216,25,player,false,reg_tab) --guiEditSetReadOnly(reg_edit,true) reglbl_pass = guiCreateLabel(14,48,59,17,"Password:",false,reg_tab) reg_pass_edit = guiCreateEdit(115,44,216,25,"",false,reg_tab) cfpass = guiCreateLabel(11,82,101,17,"Confirm Password:",false,reg_tab) guiEditSetMasked(reg_pass_edit,true) confreg_pass = guiCreateEdit(115,77,216,25,"",false,reg_tab) guiEditSetMasked(confreg_pass,true) sexlbl = guiCreateLabel(15,111,68,37,"Sex:",false,reg_tab) guiSetFont(sexlbl,"sa-header") female_radio = guiCreateRadioButton(182,115,16,19,"",false,reg_tab) male_radio = guiCreateRadioButton(115,114,16,19,"",false,reg_tab) guiRadioButtonSetSelected(male_radio,true) male_lbl = guiCreateLabel(114,135,33,14,"Male",false,reg_tab) female_lbl = guiCreateLabel(175,136,39,14,"Female",false,reg_tab) register_btn = guiCreateButton(243,122,137,31,"Register",false,reg_tab) --infotwix = guiCreateLabel(18,245,130,19,"Login Panel by TwiX",false,window) --guiLabelSetColor(infotwix,0,255,0) guiWindowSetSizable(window, false)--//Block editing size of the window. guiWindowSetMovable(window, false)--//Block move window. end function LoginPanel() createLoginPanel() triggerServerEvent("getSavePassword", guiGetText(login_edit), guiGetText(pass_edit) ) addEventHandler("onClientGUIClick", login_Btn, clientSubmitLogin) addEventHandler("onClientGUIClick", register_btn, clientSubmitRegister) addEventHandler("onClientPlayerChangeNick", getLocalPlayer(), destroyDataPasswordAndAddlogin) showCursor(true) guiSetInputEnabled(true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), LoginPanel) --//Register Players function clientSubmitRegister() if source == register_btn then local Login = guiGetText(reg_edit) local Password = guiGetText(reg_pass_edit) local ConfirmPassword = guiGetText(confreg_pass) --//Check the floor player. if guiRadioButtonGetSelected(male_radio) then sex = "Male" else sex = "Female" end if (Login == "") then outputChatBox("#CC0033[sERVER]: #339933Write your Login!", 0, 0, 0, true) return 0 end if (Password == "") then outputChatBox("#CC0033[sERVER]: #339933Write your Password!", 0, 0, 0, true) return 0 end if (Password ~= ConfirmPassword) then outputChatBox("#CC0033[sERVER]: #339933Passwords don't match!", 0, 0, 0,true) return 0 end triggerServerEvent("submitRegister", getLocalPlayer(), Login, Password, sex) end end --//Enter in account function clientSubmitLogin() if source == login_Btn then local Login = guiGetText(login_edit) local Password = guiGetText(pass_edit) local CheckBoxStat = guiCheckBoxGetSelected(remember) if (Login == "") then outputChatBox("#CC0033[sERVER]: #339933Write your Login!", 0, 0, 0, true) return 0 end if (Password == "") then outputChatBox("#CC0033[sERVER]: #339933Write your Password!", 0, 0, 0, true) return 0 end triggerServerEvent("submitLogin", getLocalPlayer(), Login, Password, CheckBoxStat) end end --//Close Windows addEvent("login_sucsess", true) addEventHandler("login_sucsess", getRootElement(), function (forPlayer) if forPlayer == getLocalPlayer() then showCursor(false) guiSetInputEnabled(false) guiSetVisible(window, false) showPlayerHudComponent("radar", true) showPlayerHudComponent("area_name", true) end end ) --//Add password and check box true. function addPassword(Password, Login) guiCheckBoxSetSelected(remember, true) guiSetText(login_edit, Login) guiSetText(pass_edit, Password) end addEvent("addPassword", true) addEventHandler("addPassword", getRootElement(), addPassword) --//Remove password when player changed nick function destroyDataPasswordAndAddlogin(oldNick, newNick) guiSetText(login_edit, string.gsub(newNick,"#%x%x%x%x%x%x", "")) guiSetText(reg_edit, string.gsub(newNick,"#%x%x%x%x%x%x", "")) if (guiGetText(pass_edit) ~= "") then guiSetText(pass_edit, "") end if (guiCheckBoxGetSelected(remember) == true) then guiCheckBoxSetSelected(remember, false) end end server --//Register the account function RegisterPlayer(login, password, sex) if not getAccount(login) then addAccount(login, password) else outputChatBox("#CC0033[sERVER]: #339933This nickname is already registered, choose a other nickname", source, 0, 0, 0, true) return 0 end local playerAccount = getAccount(login, password) setAccountData(playerAccount, "money", math.random(5000,10000)) setAccountData(playerAccount, "sex", sex) setAccountData(playerAccount, "password", password) setAccountData(playerAccount, "Kills", 0) setAccountData(playerAccount, "Deads", 0) setAccountData(playerAccount, "canSelectTeam", 1) logIn(source, playerAccount, password) outputChatBox("#CC0033[sERVER]: #339933You have successfully registered and logged in automatically, do not forget your password ", source, 0, 0, 0, true) outputChatBox("#339933[sERVER] #ffffffYour login #CC0033"..login.." #ffffffand password #CC0033"..password.."#ffffff! Good game !", source, 0, 0, 0, true) --//Remove the ability to change nickname after joined on the [sERVER]. addEventHandler("onPlayerChangeNick", source, cancelChangeNick) triggerClientEvent("login_sucsess", root, source) triggerClientEvent("step1gangs", source) end addEvent("submitRegister", true) addEventHandler("submitRegister", root, RegisterPlayer) --//Check password saved or no function getSavePassword( login, password ) local playerAccount = getAccount( login, password ) if playerAccount then local savePass = getAccountData(playerAccount, "savePassword") if savePass then local password = getAccountData(playerAccount, "password") triggerClientEvent("addPassword", root, password, login) end else outputChatBox ( "I got no account" ) end end addEvent("getSavePassword", true) addEventHandler("getSavePassword", root, getSavePassword) --//Enter in Account function loginPlayer(login, password, checkBoxStat) local account = getAccount (login, password) if account then logIn (source, getAccount(login, password), password) playerAccount = getAccount(login, password) setAccountData(playerAccount, "savePassword", checkBoxStat) --//Remove the ability to change nickname after joined on the [sERVER]. addEventHandler("onPlayerChangeNick", source, cancelChangeNick) triggerClientEvent("login_sucsess", source, source) -- triggerEvent("getSavePassword", playerAccount) getSavePassword ( login, password ) if not (getAccountData (playerAccount, "canSelectTeam") == 1) then triggerClientEvent("step1gangs", source) else local team = getAccountData (playerAccount, "onSavedTeam") local skin = getAccountData(playerAccount, "onSavedSkin") local weapon1 = getAccountData(playerAccount, "onSavedWeapon1") local weapon2 = getAccountData(playerAccount, "onSavedWeapon2") local weapon3 = getAccountData(playerAccount, "onSavedWeapon3") callClientFunction(source, "checkSpawns", team, skin, weapon1, weapon2, weapon3) end else outputChatBox ("#CC0033[sERVER]: #ffffffWrong #CC0033username #ffffffand/or #CC0033password!", source, 255, 255, 255, true) end end addEvent("submitLogin", true) addEventHandler("submitLogin", root, loginPlayer) function cancelChangeNick(oldNick, newNick) cancelEvent() end --//Logged players after stop gamemode function logOutPlayer(theResourceStopped) if getResourceName(theResourceStopped) == "GangWar" then for k, players in ipairs(getElementsByType("player")) do kickPlayer(players, "Restarting Gamemode") end end end addEventHandler("onResourceStop", root, logOutPlayer)
-
login is a string, not an account... how can i get the account element from the name
-
when i login my camera matrix doesnt stop and it doesnt say successfully logged in
-
Yeah maybe this at line 38: triggerEvent("getSavePassword", source, playerAccount) and --//Check password saved or no function getSavePassword( playerAccount ) if ( playerAccount ) then local getSavePassword = getAccountData(playerAccount, "savePassword") local Password = getAccountData(playerAccount, "password") if (getSavePassword == true) then triggerClientEvent("addPassword", getRootElement(), Password, Login) end else outputChatBox ( "I got no account" ) end end addEvent("getSavePassword", true) addEventHandler("getSavePassword", getRootElement(), getSavePassword) Also, you did a typo here: kickPlayer(players, "Restart Gamemoge") Gamemode* now it reports bad argument line 49 expected account got string
-
any idea? (
-
line 38
-
the function was not called, i corrected it but it's still not working... it's say expected element at argument 2 line 49 triggerEvent --//Register the account function RegisterPlayer(Login, Password, sex) if (not getAccount(Login)) then addAccount(Login, Password) else outputChatBox("#CC0033[sERVER]: #339933This nickname is already registered, choose a other nickname", source, 0, 0, 0,true) return 0 end local playerAccount = getAccount(Login, Password) setAccountData(playerAccount, "money", math.random(5000,10000)) setAccountData(playerAccount, "sex", sex) setAccountData(playerAccount, "password", Password) setAccountData(playerAccount, "Kills", 0) setAccountData(playerAccount, "Deads", 0) setAccountData(playerAccount, "canSelectTeam", 1) logIn(source, playerAccount, Password) outputChatBox("#CC0033[sERVER]: #339933You have successfully registered and logged in automatically, do not forget your password ", source, 0, 0, 0,true) outputChatBox("#339933[sERVER] #ffffffYour login #CC0033"..Login.." #ffffffand password #CC0033"..Password.."#ffffff! Good game \"{SMILIES_PATH}/icon_wink.gif\" alt=\"\" title=\"Wink\" />!", source, 0, 0, 0,true) --//Remove the ability to change nickname after joined on the [sERVER]. addEventHandler("onPlayerChangeNick", source, cancelChangeNick) triggerClientEvent("login_sucsess", getRootElement(), source) triggerClientEvent("step1gangs", source) end addEvent("submitRegister", true) addEventHandler("submitRegister", getRootElement(), RegisterPlayer) --//Enter in Account function LoginPlayer(Login, Password, CheckBoxStat) local account = getAccount (Login,Password) if ( account ~= false ) then logIn (source, account, Password) playerAccount = getAccount(Login, Password) setAccountData(playerAccount, "savePassword", CheckBoxStat) --//Remove the ability to change nickname after joined on the [sERVER]. addEventHandler("onPlayerChangeNick", source, cancelChangeNick) triggerClientEvent("login_sucsess", getRootElement(), source) triggerEvent("getSavePassword", playerAccount) if not getAccountData (playerAccount, "canSelectTeam") == 1 then triggerClientEvent("step1gangs", source) else local team = getAccountData (playerAccount, "onSavedTeam") local skin = getAccountData(playerAccount, "onSavedSkin") local weapon1 = getAccountData(playerAccount, "onSavedWeapon1") local weapon2 = getAccountData(playerAccount, "onSavedWeapon2") local weapon3 = getAccountData(playerAccount, "onSavedWeapon3") callClientFunction(source,"checkSpawns",team, skin, weapon1, weapon2, weapon3) end else outputChatBox ("#CC0033[sERVER]: #ffffffWrong #CC0033username #ffffffand/or #CC0033password!",source,255,255,255,true) end end addEvent("submitLogin", true) addEventHandler("submitLogin", getRootElement(), LoginPlayer) --//Check password saved or no function getSavePassword(Login) local playerAccount = getAccount(Login) if ( playerAccount ) then local getSavePassword = getAccountData(playerAccount, "savePassword") local Password = getAccountData(playerAccount, "password") if (getSavePassword == true) then triggerClientEvent("addPassword", getRootElement(), Password, Login) end else outputChatBox ( "I got no account" ) end end addEvent("getSavePassword", true) addEventHandler("getSavePassword", getRootElement(), getSavePassword) function cancelChangeNick(oldNick, newNick) cancelEvent() end --//Logged players after stop gamemode function logOutPlayer(theResourceStopped) if getResourceName(theResourceStopped) == "GangWar" then for k, players in ipairs(getElementsByType("player")) do kickPlayer(players, "Restart Gamemoge") end end end addEventHandler("onResourceStop", getRootElement(), logOutPlayer) ------------------------------------------ -- Call ------------------------------------------ function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onClientCallsServerFunction", true) addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction) function callClientFunction(client, funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end -- If the clientside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) end
-
the debugscript reports bad agrument at line 59, it says expected account at argument 1 got nil... how can i fix it? --//Register the account function RegisterPlayer(Login, Password, sex) if (not getAccount(Login)) then addAccount(Login, Password) else outputChatBox("#CC0033[sERVER]: #339933This nickname is already registered, choose a other nickname", source, 0, 0, 0,true) return 0 end local playerAccount = getAccount(Login, Password) setAccountData(playerAccount, "money", math.random(5000,10000)) setAccountData(playerAccount, "sex", sex) setAccountData(playerAccount, "password", Password) setAccountData(playerAccount, "Kills", 0) setAccountData(playerAccount, "Deads", 0) setAccountData(playerAccount, "canSelectTeam", 1) logIn(source, playerAccount, Password) outputChatBox("#CC0033[sERVER]: #339933You have successfully registered and logged in automatically, do not forget your password ", source, 0, 0, 0,true) outputChatBox("#339933[sERVER] #ffffffYour login #CC0033"..Login.." #ffffffand password #CC0033"..Password.."#ffffff! Good game \"{SMILIES_PATH}/icon_wink.gif\" alt=\"\" title=\"Wink\" />!", source, 0, 0, 0,true) --//Remove the ability to change nickname after joined on the [sERVER]. addEventHandler("onPlayerChangeNick", source, cancelChangeNick) triggerClientEvent("login_sucsess", getRootElement(), source) triggerClientEvent("step1gangs", source) end addEvent("submitRegister", true) addEventHandler("submitRegister", getRootElement(), RegisterPlayer) --//Enter in Account function LoginPlayer(Login, Password, CheckBoxStat) local account = getAccount (Login,Password) if ( account ~= false ) then logIn (source, account, Password) local playerAccount = getAccount(Login, Password) setAccountData(playerAccount, "savePassword", CheckBoxStat) --//Remove the ability to change nickname after joined on the [sERVER]. addEventHandler("onPlayerChangeNick", source, cancelChangeNick) triggerClientEvent("login_sucsess", getRootElement(), source) if not getAccountData (playerAccount, "canSelectTeam") == 1 then triggerClientEvent("step1gangs", source) else local team = getAccountData (playerAccount, "onSavedTeam") local skin = getAccountData(playerAccount, "onSavedSkin") local weapon1 = getAccountData(playerAccount, "onSavedWeapon1") local weapon2 = getAccountData(playerAccount, "onSavedWeapon2") local weapon3 = getAccountData(playerAccount, "onSavedWeapon3") callClientFunction(source,"checkSpawns",team, skin, weapon1, weapon2, weapon3) end else outputChatBox ("#CC0033[sERVER]: #ffffffWrong #CC0033username #ffffffand/or #CC0033password!",source,255,255,255,true) end end addEvent("submitLogin", true) addEventHandler("submitLogin", getRootElement(), LoginPlayer) --//Check password saved or no function getSavePassword(Login) local playerAccount = getAccount(Login) local getSavePassword = getAccountData(playerAccount, "savePassword") local Password = getAccountData(playerAccount, "password") if (getSavePassword == true) then triggerClientEvent("addPassword", getRootElement(), Password, Login) end end addEvent("getSavePassword", true) addEventHandler("getSavePassword", getRootElement(), getSavePassword) function cancelChangeNick(oldNick, newNick) cancelEvent() end --//Logged players after stop gamemode function logOutPlayer(theResourceStopped) if getResourceName(theResourceStopped) == "GangWar" then for k, players in ipairs(getElementsByType("player")) do kickPlayer(players, "Restart Gamemoge") end end end addEventHandler("onResourceStop", getRootElement(), logOutPlayer) ------------------------------------------ -- Call ------------------------------------------ function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onClientCallsServerFunction", true) addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction) function callClientFunction(client, funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end -- If the clientside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) end
-
any help?
-
doesn't work i copied all the .db files of the backup into the folder server/mods/deathmatch/databases/global, other, system but my houses are still missing ( other ideas?
-
hi, i created some houses with this house_ system ( https://community.multitheftauto.com/in ... ils&id=727 ).... now i moved host and i would like to keep the houses.. which file i need to copy?
