Jump to content

hazard

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by hazard

  1. Yes..it works but i want to add a function that lets me block main chat for only one player, not all players
  2. Hey, i have this script that mutes all players in main chat (T) but not in (Y) Does anyone know how i can make it so i can mute only one player? instead of all. Like /chatoff instead of muting all players in server. local chat = true function chatDis(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then outputChatBox("#ff0000Main chat has been disabled by "..getPlayerName(thePlayer)..".",root,255, 255, 255, true) chat = false end end addCommandHandler("chatoff", chatDis) function chatEn(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then outputChatBox("#ff0000Main chat has been enabled by "..getPlayerName(thePlayer)..".",root,255, 255, 255, true) chat = true end end addCommandHandler("chaton", chatEn) function onChat ( _, messageType ) if ( messageType == 0 and not chat ) then cancelEvent ( ) end end addEventHandler ( "onPlayerChat", root, onChat )
  3. Hey, Is there any way to make a script which automatically changes car handlings to default GTA ones when a player enters the server? Similar to anti-carmod, like this: function replaceModel() txd = engineLoadTXD("cheetah.txd", 425 ) engineImportTXD(dff, 425) dff = engineLoadDFF("cheetah.dff", 425 ) engineReplaceModel(dff, 425) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) addCommandHandler ( "reloadcar", replaceModel ) I tried this script, but i couldn't get it to work in my server: vehicleIDS = { 415 } function changeHandling ( ) for _, model in ipairs ( vehicleIDS ) do setVehicleHandling(veh, "mass", 3400.0) setVehicleHandling(veh, "turnMass", 5700.0) setVehicleHandling(veh, "dragCoeff", 0.0) setVehicleHandling(veh, "centerOfMass", { 0.0, 0.0, -0.2 } ) end end addEventHandler ( "onResourceStart", resourceRoot, changeHandling )
  4. hazard

    Player alias

    Well when i do /pma it doesn't show any results in chat if i write /pma it does show "this player does not exist" The script seems correct now but it doesnt output the results in chat
  5. hazard

    Player alias

    Hmm, k ill look into it
  6. hazard

    Player alias

    Yes that worked, no errors now. The only thing I don't understand is why it doesn't show the old nicks in chatbox. function whenPlayerJoinTheServer() local playerNick = removeHexColorCode(getPlayerName(source)) local playerSerial = getPlayerSerial(source) local searchForAPlayer = executeSQLQuery("SELECT `nicks` FROM `aliases` WHERE `serial`=?", playerSerial) -- trying to select a player from the db if #searchForAPlayer == 0 then -- if we havent found our player then executeSQLQuery("INSERT INTO `aliases`(serial, nicks) VALUES (?, ?)", playerSerial, playerNick) -- insert his record to the table else -- we found our player local actualNicks = searchForAPlayer[1].nicks -- get the 'nicks' data from record if string.find(actualNicks, playerNick) then -- if he have SAME NICK as in the database -- do nothing, why we should double player nicks in db? else -- he dont have this nick in DB local addNewNick = actualNicks .. ", " .. playerNick -- expand variable by adding nick player have now executeSQLQuery("UPDATE `aliases` SET `nicks`=? WHERE `serial`=?", addNewNick, playerSerial) -- executing sql query which updates `texts` value with extanded variable containing new nick end -- ending end-- ending end-- ending addEventHandler ("onPlayerJoin", getRootElement(), whenPlayerJoinTheServer) -- adding event handler, you should know why you need to do it, if not then click "addeventhandler" and you'll get an wiki article. function getPlayerFromNamePart(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function checkAllNicksOfPlayer(who, cmd, playah) local targetPlayer = getPlayerFromNamePart(playah) -- searching player from name part so we dont need to write all the name if not targetPlayer then outputChatBox("this player does not exist", who) else local targetSerial = getPlayerSerial(targetPlayer) -- getting serial to check the db local searchForANicks = executeSQLQuery("SELECT `nicks` from `aliases` WHERE `serial`=?", targetSerial) -- checking if #searchForANicks == 1 then -- we found player outputChatBox("#FFD330History of nicks for "..getPlayerName(targetPlayer)..":#FAFAFA "..searchForANicks[1].nicks, who, 0, 0, 0, true) -- show message to command executor with player nicks history end end end addCommandHandler("pma", checkAllNicksOfPlayer) -- adding command function createTables() local a = executeSQLQuery("CREATE TABLE IF NOT EXISTS `aliases` (`serial` TEXT, `nicks` TEXT)") -- adding sqlite table with serial (to identificate player) and all nicks if a then outputDebugString("Created table for players aliases") end -- show a msg in console to be sure it all works end addEventHandler("onResourceStart", getResourceRootElement(), createTables) -- adding event handler, you should know why you need to do it, if not then click "addeventhandler" and you'll get an wiki article. function removeHexColorCode(s) return s:gsub( '#%x%x%x%x%x%x', '' ) or s end Everything seems to be correct
  7. hazard

    Player alias

    got this bug @debugscript 3 Anyone know how to fix it?
  8. Well keep up the good work, can't wait to test it out.
  9. hazard

    Player alias

    It has an error, same as i had: ERROR: alias.lua:32: attempt to call global 'executeSQLQuery' (a nil value) Any idea how to fix it?
  10. hazard

    Player alias

    Well i tried to make it work, but it doesn't work, is it possible for anyone to edit the VUVUZELE script and make only the !alias cmd work? Or just make it, im new in scripting and don't rly understand how it works
  11. hazard

    Player alias

    Well thanks, ill see what i can do.
  12. hazard

    Player alias

    Hey, I was wondering if it is possible to make a command like !alias or !pma that would show all the nicks a player has used in a server. For example i came in server with a nick "Player" then i left and came back with another nick "Goatguy", i could see both nicks the player has used with the command !alias If it is possible and not too hard to make, could anyone post it? I have no idea how to make it and i couldnt find any info.
×
×
  • Create New...