Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. You need use getElementData if your elements in map. https://wiki.multitheftauto.com/wiki/Writing_Gamemodes or i not understand you.
  2. You can use this: [[ ]] Example: GUIEditor_Memo[1] = guiCreateMemo(27,166,670,374,[[ Rules! Server policy: All staff members shall treat all players with great kindness and respect. 1. Deathmatching is allowed, but stop means stop. 2. No hacking or glitch abusing. If you see someone doing this please use /report and a the problem will be dealt with. 3. Do not spam the chat, commands, or the map with cars. 4. Respect all players, be kind and please do not annoy anyone. 5. If you see a staff member abusing or being rude please use /report and the problem will be dealt with. If you see anyone breaking these rules please contact a staff member by typing /report and the problem will be dealt with. Enjoy and have fun! -The JWF team ]],false,window_rules) This more better It not colored in code oO
  3. Try function characterkill(player, cmd, names) if hasObjectPermissionTo(player, "command.ban") then if names then local other, name = exports.players:getFromName(player, names) if other then connect = mysql_connect("host", "user", "pass", "db") if not connect then outputDebugString("Unable to connect to the MySQL server.") else if mysql_query( connect, "DELETE FROM characters WHERE characterName = '" .. name.."'" ) then local x, y, z = getElementPosition(other) local skin = getElementModel(other) local ped = createPed(skin, x, y, z) setElementHealth(other, 0) killPed(ped) setElementFrozen(ped, true) setElementFrozen(other, true) setElementAlpha(other, 0) outputChatBox(name .. " has been character killed.", player, 220, 220, 0, false) outputChatBox(name .. " has been character killed - meaning that your character is now fully dead and removed.", other, 220, 220, 0, false) setTimer(redirectPlayer, 5000, 1, other, ip, "22004") else outputChatBox("SQL error happened, report at Mantis.", player, 255, 0, 0, false) end end else outputChatBox("No player found.", player, 255, 0, 0, false) end else outputChatBox("Syntax: /ck [player]", player, 255, 255, 255, false) end end end addCommandHandler("ck", characterkill) You can also check problem with function mysql_error. And show what debug write.
  4. I not understand you
  5. Kenix

    [WIP] wBot

    Good job! 1000 post
  6. Нужная функция Добавил в главный пост.
  7. You can use bind and this outside a event "onClientResourceStart".
  8. Kenix

    Zombies

    You can use my resource https://community.multitheftauto.com/index.php?p= ... ls&id=2020
  9. Kenix

    elementData

    Try: Server: function onPlayerQuit ( ) local acc = getPlayerAccount(soruce) local playerVehicle = getPedOccupiedVehicle(soruce) if (not isGuestAccount(acc) and playerVehicle) then local nitroColor = getElementData(soruce, "nitroColor") if (nitroColor) then setAccountData(acc, "nitro.data", toJSON( { unpack( nitroColor ) } ) ) end end end addEventHandler( "onPlayerQuit", root, onPlayerQuit ) function onPlayerLogin (_,acc) local pNitro = getAccountData(acc, "nitro.data") if pNitro then local r, g, b = unpack( fromJSON( pNitro ) ) triggerClientEvent( source,"setNitroColor",source,"",r,g,b ) end end addEventHandler( "onPlayerLogin", root, onPlayerLogin )
  10. Set object to interior for example 5 and you can't see but you can't pass through it. You this mean?
  11. My function( tested ) and more better local id = { } function givePlayerID( player ) if getElementData( player,"player.id" ) then return end if not id[ player ] then id[ player ] = 1 end for _,v in pairs( getElementsByType( "player" ) ) do if getElementData( v,"player.id" ) == id[ player ] then id[ player ] = id[ player ] + 1 givePlayerID( player ) return end end setElementData( player,"player.id",id[ player ] ) id[ player ] = nil end addCommandHandler("id",givePlayerID) EDIT:Code modified.
  12. Try local serial = "serial" local account = "gtx" local password = "password" -- I will not show all the details here function connect() if getPlayerSerial(source) == serial then local acc = getAccount( account,password ) if acc then logIn(source, acc, password) else outputChatBox( "can't get account" ) end else outputChatBox("WELCOME!") end end addEventHandler("onPlayerJoin", root, connect )
  13. getPedStat ( getLocalPlayer(), 225 )) Это показывает какой у тебя скилл а не сколько кислорода у тебя.
  14. And what the problem?I not understand.
  15. Я этот баг знал ещё очень давно но забывал выкладывать на баг трекер . Хотя его можно исправить просто убрать сортировку. Залил на баг трекер.
  16. It should work ( tested ) addEventHandler ( "onPlayerWasted", root, function( totalAmmo, killer, killerWeapon, bodypart, stealth ) if killer then local account = getPlayerAccount ( killer ) if killer ~= source then setAccountData( account,"totalkillsdeaths.Kills",tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) +1 ) setElementData( killer, "T/K", tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) ) ) end else local accountSource = getPlayerAccount ( source ) setAccountData( accountSource,"totalkillsdeaths.Deaths",tonumber( getAccountData(accountSource,"totalkillsdeaths.Deaths") or 0 ) +1 ) setElementData( source, "T/D", tonumber( getAccountData( accountSource,"totalkillsdeaths.Deaths" ) ) ) end end ) addEventHandler( "onPlayerLogin",root, function( thePreviousAccount, theCurrentAccount, autoLogin ) local account = getPlayerAccount ( source ) if not getAccountData( account,"totalkillsdeaths.Kills" ) and not getAccountData( account,"totalkillsdeaths.Deaths" ) then setAccountData( account,"totalkillsdeaths.Kills",0 ) setAccountData( account,"totalkillsdeaths.Deaths",0 ) end setElementData( source,"T/D",tonumber( getAccountData( account,"totalkillsdeaths.Deaths" ) or 0 ) ) setElementData( source,"T/K",tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) ) end ) addEventHandler( "onResourceStart",resourceRoot, function( ) outputDebugString( "add Total Kills to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "T/K",root,2, 0.035 ) ) ) outputDebugString( "add Total Deaths to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "T/D",root,3, 0.035 ) ) ) end )
  17. My bad I'm very tired addEventHandler ( "onPlayerWasted", root, function( totalAmmo, killer, killerWeapon, bodypart, stealth ) local account = getPlayerAccount ( killer ) local accountSource = getPlayerAccount ( source ) if killer and killer ~= source then setAccountData( account,"totalkillsdeaths.kills",getAccountData( account,"totalkillsdeaths.kills" )+1 ) setElementData( killer, "T/K", tonumber( getAccountData( account,"totalkillsdeaths.kills" ) ) ) else setAccountData( accountSource,"totalkillsdeaths.Deaths",getAccountData(accountSource,"totalkillsdeaths.Deaths")+1) setElementData( source, "T/D", tonumber( getAccountData( accountSource,"totalkillsdeaths.Deaths" ) ) ) end end ) addEventHandler( "onPlayerLogin",root, function( thePreviousAccount, theCurrentAccount, autoLogin ) if not getAccountData( theCurrentAccount,"totalkillsdeaths.kills" ) and not getAccountData( theCurrentAccount,"totalkillsdeaths.deaths" ) then setAccountData( theCurrentAccount,"totalkillsdeaths.kills",0) setAccountData( theCurrentAccount,"totalkillsdeaths.deaths",0) setElementData( source,"T/D",0 ) setElementData( source,"T/K",0 ) else setElementData( source,"T/D",getAccountData( theCurrentAccount,"totalkillsdeaths.kills" ) ) setElementData( source,"T/K",getAccountData( theCurrentAccount,"totalkillsdeaths.deaths" ) ) end end ) addEventHandler( "onResourceStart",resourceRoot, function( ) outputDebugString( "add Total Kills to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "T/K",root,2, 0.035 ) ) ) outputDebugString( "add Total Deaths to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "T/D",root,3, 0.035 ) ) ) end )
  18. Если не будешь знать луа не будешь продвигаться дальше...
×
×
  • Create New...