Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. I'm creating passing mode, all the markers made in edf So I need to get id marker which hit a player. Example if source == marker[1] then -- .. elseif source == marker[2] then --and etc end
  2. You need play sound for all players if player die ? If yes use this: function grenadekill(killer,killerWeapon,body) if (killerWeapon == 16) then local sound = playSound("Perfect.mp3") setSoundVolume(sound, 1) end end addEventHandler("onClientPlayerWasted", root, grenadekill) if you need play sound for local player use this function grenadekill(killer,killerWeapon,body) if (killerWeapon == 16) then local sound = playSound("Perfect.mp3") setSoundVolume(sound, 1) end end addEventHandler("onClientPlayerWasted", getLocalPlayer(), grenadekill) and remember function playSound not working in server side events.
  3. So i fix thx dude but i have question How can I determine which marker on the account? I need check number marker in hit.
  4. So i have problem with markers: addEventHandler("onGamemodeMapStart", root, function( startedMap ) local general_marker = getElementsByType ("Capture_marker") for i,v in ipairs(general_marker) do markerPssing[i] = createMarker(getElementData( v,"posX"),getElementData( v,"posY"),getElementData( v,"posZ"),"cylinder",1.5,153,77,39,255) end addEventHandler("onMarkerHit",root, function( player, dim ) if source == markerPassing[1] then outputChatBox("1") elseif source == markerPassing[2] then outputChatBox("2") elseif source == markerPassing[3] then outputChatBox("3") elseif source == markerPassing[4] then outputChatBox("4") else outputChatBox("error") end end ) end ) Debug:ERROR: zombie_mod\core_server.lua:5: attempt to index global 'markerPassing' (a nil value) But if i not use variable "markerPassing" markers are create and not write errors. Thx in advance.
  5. Добавил на баг трекер: http://bugs.mtasa.com/view.php?id=6509
  6. В том то и дело что это тоже не катит
  7. Вообщем я сделал прицел вместо обычного я естественно выключил прицел showPlayerHudComponent("crosshair",false) но возник другой вопрос прицел снапы тоже вырубился но вот это осталось: http://imageshack.us/photo/my-images/20 ... 80704.png/ Возможно ли это убрать? Просто даже если я загружу "свой" прицел ( картинку ) то эта чёрная рамка всё равно будет видна и будет мешать.
  8. Обновил пост добавил больше функций.
  9. Kenix

    question

    Yes i mean it thx dude.
  10. Kenix

    question

    i know it lol but i dont know how to transfer line addEventHandler("onClientRender",root, function() if getElementData(me,"isLogged") then dxDrawRectangle(385.0,190.0,519.0,645.0,tocolor(0,0,0,200),false) dxDrawText("Name ID Ping",458.0,290.0,616.0,310.0,tocolor(255,255,255,255),1.3,"arial","left","top",false,false,false) for i , v in ipairs(getElementsByType('player')) do dxDrawText("\n ("..i..")"..getPlayerName(v).." "..tonumber(getElementData(v,"ID")) or 0 .."",458.0,312.0,916.0,332.0,tocolor(255,255,255,255),1.3,"arial","left","top",false,false,false) dxDrawText("\n "..getPlayerPing(v),458.0,312.0,916.0,332.0,tocolor(255,255,255,255),1.3,"arial","left","top",false,false,false) end end end )
  11. Kenix

    question

    I have question so i want create a scoreboard: Example: Name: ID ping: someguy 1 0 someguy2 2 10 and etc how create it in dxDrawText? Thx in advance
  12. this is more better: local randPosTable = { -- 1 x 2 y 3 z 4 rotation 5 skin 6 interior 7 dimension 8 team { 0 , 0 , 0 , 0 , 15 , 0 , 0 , nil } , { 1 , 1 , 1 , 0 , 25 , 0 , 0 , nil } , -- and etc } function randomSpawn(player,randPosTable) local random = math.random(1,#randPosTable) spawnPlayer(player, randPosTable[random][1], randPosTable[random][2], randPosTable[random][3], randPosTable[random][4], randPosTable[random][5], randPosTable[random][6], randPosTable[random][7], randPosTable[random][8]) end example: addEventHandler("onPlayerJoin",root, function() randomSpawn(source,randPosTable) fadeCamera(source, true) setCameraTarget(source, source) end )
  13. Kenix

    problem oO

    big thx you dude
  14. Kenix

    problem oO

    Ok dude addEvent("spawnCharacter",true) addEventHandler("spawnCharacter",root, function( playerSkin,charNumber ) local result1 = executeSQLSelect ( "users1", "*", "user = '"..getAccountName( getPlayerAccount( source ) ).. "'" ) local result2 = executeSQLSelect ( "users2", "*", "user = '"..getAccountName( getPlayerAccount( source ) ).. "'" ) local result3 = executeSQLSelect ( "users3", "*", "user = '"..getAccountName( getPlayerAccount( source ) ).. "'" ) local usersWeapons1 = executeSQLSelect ( "usersWeapons1", "*","user = '" .. getAccountName( getPlayerAccount( source ) ) .. "'") local usersWeapons2 = executeSQLSelect ( "usersWeapons2", "*","user = '" .. getAccountName( getPlayerAccount( source ) ) .. "'") local usersWeapons3 = executeSQLSelect ( "usersWeapons3", "*","user = '" .. getAccountName( getPlayerAccount( source ) ) .. "'") local data = getElementData( source,"selectChar") if data == 1 then if #result1 == 1 then setTimer(function( player ) setPlayerMoney(player,result1[1]['money']) spawnPlayer( player, result1[1]['x'], result1[1]['y'], result1[1]['z']) setElementHealth(player,result1[1]['health']) setPedArmor(player,result1[1]['armor']) setPlayerWantedLevel(player,result1[1]['wanted']) setElementModel(player,result1[1]['skin']) setElementDimension (player,result1[1]['dim']) setElementInterior (player,result1[1]['int']) setCameraTarget(player,player) toggleAllControls ( player, true ) fadeCamera(player,true,1) setElementAlpha(player,255) end,300,1,source) setPlayerNametagColor ( source, result1[1]['r'], result1[1]['g'], result1[1]['b'] ) setElementData(source,"jailtime",result1[1]['jailtime']) setPedStat ( source, 69, result1[1]['stat0'] ) setPedStat ( source, 70, result1[1]['stat1'] ) setPedStat ( source, 71, result1[1]['stat2'] ) setPedStat ( source, 72, result1[1]['stat3'] ) setPedStat ( source, 73, result1[1]['stat4'] ) setPedStat ( source, 74, result1[1]['stat5'] ) setPedStat ( source, 75, result1[1]['stat6'] ) setPedStat ( source, 76, result1[1]['stat7'] ) setPedStat ( source, 77, result1[1]['stat8'] ) setPedStat ( source, 78, result1[1]['stat9'] ) setPedStat ( source, 79, result1[1]['stat10'] ) else setTimer(function( player ) spawnPlayer(player,-1422.7177734375,-288.5537109375,14.1484375,136.47149658203,getElementData( player, "selectCharSkin"),0,0,nil) setCameraTarget(player,player) toggleAllControls ( player, true ) fadeCamera(player,true,1) setElementAlpha(player,255) end,300,1,source) end if not usersWeapons1 or #usersWeapons1 == 0 then return end setTimer(function( player ) if #usersWeapons1 > 0 then for index=1, #usersWeapons1 do if ( usersWeapons1[index]["weapons"] ) then giveWeapon(player,usersWeapons1[index]['weapons'],usersWeapons1[index]['ammo'] or 0,false) end end end end,500,1,source) elseif data == 2 then if #result2 == 1 then setPlayerMoney(source,result2[1]['money']) setTimer(function( player ) spawnPlayer( player, result2[1]['x'], result2[1]['y'], result2[1]['z']) setElementHealth(player,result2[1]['health']) setPedArmor(player,result2[1]['armor']) setPlayerWantedLevel(player,result2[1]['wanted']) setElementModel(player,result2[1]['skin']) setElementDimension (player,result2[1]['dim']) setElementInterior (player,result2[1]['int']) setCameraTarget(player,player) toggleAllControls ( player, true ) fadeCamera(player,true,1) setElementAlpha(player,255) end,300,1,source) setPlayerNametagColor ( source, result2[1]['r'], result2[1]['g'], result2[1]['b'] ) setElementData(source,"jailtime",result2[1]['jailtime']) setPedStat ( source, 69, result2[1]['stat0'] ) setPedStat ( source, 70, result2[1]['stat1'] ) setPedStat ( source, 71, result2[1]['stat2'] ) setPedStat ( source, 72, result2[1]['stat3'] ) setPedStat ( source, 73, result2[1]['stat4'] ) setPedStat ( source, 74, result2[1]['stat5'] ) setPedStat ( source, 75, result2[1]['stat6'] ) setPedStat ( source, 76, result2[1]['stat7'] ) setPedStat ( source, 77, result2[1]['stat8'] ) setPedStat ( source, 78, result2[1]['stat9'] ) setPedStat ( source, 79, result2[1]['stat10'] ) else setTimer(function( player ) spawnPlayer(player,-1422.7177734375,-288.5537109375,14.1484375,136.47149658203,getElementData( player, "selectCharSkin"),0,0,nil) setCameraTarget(player,player) toggleAllControls ( player, true ) fadeCamera(player,true,1) setElementAlpha(player,255) end,300,1,source) end if not usersWeapons2 or #usersWeapons2 == 0 then return end setTimer(function( player ) if #usersWeapons2 > 0 then for index=1, #usersWeapons2 do if ( usersWeapons2[index]["weapons"] ) then giveWeapon(player,usersWeapons2[index]['weapons'],usersWeapons2[index]['ammo'] or 0,false) end end end end,500,1,source) elseif data == 3 then if #result3 == 1 then setPlayerMoney(source,result3[1]['money']) setTimer(function( player ) spawnPlayer( player, result3[1]['x'], result3[1]['y'], result3[1]['z']) setElementHealth(player,result3[1]['health']) setPedArmor(player,result3[1]['armor']) setPlayerWantedLevel(player,result3[1]['wanted']) setElementModel(player,result3[1]['skin']) setElementDimension (player,result3[1]['dim']) setElementInterior (player,result3[1]['int']) setCameraTarget(player,player) toggleAllControls ( player, true ) fadeCamera(player,true,1) setElementAlpha(player,255) end,300,1,source) setPlayerNametagColor ( source, result3[1]['r'], result3[1]['g'], result3[1]['b'] ) setElementData(source,"jailtime",result3[1]['jailtime']) setPedStat ( source, 69, result3[1]['stat0'] ) setPedStat ( source, 70, result3[1]['stat1'] ) setPedStat ( source, 71, result3[1]['stat2'] ) setPedStat ( source, 72, result3[1]['stat3'] ) setPedStat ( source, 73, result3[1]['stat4'] ) setPedStat ( source, 74, result3[1]['stat5'] ) setPedStat ( source, 75, result3[1]['stat6'] ) setPedStat ( source, 76, result3[1]['stat7'] ) setPedStat ( source, 77, result3[1]['stat8'] ) setPedStat ( source, 78, result3[1]['stat9'] ) setPedStat ( source, 79, result3[1]['stat10'] ) else setTimer(function( player ) spawnPlayer(player,-1422.7177734375,-288.5537109375,14.1484375,136.47149658203,getElementData( player, "selectCharSkin"),0,0,nil) setCameraTarget(player,player) toggleAllControls ( player, true ) fadeCamera(player,true,1) setElementAlpha(player,255) end,300,1,source) end if not usersWeapons3 or #usersWeapons3 == 0 then return end setTimer(function( player ) if #usersWeapons3 > 0 then for index=1, #usersWeapons3 do if ( usersWeapons3[index]["weapons"] ) then giveWeapon(player,usersWeapons3[index]['weapons'],usersWeapons3[index]['ammo'] or 0,false) end end end end,500,1,source) end setElementData(source,"isLogged",true) setPlayerID(source,1) local usersLogged = executeSQLSelect ( "usersLogged", "*","accountName = '" .. getAccountName( getPlayerAccount( source ) ) .. "'") if not usersLogged or #usersLogged == 0 then local var = "true" executeSQLInsert ( "usersLogged", "'"..getAccountName( getPlayerAccount( source ) ).."','"..var.."'") else local var = "true" executeSQLUpdate( "usersLogged", "accountName = '"..getAccountName( getPlayerAccount( source ) ).."',bool = '"..var.."'") end outputChatBox("* "..getPlayerName( source ).." вошёл на сервер",root,102,204,0,false) end )
  15. you can also use unpack
  16. Kenix

    problem oO

    IDK but it not working function setPlayerID( id,player ) for i,v in ipairs(getElementsByType("player")) do if getElementData(v,"ID") == id then id = id+1 end end setElementData(player,"ID",tonumber(id)) end debug: Bad argument @ 'setElementData' [Expected element at argument 1, got number '1']
  17. У меня точно такая же проблема но при заходе на некоторые серверы
  18. Держи: Скачать Обновил ссыль 1 поста.
  19. Я ничего, просто у меня случайно копирнулось в цитату
  20. Всем привет у меня есть проблема с русскими символами. Я уже пробывал через string.find но у меня была проблема с $ поэтому я сделал свою функцию. Клиент: words = {"а","б","в","г","д","е","ё","ж","з","и","й","к","л","м","о","п","р","с","т","у","ф","х","ц","ч","щ","ь","ы","ъ","э","ю","я","!","@","#","$","%","^","&","*","(",")","№",";",":","?"} loginButton = {} loginEdit = {} loginEdit[0] = guiCreateEdit(0.475,0.4263,0.0812,0.0244,"",true) -- едит аккаунта guiSetAlpha(loginEdit[0],0.75) loginButton[2] = guiCreateButton(0.3858,0.8154,0.1917,0.0601,"Зарегистрироваться",true) addEventHandler("onClientGUIClick",loginButton[2], function() local accText = guiGetText(loginEdit[0]) if string.findtable(accText,words) then -- всё что угодно ... end end) function string.findtable( text, theTable ) for j=1, string.len( text ) do local char = string.sub( tostring(text), j, j ) for k=1, #theTable do local character = theTable[k] outputDebugString( "if "..tostring(char).." == "..tostring(character).." then") if char == character then outputChatBox( "Найден недопустимый символ", 0, 255, 0 ) return true end end end outputChatBox( "Не найден недопустимый символ", 255, 0, 0 ) return false end Когда я редактирую эдит и пишу туда букву "д" то в clientscript.log, я вижу 'if Р == Рґ then' вместо 'if д == д then' Я видел, что есть некоторые UTF функции, но я не знаю, как их использовать и, если они могут исправить мою проблему. Вообщем суть такова когда человек заполняет поля Аккаунта едит при нажатии на кнопку "Зарегистрироваться" проверять не ввёл ли игрок русские символы или "#,%,?" и т.д
×
×
  • Create New...