Jump to content

acp___(PL)

Members
  • Posts

    122
  • Joined

  • Last visited

Everything posted by acp___(PL)

  1. I do not know why but the script will only work once you start This works better, but there are errors local teamlist = {} function teamsloginhandlePlayerJoin() local teamsLoginPlayerName = getPlayerName(source) if teamsLoginPlayerName == "[2RT]acp___(PL)" then teamlist[4] = createTeam ( "2paq Best Drivers", 0, 0, 255 ) setPlayerTeam ( source, teamlist[4] ) outputConsole ( "teamslogin.handlePlayerJoin: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]DeTeR.PL" then teamlist[7] = createTeam ( "DeTeARm", 255, 255, 0 ) setPlayerTeam ( source, teamlist[7] ) outputConsole ( "teamslogin.handlePlayerJoin: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]Wojak[PL]" then teamlist[5] = createTeam ( "Military Boys", 153, 150, 26 ) setPlayerTeam ( source, teamlist[5] ) outputConsole ( "teamslogin.handlePlayerJoin: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]Spazz" or teamsLoginPlayerName == "[2RT]Stroow" then teamlist[6] = createTeam ( "S&S bRoTHErS", 0, 255, 0 ) setPlayerTeam ( source, teamlist[6] ) outputConsole ( "teamslogin.handlePlayerJoin: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "enter" or teamsLoginPlayerName == "[2RT]macwiek" then teamlist[8] = createTeam ( "MYsieZIMYnieBOIMY", 64, 0, 128 ) setPlayerTeam ( source, teamlist[8] ) outputConsole ( "teamslogin.handlePlayerJoin: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "Alf_PL" then teamlist[11] = createTeam ( "Alien Team", 128, 128, 255 ) setPlayerTeam ( source, teamlist[11] ) outputConsole ( "teamslogin.handlePlayerJoin: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]equlibrium" then teamlist[10] = createTeam ( "librium team", 255, 0, 0 ) setPlayerTeam ( source, teamlist[10] ) outputConsole ( "teamslogin.handlePlayerJoin: " ..teamsLoginPlayerName ) else outputConsole ( "teamslogin.handlePlayerJoin - else: " ..teamsLoginPlayerName ) end end addEventHandler('onPlayerJoin', getRootElement(), teamsloginhandlePlayerJoin) addEventHandler('onResourceStart', getRootElement(), function() teamlist[1] = createTeam ( "White", 255, 255, 255 ) teamlist[2] = createTeam ( "Gray", 129, 129, 129 ) teamlist[3] = createTeam ( "Black", 0, 0, 0 ) -- teamlist[9] = createTeam ( "SerV's TeaM", 255, 140, 0 ) end ) addEventHandler('onResourceStop', getRootElement(), function() teamlist = nil end ) function teamsloginhandlePlayerQuit() local teamsLoginPlayerName = getPlayerName(source) if teamsLoginPlayerName == "[2RT]acp___(PL)" then destroyElement(teamlist[4]) teamlist[4] = nil outputConsole ( "teamslogin.handlePlayerQuit: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]DeTeR.PL" then destroyElement(teamlist[7]) source, teamlist[7] = nil outputConsole ( "teamslogin.handlePlayerQuit: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]Wojak[PL]" then destroyElement(teamlist[5]) source, teamlist[5] = nil outputConsole ( "teamslogin.handlePlayerQuit: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]Spazz" or teamsLoginPlayerName == "[2RT]Stroow" then destroyElement(teamlist[6]) source, teamlist[6] = nil outputConsole ( "teamslogin.handlePlayerQuit: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "enter" or teamsLoginPlayerName == "[2RT]macwiek" then destroyElement(teamlist[8]) source, teamlist[8] = nil outputConsole ( "teamslogin.handlePlayerQuit: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "Alf_PL" then destroyElement(teamlist[11]) source, teamlist[11] = nil outputConsole ( "teamslogin.handlePlayerQuit: " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]equlibrium" then destroyElement(teamlist[10]) source, teamlist[10] = nil outputConsole ( "teamslogin.handlePlayerQuit: " ..teamsLoginPlayerName ) else outputConsole ( "teamslogin.handlePlayerQuit - else: " ..teamsLoginPlayerName ) end if getPlayerName(source) == "[2RT]Wojak[PL]" then destroyElement(teamlist5) end end addEventHandler('onPlayerQuit', getRootElement(), teamsloginhandlePlayerQuit) function teamsloginhandlePlayerChangeNick(oldNick, newNick) if oldNick == "[2RT]acp___(PL)" then destroyElement(teamlist[4]) teamlist[4] = nil outputConsole ( "teamslogin.handlePlayerChangeNick: " ..oldNick ) elseif oldNick == "[2RT]DeTeR.PL" then destroyElement(teamlist[7]) source, teamlist[7] = nil outputConsole ( "teamslogin.handlePlayerChangeNick: " ..oldNick ) elseif oldNick == "[2RT]Wojak[PL]" then destroyElement(teamlist[5]) source, teamlist[5] = nil outputConsole ( "teamslogin.handlePlayerChangeNick: " ..oldNick ) elseif oldNick == "[2RT]Spazz" or oldNick == "[2RT]Stroow" then destroyElement(teamlist[6]) source, teamlist[6] = nil outputConsole ( "teamslogin.handlePlayerChangeNick: " ..oldNick ) elseif oldNick == "enter" or oldNick == "[2RT]macwiek" then destroyElement(teamlist[8]) source, teamlist[8] = nil outputConsole ( "teamslogin.handlePlayerChangeNick: " ..oldNick ) elseif oldNick == "Alf_PL" then destroyElement(teamlist[11]) source, teamlist[11] = nil outputConsole ( "teamslogin.handlePlayerChangeNick: " ..oldNick ) elseif oldNick == "[2RT]equlibrium" then destroyElement(teamlist[10]) source, teamlist[10] = nil outputConsole ( "teamslogin.handlePlayerChangeNick: " ..oldNick ) else outputConsole ( "teamslogin.handlePlayerChangeNick - else: " ..oldNick ) end if newNick == "[2RT]acp___(PL)" then teamlist[4] = createTeam ( "2paq Best Drivers", 0, 0, 255 ) setPlayerTeam ( source, teamlist[4] ) outputConsole ( "teamslogin.handlePlayerJoinChangeNick: " ..newNick ) elseif newNick == "[2RT]DeTeR.PL" then teamlist[7] = createTeam ( "DeTeARm", 255, 255, 0 ) setPlayerTeam ( source, teamlist[7] ) outputConsole ( "teamslogin.handlePlayerJoinChangeNick: " ..newNick ) elseif newNick == "[2RT]Wojak[PL]" then teamlist[5] = createTeam ( "Military Boys", 153, 150, 26 ) setPlayerTeam ( source, teamlist[5] ) outputConsole ( "teamslogin.handlePlayerJoinChangeNick: " ..newNick ) elseif newNick == "[2RT]Spazz" or newNick == "[2RT]Stroow" then teamlist[6] = createTeam ( "S&S bRoTHErS", 0, 255, 0 ) setPlayerTeam ( source, teamlist[6] ) outputConsole ( "teamslogin.handlePlayerJoinChangeNick: " ..newNick ) elseif newNick == "enter" or newNick == "[2RT]macwiek" then teamlist[8] = createTeam ( "MYsieZIMYnieBOIMY", 64, 0, 128 ) setPlayerTeam ( source, teamlist[8] ) outputConsole ( "teamslogin.handlePlayerJoinChangeNick: " ..newNick ) elseif newNick == "Alf_PL" then teamlist[11] = createTeam ( "Alien Team", 128, 128, 255 ) setPlayerTeam ( source, teamlist[11] ) outputConsole ( "teamslogin.handlePlayerJoinChangeNick: " ..newNick ) elseif newNick == "[2RT]equlibrium" then teamlist[10] = createTeam ( "librium team", 255, 0, 0 ) setPlayerTeam ( source, teamlist[10] ) outputConsole ( "teamslogin.handlePlayerJoinChangeNick: " ..newNick ) else outputConsole ( "teamslogin.handlePlayerJoinChangeNick - else: " ..newNick ) end end addEventHandler('onPlayerChangeNick', getRootElement(), teamsloginhandlePlayerChangeNick)
  2. Working on a script that will give points for the drift, will take into account: angle in the corner and speed. Speed is not the problem ..., but angle yes ... my way is not working like I wanted ... local gMe = getLocalPlayer() local screenWidth, screenHeight = guiGetScreenSize() local screenPlayerWidth = screenWidth / 1280 local screenPlayerHeight = screenHeight / 1024 local g_rot = getRootElement() local myX, myY = getElementPosition(gMe) local driftX1 = myX local driftY1 = myY function uruchomDriftMeter() if getVehicleType(getPedOccupiedVehicle(gMe)) == "Automobile" then myX, myY = getElementPosition(gMe) local driftX0 = driftX1 local driftY0 = driftY1 driftX1 = myX driftY1 = myY local myRX, myRY, myRZ = getElementRotation(getPedOccupiedVehicle(gMe)) local distVectorNorth = getDistanceBetweenPoints2D(driftX0, driftY0, driftX0, driftY1) local distVectorSpeed = getDistanceBetweenPoints2D(driftX0, driftY0, driftX1, driftY1) local cosinusDrift = distVectorNorth / distVectorSpeed local angelDriftBezwzgledny = math.acos(cosinusDrift) local angelDriftAbs = angelDriftBezwzgledny * (180 / math.pi) local angelDrift = math.floor(math.abs(angelDriftAbs - myRZ)) if driftY1 < driftY0 and driftX1 < driftX0 then angelDrift = angelDrift + 90 elseif driftY1 < driftY0 and driftX1 > driftX0 then angelDrift = angelDrift + 180 elseif driftY1 > driftY0 and driftX1 > driftX0 then angelDrift = angelDrift + 270 end dxDrawText( "Drift angel: " ..angelDrift, math.floor(5*screenPlayerWidth), math.floor(580*screenPlayerHeight), screenWidth, screenHeight, tocolor ( 0, 255, 0, 255 ), 1, "default-bold" ) dxDrawText( "angelDriftAbs: " ..angelDriftAbs, math.floor(5*screenPlayerWidth), math.floor(555*screenPlayerHeight), screenWidth, screenHeight, tocolor ( 0, 255, 0, 255 ), 1, "default-bold" ) dxDrawText( "myRZ: " ..myRZ, math.floor(5*screenPlayerWidth), math.floor(530*screenPlayerHeight), screenWidth, screenHeight, tocolor ( 0, 255, 0, 255 ), 1, "default-bold" ) end end addEventHandler("onClientResourceStart", g_rot, addEventHandler ('onClientRender', g_rot, uruchomDriftMeter) )
  3. acp___(PL)

    GPS

    I do not know why this happens - arrows (see minimap) indicate the direction to the next CP (as in GPS) arrow once pointing at the correct direction once pointing at the inverted 180 degrees direction local gMe = getLocalPlayer() local screenWidth, screenHeight = guiGetScreenSize() local screenPlayerWidth = screenWidth / 1280 local screenPlayerHeight = screenHeight / 1024 local g_rot = getRootElement() function createGPS() local myRX, myRY = nil local cp_listGPS = nil local cps = nil local cpX, cpY, cpHigh = nil local myX, myY, myHigh = getElementPosition(gMe) local playerGPSvehicle = getPedOccupiedVehicle(gMe) local in_what_player_are = getVehicleType(playerGPSvehicle) local distHigh = myHigh local distance = 0 if in_what_player_are then myRX, myRY, myRZ = getElementRotation ( playerGPSvehicle ) cp_listGPS = getElementsByType('checkpoint') cps = getElementData(gMe, 'next.checkpoint') cpX, cpY, cpHigh = getElementPosition(cp_listGPS[cps]) distHigh = myHigh - cpHigh distance = getDistanceBetweenPoints3D(myX, myY, myHigh, cpX, cpY, cpHigh) local distNorth = getDistanceBetweenPoints2D(myX, myY, myX, cpY) local distToPoint = getDistanceBetweenPoints2D(myX, myY, cpX, cpY) local cosinusGPS = distNorth / distToPoint local angelGPSbezwzgledny = math.acos(cosinusGPS) local angelDegGPSabs = angelGPSbezwzgledny * (180 / math.pi) local angelGPS = angelDegGPSabs + myRZ -- dxDrawImage( math.floor((174-(72/2))*screenPlayerWidth), math.floor((872-(130/2))*screenPlayerHeight), math.floor(72*screenPlayerWidth), math.floor(130*screenPlayerHeight), "strzalkagps.png", angelGPS) end end addEventHandler("onClientResourceStart", g_rot, addEventHandler ('onClientRender', g_rot, createGPS) )
  4. I did not know that this also can be
  5. I'm trying to understand player name changes so if I will index from the new (or current) name is not the same as the old index acp___ change nick to Player oldForNick=acp___, newForNick=Player if newNickFinder then timersForbidenNick[Player] = {} timersForbidenNick[Player][1] = setTimer ( signalFromTimer, 30*1000, 1, source ) timersForbidenNick[Player][2] = setTimer ( signalFromTimer2, 45*1000, 1, source ) timersForbidenNick[Player][3] = setTimer ( signalFromTimer3, 60*1000, 1, source ) timersForbidenNick[Player][4] = setTimer ( signalInformationChat, 70*1000, 7, source) timersForbidenNick[Player][5] = setTimer ( signalInformationKick, 540*1000, 1, source) timersForbidenNick[Player][6] = setTimer ( signalToKick, 600*1000, 1, source) end timersForbidenNick[newForNick] Player change nick to 2paq (oldForNick=Player, newForNick=2paq) timersForbidenNick[oldForNick] timersForbidenNick[newForNick]=timersForbidenNick[oldForNick] before change newForNick = Player, after change oldForNick = Player (getPlayerName( player ) = Player) elseif oldNickFinder then for timerKeyFN, timerValueFN in ipairs(timersForbidenNick[Player]) do killTimer ( timerValueFN ) end timersForbidenNick[ Player ] = nil end
  6. 50p, very thanks for help so many times I looked at it and did not pay attention it should be of course: triggerClientEvent ( source, "onPlayer_hide_instruktion", g_Root ) string.find(string.lower(joinedPlayerName), forbidenNickFinded) string.lower by that I have in the table less items string.find has two tasks captures: eg. "curseYouAll" and protects: eg. join Player, after worning change his nick to Player1 timersFN = getTimers ( timersForbidenNick[oldForNick] ) I want to disable all timers associated with the player how to disable the timer:timersForbidenNick[oldForNick][1] killTimer (timersForbidenNick[oldForNick][1]) Now I think it should be so: for timerKeyFN, timerValueFN in ipairs(timersForbidenNick[oldForNick]) do killTimer ( timersForbidenNick[oldForNick][timerKeyFN] ) end or for timerKeyFN, timerValueFN in ipairs(timersForbidenNick[oldForNick]) do killTimer ( timerValueFN ) end but ERROR: ...atch/resourcecache/2paq-player_f_n/player_server.lua:71: bad argument #1 to "ipairs' (table expected, got nil) it is a table timersForbidenNick[newForNick] = {} timersForbidenNick[newForNick][1] = setTimer ( signalFromTimer, 30*1000, 1, source ) timersForbidenNick[newForNick][2] = setTimer ( signalFromTimer2, 45*1000, 1, source ) timersForbidenNick[newForNick][3] = setTimer ( signalFromTimer3, 60*1000, 1, source ) timersForbidenNick[newForNick][4] = setTimer ( signalInformationChat, 80*1000, 3, source) timersForbidenNick[newForNick][5] = setTimer ( signalInformationKick, 540*1000, 1, source) timersForbidenNick[newForNick][6] = setTimer ( signalToKick, 600*1000, 1, source)
  7. how to remove timers?? following function it looks like does not work local g_Root = getRootElement() local g_ResRoot = getResourceRootElement(getThisResource()) local pointsCPzliczacz = {} local pointsCPzliczaczMarker = {} local markerBonusTime = {} local timerBonus = {} local timerBonusCP = {} function playerQuitResetRace (zmiennaDlaZmianyNicku) local namePlayerQRR = getPlayerName ( source ) if zmiennaDlaZmianyNicku then namePlayerQRR = zmiennaDlaZmianyNicku end if players_count_5races[namePlayerQRR] then players_count_5races[namePlayerQRR] = nil end if pointsCPzliczaczMarker[namePlayerQRR] == 1 then if pointsCPzliczacz[namePlayerQRR][1] then pointsCPzliczacz[namePlayerQRR][1] = nil end if pointsCPzliczacz[namePlayerQRR][2] then pointsCPzliczacz[namePlayerQRR][2] = nil end if pointsCPzliczacz[namePlayerQRR][3] then pointsCPzliczacz[namePlayerQRR][3] = nil end if pointsCPzliczacz[namePlayerQRR][4] then pointsCPzliczacz[namePlayerQRR][4] = nil end if pointsCPzliczacz[namePlayerQRR][5] then pointsCPzliczacz[namePlayerQRR][5] = nil end if pointsCPzliczacz[namePlayerQRR][6] then pointsCPzliczacz[namePlayerQRR][6] = nil end if pointsCPzliczaczMarker[namePlayerQRR] then pointsCPzliczaczMarker[namePlayerQRR] = nil end outputConsole("if pointsCPzliczaczMarker[namePlayerQRR] == 1 then - nick: " ..namePlayerQRR) end if markerBonusTime[namePlayerQRR] == 1 then if timerBonus[namePlayerQRR][1] then killTimer(timerBonus[namePlayerQRR][1]) end if timerBonus[namePlayerQRR][2] then killTimer(timerBonus[namePlayerQRR][2]) end if timerBonus[namePlayerQRR][3] then killTimer(timerBonus[namePlayerQRR][3]) end if timerBonus[namePlayerQRR][4] then killTimer(timerBonus[namePlayerQRR][4]) end if markerBonusTime[namePlayerQRR] then markerBonusTime[namePlayerQRR] = nil end outputConsole("if markerBonusTime[namePlayerQRR] == 1 then - nick: " ..namePlayerQRR) end outputConsole("function playerQuitResetRace (zmiennaDlaZmianyNicku) - nick:" ..namePlayerQRR) end addEventHandler('onPlayerQuit', g_Root , playerQuitResetRace) function ustawNaNowoDlaNowegoNicku (oldPointsNick, newPointsNick) playerQuitResetRace(oldPointsNick) setTimer (playerJoinSetTimerBonus, 50, 1, newPointsNick) end addEventHandler ( "onPlayerChangeNick", g_Root, ustawNaNowoDlaNowegoNicku )
  8. join: player join: dupa player change nick! dupa change nick! player do nothing dupa change his nick warnings have disappeared in both players should continue to appear to player
  9. I do not know why, when they are at least two persons from the prohibited and one change to the correct nickname, warning them both disappear ... player_client.lua g_Root = getRootElement() local screenWidth, screenHeight = guiGetScreenSize() function createText () local forbiden_nick = getPlayerName(getLocalPlayer()) dxDrawText( forbiden_nick.. " change nick!", 10, 10, screenWidth-10, screenHeight-10, tocolor ( 255, 0, 0, 255 ), 1, "pricedown", "center", "center") end function createText2 () local forbiden_nick = getPlayerName(getLocalPlayer()) dxDrawText( "You are using a >>>" ..forbiden_nick.. "<<< nickname which is forbidden!", 100, 40, screenWidth-10, screenHeight-100, tocolor ( 0, 255, 0, 255 ), 2, "default", "center", "center", false, true) dxDrawText( "Change the nickname! You can change your nick in settings! <Esc> --> <settings>", 100, 160, screenWidth-10, screenHeight-100, tocolor ( 0, 0, 255, 255 ), 2, "default", "center", "center", false, true) end function createText3 () if k_zam_playFN > 6 then zamazywacz_ekrFN = "|" ..zamazywacz_ekrFN zamazywacz_ekrFN2 = "||" ..zamazywacz_ekrFN2 zamazywacz_ekrFN3 = "||||" ..zamazywacz_ekrFN3 k_zam_playFN = 0 else k_zam_playFN = k_zam_playFN +1 end dxDrawText( zamazywacz_ekrFN , 1, 1, screenWidth-1, screenHeight-1, tocolor ( 0, 0, 0, 255 ), 3, "pricedown", "center", "top", false, true) dxDrawText( zamazywacz_ekrFN2 , 1, 1, screenWidth-1, screenHeight-1, tocolor ( 0, 0, 0, 255 ), 2, "pricedown", "center", "top", false, true) dxDrawText( zamazywacz_ekrFN3 , 1, 1, screenWidth-1, screenHeight-1, tocolor ( 0, 0, 0, 255 ), 1, "pricedown", "center", "top", false, true) end function instruktionToPlayer () addEventHandler("onClientRender",g_Root, createText) end function instruktionToPlayer2 () addEventHandler("onClientRender",g_Root, createText2) end function instruktionToPlayer3 () k_zam_playFN = 0 zamazywacz_ekrFN = "|" zamazywacz_ekrFN2 = "||" zamazywacz_ekrFN3 = "||||" addEventHandler("onClientRender",g_Root, createText3) end function hideInstruktionToPlayer () removeEventHandler("onClientRender",g_Root, createText) removeEventHandler("onClientRender",g_Root, createText2) removeEventHandler("onClientRender",g_Root, createText3) end addEvent( "onPlayer_instruktion", true ) addEventHandler( "onPlayer_instruktion", g_Root, instruktionToPlayer ) addEvent( "onPlayer_instruktion2", true ) addEventHandler( "onPlayer_instruktion2", g_Root, instruktionToPlayer2 ) addEvent( "onPlayer_instruktion3", true ) addEventHandler( "onPlayer_instruktion3", g_Root, instruktionToPlayer3 ) addEvent( "onPlayer_hide_instruktion", true ) addEventHandler( "onPlayer_hide_instruktion", g_Root, hideInstruktionToPlayer ) player_server.lua local g_Root = getRootElement() local forbidenListOfNicks = { 'fuck' , 'player' , 'huj' , 'kurwa' , 'dupa' , 'pizda' , 'cipa' , 'skurw' , 'kutas' , 'jebac' } local timersForbidenNick = {} function signalFromTimer (the_source ) triggerClientEvent ( the_source, "onPlayer_instruktion", g_Root ) end function signalFromTimer2 (the_source ) triggerClientEvent ( the_source, "onPlayer_instruktion2", g_Root ) end function signalFromTimer3 (the_source ) triggerClientEvent ( the_source, "onPlayer_instruktion3", g_Root ) end function signalInformationChat ( the_source ) outputChatBox ( "To remove the warning text from the screen and hide black strips change nickname!" , the_source, 0, 255, 0, 255 ) end function signalInformationKick ( the_source ) outputChatBox ( "You have 60 seconds to change the nickname, or you will be kicked!" , the_source, 255, 255, 0, 255 ) end function signalToKick ( the_source ) kickPlayer(the_source, "Despite warnings not changed nick!") end function forbidenPlayer () local joinedPlayerName = getPlayerName ( source ) for forbidenNickKeyFinder, forbidenNickFinded in ipairs(forbidenListOfNicks) do newNickFinder, newNickFinderEnd = string.find(string.lower(joinedPlayerName), forbidenNickFinded) outputConsole ( "TESTjoin: key=" ..forbidenNickKeyFinder.. " forbiden=" ..forbidenNickFinded ) if newNickFinder then break end end if newNickFinder then timersForbidenNick[joinedPlayerName] = {} timersForbidenNick[joinedPlayerName][1] = setTimer ( signalFromTimer, 30*1000, 1, source ) timersForbidenNick[joinedPlayerName][2] = setTimer ( signalFromTimer2, 45*1000, 1, source ) timersForbidenNick[joinedPlayerName][3] = setTimer ( signalFromTimer3, 60*1000, 1, source ) timersForbidenNick[joinedPlayerName][4] = setTimer ( signalInformationChat, 70*1000, 7, source) timersForbidenNick[joinedPlayerName][5] = setTimer ( signalInformationKick, 540*1000, 1, source) timersForbidenNick[joinedPlayerName][6] = setTimer ( signalToKick, 600*1000, 1, source) newNickFinderOCB = string.sub(joinedPlayerName, newNickFinder, newNickFinderEnd) outputChatBox ( "This part of nick is forbiden: " ..newNickFinderOCB ) end end addEventHandler ( "onPlayerJoin", g_Root, forbidenPlayer ) function forbidenChangePlayer (oldForNick, newForNick) for forbidenNickKeyFinder, forbidenNickFinded in ipairs(forbidenListOfNicks) do newNickFinder, newNickFinderEnd = string.find(string.lower(newForNick), forbidenNickFinded) oldNickFinder = string.find(string.lower(oldForNick), forbidenNickFinded) outputConsole ( "TESTchange: key=" ..forbidenNickKeyFinder.. " forbiden=" ..forbidenNickFinded ) if newNickFinder or oldNickFinder then break end end if newNickFinder and oldNickFinder then newNickFinderOCB = string.sub(newForNick, newNickFinder, newNickFinderEnd) outputChatBox ( "This part of nick is forbiden: " ..newNickFinderOCB ) elseif newNickFinder then timersForbidenNick[newForNick] = {} timersForbidenNick[newForNick][1] = setTimer ( signalFromTimer, 30*1000, 1, source ) timersForbidenNick[newForNick][2] = setTimer ( signalFromTimer2, 45*1000, 1, source ) timersForbidenNick[newForNick][3] = setTimer ( signalFromTimer3, 60*1000, 1, source ) timersForbidenNick[newForNick][4] = setTimer ( signalInformationChat, 80*1000, 3, source) timersForbidenNick[newForNick][5] = setTimer ( signalInformationKick, 540*1000, 1, source) timersForbidenNick[newForNick][6] = setTimer ( signalToKick, 600*1000, 1, source) newNickFinderOCB = string.sub(newForNick, newNickFinder, newNickFinderEnd) outputChatBox ( "This part of new nick is forbiden: " ..newNickFinderOCB ) elseif oldNickFinder then outputConsole ( "test O" ) triggerClientEvent ( "onPlayer_hide_instruktion", g_Root ) timersFN = getTimers ( timersForbidenNick[oldForNick] ) for timerKeyFN, timerValueFN in ipairs(timersFN) do killTimer ( timerValueFN ) end end end addEventHandler ( "onPlayerChangeNick", g_Root, forbidenChangePlayer ) function forbidenQuitPlayer() local quitPlayerName = getPlayerName ( source ) timersFN = getTimers ( timersForbidenNick[quitPlayerName] ) for timerKeyFN, timerValueFN in ipairs(timersFN) do killTimer ( timerValueFN ) end end addEventHandler ( "onPlayerQuit", g_Root, forbidenQuitPlayer ) should also add a line in the ACL And so the script appears on the screen: http://img35.imageshack.us/img35/2357/m ... 175900.png http://img444.imageshack.us/img444/7319 ... 181012.png
  10. does not work if - line: 17-23 local g_Root = getRootElement() local screenWidth, screenHeight = guiGetScreenSize() local g_Me = getLocalPlayer() local barLevelTable = { "80000", "50000", "38000", "31000", "25000", "20000", "16000", "13000", "11000", "9200", "7500", "6000", "4700", "3500", "2500", "1600", "800", "400", "200", "100", "50", "10" } --Level bar function createBarLevelNext () dxDrawImage( 10, 200, 20, 360, "border.png" ) dxDrawRectangle( 12, 202, 18, 356, tocolor ( 0, 0, 0, 150 ) ) end function hideBarLevelNext () removeEventHandler("onClientRender",g_Root, createBarLevelNext) end function playerShowBarLevelNext (timeAfterDelay) local pointsInScriptStats = getElementData (g_Me, 'points.scriptStats') for iShowBarLN, theNextLevelIs in ipairs(barLevelTable) do if pointsInScriptStats > theNextLevelIs then calkowitaWysokoscNextLevelBar = barLevelTable[iShowBarLN] liczbaJuzPosiadanychPunktow = pointsInScriptStats break outputConsole( "playerShowBarLevelNext () ipairs / for - theNextLevelIs: " ..theNextLevelIs) outputConsole( "playerShowBarLevelNext () ipairs / for - pointsInScriptStats: " ..pointsInScriptStats) end outputConsole( "playerShowBarLevelNext () ipairs - theNextLevelIs: " ..theNextLevelIs) outputConsole( "playerShowBarLevelNext () ipairs - barLevelTable[iShowBarLN]" ..barLevelTable[iShowBarLN]) outputConsole( "playerShowBarLevelNext () ipairs - iShowBarLN" ..iShowBarLN) end addEventHandler("onClientRender", g_Root, createBarLevelNext) timerSBLN = setTimer (hideBarLevelNext, timeAfterDelay, 1) end addEvent( "onPlayerShowBarLevelNext", true ) addEventHandler( "onPlayerShowBarLevelNext", g_Root, playerShowBarLevelNext ) --Koniec
  11. there are no errors, but it does not work ... executes all lines other than the addition to the team ... function teamsloginhandleDopetla() for iTL,the_playerTL in ipairs(getElementsByType('player')) do teamsloginhandlePlayerJoin(the_playerTL) outputConsole( "teamsloginhandleDopetla() ipairs" ) end end function teamsloginhandlePlayerJoin(the_playerTHPJ) local teamsLoginPlayerName = getPlayerName(the_playerTHPJ) if teamsLoginPlayerName == "[2RT]acp___(PL)" then setPlayerTeam ( the_playerTHPJ, teamlist[4] ) outputConsole ( "teamslogin.handlePlayerJoin - " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]DeTeR.PL" then setPlayerTeam ( the_playerTHPJ, teamlist[7] ) outputConsole ( "teamslogin.handlePlayerJoin - " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]Wojak[PL]" then setPlayerTeam ( the_playerTHPJ, teamlist[5] ) outputConsole ( "teamslogin.handlePlayerJoin - " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "[2RT]Spazz" or teamsLoginPlayerName == "[2RT]Stroow" then setPlayerTeam ( the_playerTHPJ, teamlist[6] ) outputConsole ( "teamslogin.handlePlayerJoin - " ..teamsLoginPlayerName ) elseif teamsLoginPlayerName == "enter" or teamsLoginPlayerName == "[2RT]macwiek" then setPlayerTeam ( the_playerTHPJ, teamlist[8] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]macwiek" ..teamsLoginPlayerName ) end outputConsole( "teamslogin.handlePlayerJoin" ) end addEvent('onMapStarting') addEventHandler('onMapStarting', getRootElement() , teamsloginhandleDopetla) addEventHandler('onResourceStart', getRootElement(), function() teamlist = {} teamlist[1] = createTeam ( "White", 255, 255, 255 ) teamlist[2] = createTeam ( "Gray", 129, 129, 129 ) teamlist[3] = createTeam ( "Black", 0, 0, 0 ) teamlist[4] = createTeam ( "2paq Drivers", 0, 0, 255 ) teamlist[5] = createTeam ( "Wojak Team", 153, 150, 26 ) teamlist[6] = createTeam ( "S&S bRoTHErS", 0, 255, 0 ) teamlist[7] = createTeam ( "DeTeR Team", 255, 255, 0 ) teamlist[8] = createTeam ( "MYsieZIMYnieBOIMY", 64, 0, 128 ) teamlist[9] = createTeam ( "Alkaida Team", 255, 140, 0 ) end ) addEventHandler('onResourceStop', getRootElement(), function() teamlist = nil end )
  12. acp___(PL)

    GPS

    already forgot about this topic: P text would not appear, enough to add it and it's working:) edit in line: 15, 16, 17 dxDrawText( "High: " ..myHigh, 5, screenHeight - 170, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown") dxDrawText( "Dist high: " ..distHigh, 5, screenHeight - 200, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown") dxDrawText( "Distance: " ..distance, 5, screenHeight - 230, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" Now I have to do arrows indicating how to display the direction to the cp ...
  13. I use outputchatbox and the more I do not understand why there is only one timer setTimer (giveBonusForTime, 10000, 0, source, giveBonusForTime10points) 5-6 times (2 points) setTimer (giveBonusForTime, 20050, 0, source, giveBonusForTime20points) 2-3 times (5 points) setTimer (giveBonusForTime, 30100, 0, source, giveBonusForTime30points) 1 times (15 points) setTimer (giveBonusForTime, 45000, 0, source, giveBonusForTime45points) 1 times (25 points) sum 9-11 times (on print screen only 8 times and all with 2 points ...) when it comes to about 'onPlayerReachCheckpoint' to be funnily I don't delate my line of thinking as I ran into the problem I use this function in another script, and I know that the source is ok because there does At the beginning of the script defines a table: local pointsCPzliczacz = {} In line 6: pointsCPzliczacz[namePlayerpointsCPzliczacz] = 0 set int :idea: working solution function remeberNumberPlayersInStartTimer() local playersListpointsCPzliczacz = getElementsByType('player') for kPlayerLpCPzl,playerpointsCPzliczacz in ipairs(playersListpointsCPzliczacz) do local namePlayerpointsCPzliczacz = getPlayerName ( playerpointsCPzliczacz ) pointsCPzliczacz[namePlayerpointsCPzliczacz] = 0 outputConsole("ipairs(playersListpointsCPzliczacz)" ..namePlayerpointsCPzliczacz.. "-->" ..pointsCPzliczacz[namePlayerpointsCPzliczacz]) end end function playerJoinSetTimerBonus() local namePlayerJSTB = getPlayerName ( source ) pointsCPzliczacz[namePlayerJSTB] = 0 end addEventHandler('onPlayerJoin', g_Root , playerJoinSetTimerBonus) EDIT: I know that the problem with the indexing table, but I do not know how to do it properly in the wiki about it is not as well developed Error in line: 9 function remeberNumberPlayersInStartTimer() local playersListpointsCPzliczacz = getElementsByType('player') for kPlayerLpCPzl,playerpointsCPzliczacz in ipairs(playersListpointsCPzliczacz) do local namePlayerpointsCPzliczacz = getPlayerName ( playerpointsCPzliczacz ) local playerRaceCPzliczacz = executeSQLSelect( "stats_points", "player_race", "player_nick='"..namePlayerpointsCPzliczacz.."'" ) if ( type( playerRaceCPzliczacz ) == "table" and #playerRaceCPzliczacz == 0 ) or not playerRaceCPzliczacz then outputConsole("remeberNumberPlayersInStartTimer() - if ( type( playerRaceCPzliczacz ) == table and #playerRaceCPzliczacz == 0 ) or not playerRaceCPzliczacz") elseif ( type( playerRaceCPzliczacz ) == "table" and playerRaceCPzliczacz[1]['player_race'] > 0 ) then pointsCPzliczacz[1][namePlayerpointsCPzliczacz] = 0 pointsCPzliczacz[2][namePlayerpointsCPzliczacz] = 0 pointsCPzliczacz[3][namePlayerpointsCPzliczacz] = 0 pointsCPzliczacz[4][namePlayerpointsCPzliczacz] = 0 pointsCPzliczacz[5][namePlayerpointsCPzliczacz] = 0 pointsCPzliczacz[6][namePlayerpointsCPzliczacz] = 0 outputConsole("ipairs(playersListpointsCPzliczacz)" ..namePlayerpointsCPzliczacz.. "-->" ..pointsCPzliczacz[namePlayerpointsCPzliczacz]) end end setTimer(remeberNumberPlayersInStart, 3000, 15) end Error in line: 11 function playerJoinSetTimerBonus() local namePlayerJSTB = getPlayerName ( source ) local playerRaceJSTB = executeSQLSelect( "stats_points", "player_race", "player_nick='"..namePlayerJSTB.."'" ) if ( type( playerRaceJSTB ) == "table" and #playerRaceJSTB == 0 ) or not playerRaceJSTB then outputConsole("playerJoinSetTimerBonus() - if ( type( playerRaceJSTB ) == table and #playerRaceJSTB == 0 ) or not playerRaceJSTB") elseif ( type( playerRaceJSTB ) == "table" and playerRaceJSTB[1]['player_race'] > 0 ) then local giveBonusForTime10points = 2 local giveBonusForTime20points = 5 local giveBonusForTime30points = 15 local giveBonusForTime45points = 25 timerBonus[1][namePlayerJSTB] = setTimer (giveBonusForTime, 10000, 0, source, giveBonusForTime10points) timerBonus[2][namePlayerJSTB] = setTimer (giveBonusForTime, 20050, 0, source, giveBonusForTime20points) timerBonus[3][namePlayerJSTB] = setTimer (giveBonusForTime, 30100, 0, source, giveBonusForTime30points) timerBonus[4][namePlayerJSTB] = setTimer (giveBonusForTime, 45000, 0, source, giveBonusForTime45points) outputConsole("playerJoinSetTimerBonus()" ..namePlayerJSTB.. "-->" ..pointsCPzliczacz[namePlayerJSTB]) end end addEventHandler('onPlayerJoin', g_Root , playerJoinSetTimerBonus) EDIT2: I found the solution: http://www.lua.org/pil/11.2.html
  14. attention to the previous problem I used a local variable in the wrong place, suggested to me that a friend from the server, edited the previous post and added this information a new problem error in line 16 local g_Root = getRootElement() local pointsCPzliczacz = {} function remeberNumberPlayersInStartTimer() local namePlayerpointsCPzliczacz = getPlayerName ( source ) pointsCPzliczacz[namePlayerpointsCPzliczacz] = 0 end addEvent('onMapStarting') addEventHandler('onMapStarting', g_Root , remeberNumberPlayersInStartTimer) addEvent('onPlayerReachCheckpoint') addEventHandler('onPlayerReachCheckpoint', g_Root, function () local namePlayerpointsCPzliczacz = getPlayerName ( source ) pointsCPzliczacz[namePlayerpointsCPzliczacz] = pointsCPzliczacz[namePlayerpointsCPzliczacz] + 1 outputConsole("Function: onPlayerReachCheckpoint - zliczacz=" ..pointsCPzliczacz[namePlayerpointsCPzliczacz]) end ) Edit: on print screen line 92 = 6 on code on print screen line 113 = 27 on code on print screen line 114 = 28 on code local timerBonus = {} function playerQuitResetRace () local namePlayerQRR = getPlayerName ( source ) if players_count_5races[namePlayerQRR] then players_count_5races[namePlayerQRR] = nil end if pointsCPzliczacz[namePlayerQRR] then pointsCPzliczacz[namePlayerQRR] = nil end if timerBonus[1][namePlayerQRR] then killTimer(timerBonus[1][namePlayerQRR]) end if timerBonus[2][namePlayerQRR] then killTimer(timerBonus[2][namePlayerQRR]) end if timerBonus[3][namePlayerQRR] then killTimer(timerBonus[3][namePlayerQRR]) end if timerBonus[4][namePlayerQRR] then killTimer(timerBonus[4][namePlayerQRR]) end end addEventHandler('onPlayerQuit', g_Root , playerQuitResetRace) function playerJoinSetTimerBonus() local namePlayerJSTB = getPlayerName ( source ) local giveBonusForTime10points = 2 local giveBonusForTime20points = 5 local giveBonusForTime30points = 15 local giveBonusForTime45points = 25 timerBonus[1][namePlayerJSTB] = setTimer (giveBonusForTime, 10000, 0, source, giveBonusForTime10points) timerBonus[2][namePlayerJSTB] = setTimer (giveBonusForTime, 20050, 0, source, giveBonusForTime20points) timerBonus[3][namePlayerJSTB] = setTimer (giveBonusForTime, 30100, 0, source, giveBonusForTime30points) timerBonus[4][namePlayerJSTB] = setTimer (giveBonusForTime, 45000, 0, source, giveBonusForTime45points) end addEventHandler('onPlayerJoin', g_Root , playerJoinSetTimerBonus) function giveBonusForTime(the_source, bonusPointsForTime) local namePlayergiveBonusForTime = getPlayerName ( the_source ) outputConsole("Function: giveBonusForTime10; nick: " ..namePlayergiveBonusForTime.. "; points: " ..bonusPointsForTime) end
  15. I want to write to DB (line 18): function stats_endRace (stats_rank) local namePlayerSR = getPlayerName ( source ) local playerRaceSR = executeSQLSelect( "stats_points", "player_race", "player_nick='"..namePlayerSR.."'" ) if not playerRaceSR then elseif ( type( playerRaceSR ) == "table" and #playerRaceSR == 0 ) then if not players_count_5races[namePlayerSR] then players_count_5races[namePlayerSR] = 0 setElementData (source, 'numberRaceToBeRanktext', players_count_5races[namePlayerSR]) triggerClientEvent ( source, "onPlayerShowTextInfoTobeRank", g_Root ) triggerClientEvent ( source, "onPlayerShowCountRaceNo", g_Root ) elseif players_count_5races[namePlayerSR] < 5 then players_count_5races[namePlayerSR] = players_count_5races[namePlayerSR] + 1 setElementData (source, 'numberRaceToBeRanktext', players_count_5races[namePlayerSR]) elseif players_count_5races[namePlayerSR] == 5 then players_count_5races[namePlayerSR] = nil triggerClientEvent ( source, "onPlayerHideCountRaceNo", g_Root ) if stats_rank == 1 then local winsSRtoDB = 1 else local winsSRtoDB = 0 end executeSQLInsert ("stats_points", "'"..namePlayerSR.."','1','"..winsSRtoDB.."','0'") end else end end in this part of the script corresponds to the line 18 EDIT: local winsSRtoDB = 0 if stats_rank == 1 then winsSRtoDB = 1 end executeSQLInsert ("stats_points", "'"..namePlayerSR.."','1','"..winsSRtoDB.."','0'")
  16. When I enter the server, doesn't log me into the team, but changes the color of the color of my team if I add manually, t the next race throws me out of the team I tried, spawnPlayer() but were similar problems funny is that, a colleague also is try do that and we can not come to anything meaningful teamslogin = {} teamslogin.__index = teamslogin addEventHandler('onResourceStart', getRootElement(), function() teamslogin.startup() for i,player in ipairs(getElementsByType('player')) do teamslogin.handlePlayerJoin(player) outputConsole( "onResourceStart ipairs" ) end end ) function teamslogin.handlePlayerJoin(player) if getPlayerName(player) == "[2RT]acp___(PL)" then setPlayerTeam ( player, teamlist[4] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]acp___(PL)" ) elseif getPlayerName(player) == "[2RT]DeTeR.PL" then setPlayerTeam ( player, teamlist[7] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]DeTeR.PL" ) elseif getPlayerName(player) == "[2RT]Wojak[PL]" then setPlayerTeam ( player, teamlist[5] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]Wojak[PL]" ) elseif getPlayerName(player) == "[2RT]Spazz" or getPlayerName(player) == "[2RT]Stroow" then setPlayerTeam ( player, teamlist[6] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]Spazz" ) elseif getPlayerName(player) == "enter" or getPlayerName(player) == "[2RT]macwiek" then setPlayerTeam ( player, teamlist[8] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]macwiek" ) end outputConsole( "teamslogin.handlePlayerJoin" ) end addEventHandler('onPlayerJoin', getRootElement(), teamslogin.handlePlayerJoin) addEventHandler('onResourceStop', getRootElement(), function() teamlist = nil end ) function teamslogin.startup() teamlist = {} teamlist[1] = createTeam ( "White", 255, 255, 255 ) teamlist[2] = createTeam ( "Gray", 129, 129, 129 ) teamlist[3] = createTeam ( "Black", 0, 0, 0 ) teamlist[4] = createTeam ( "2paq Drivers", 0, 0, 255 ) teamlist[5] = createTeam ( "Wojak Team", 153, 150, 26 ) teamlist[6] = createTeam ( "S&S bRoTHErS", 0, 255, 0 ) teamlist[7] = createTeam ( "DeTeR Team", 255, 255, 0 ) teamlist[8] = createTeam ( "MYsieZIMYnieBOIMY", 64, 0, 128 ) teamlist[9] = createTeam ( "Alkaida Team", 255, 140, 0 ) end
  17. t is very annoying that such a simple script that I do not want to work ... : ( teamslogin = {} teamslogin.__index = teamslogin -- Events addEventHandler('onResourceStart', getRootElement(), function() teamslogin.startup() for i,player in ipairs(getElementsByType('player')) do teamslogin.handlePlayerJoin(player) outputConsole( "onResourceStart ipairs" ) end end ) addEventHandler('onPlayerJoin', getRootElement(), teamslogin.handlePlayerJoin) addEventHandler('onResourceStop', getRootElement(), function() teamlist = nil end ) -- Startup function teamslogin.startup() teamlist = {} teamlist[1] = createTeam ( "White", 255, 255, 255 ) teamlist[2] = createTeam ( "Gray", 129, 129, 129 ) teamlist[3] = createTeam ( "Black", 0, 0, 0 ) teamlist[4] = createTeam ( "2paq Drivers", 0, 0, 255 ) teamlist[5] = createTeam ( "Wojak Team", 153, 150, 26 ) teamlist[6] = createTeam ( "S&S bRoTHEr", 0, 255, 0 ) teamlist[7] = createTeam ( "DeTeR Team", 255, 255, 0 ) teamlist[8] = createTeam ( "MYsieZIMYnieBOIMY", 64, 0, 128 ) teamlist[9] = createTeam ( "Alkaida Team", 255, 140, 0 ) end -- Players function teamslogin.handlePlayerJoin(player) if getPlayerName(player) == "[2RT]acp___(PL)" then setPlayerTeam ( player, teamlist[4] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]acp___(PL)" ) elseif getPlayerName(player) == "[2RT]DeTeR.PL" then setPlayerTeam ( player, teamlist[7] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]DeTeR.PL" ) elseif getPlayerName(player) == "[2RT]Wojak[PL]" then setPlayerTeam ( player, teamlist[5] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]Wojak[PL]" ) elseif getPlayerName(player) == "[2RT]Spazz" or getPlayerName(player) == "[2RT]Stroow" then setPlayerTeam ( player, teamlist[6] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]Spazz" ) elseif getPlayerName(player) == "enter" or getPlayerName(player) == "[2RT]macwiek" then setPlayerTeam ( player, teamlist[8] ) outputConsole ( "teamslogin.handlePlayerJoin - [2RT]macwiek" ) end outputConsole( "teamslogin.handlePlayerJoin" ) end wants to on player join to server immediately added to the selected team
  18. acp___(PL)

    GPS

    work only one thing: outputChatBox ( "Cp number: " ..ncp, source, 0, 255, 0, 255 ) 22-35 in gps_s.lua I added just because I wanted to check if the in chat box will appear gps_s.lua g_rot = getRootElement() addEvent('onPlayerReachCheckpoint') addEventHandler('onPlayerReachCheckpoint', g_rot, function (checkpoint) local ncp = checkpoint + 1 setElementData (source, 'next.checkpoint', ncp) outputChatBox ( "Cp number: " ..ncp, source, 0, 255, 0, 255 ) triggerClientEvent ( source, "ClientGPStest", g_rot ) end ) gps_s.lua local gMe = getLocalPlayer() local screenWidth, screenHeight = guiGetScreenSize() g_rot = getRootElement() function createGPS() local myX, meY, myHigh = getElementPosition(gMe) local cps = getElementData(gMe, 'next.checkpoint') if not cps then local cps = 1 end local cpX, cpY, cpHigh = getElementPosition(getElementsByType('checkpoint') [cps]) local distHigh = myHigh - cpHigh local distance = getDistanceBetweenPoints3D(myX, meY, myHigh, cpX, cpY, cpHigh) dxDrawText( "TEST GPS", 5, screenHeight - 140, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown") dxDrawText( myHigh, 5, screenHeight - 170, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown") dxDrawText( distHigh, 5, screenHeight - 200, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1, "pricedown") dxDrawText( distance, 5, screenHeight - 230, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "pricedown") end addEventHandler("onClientResourceStart", g_rot, addEventHandler ('onClientRender', g-rot, createGPS) ) function createGPStextCP () local myX, meY, myHigh = getElementPosition(gMe) local cps = getElementData(gMe, 'next.checkpoint') if not cps then local cps = 1 end local cpX, cpY, cpHigh = getElementPosition(getElementsByType('checkpoint') [cps]) local distHigh = myHigh - cpHigh local distance = getDistanceBetweenPoints3D(myX, meY, myHigh, cpX, cpY, cpHigh) outputChatBox ( "High: " ..distHigh, 0, 0, 255, 255 ) outputChatBox ( "Distance: " ..distance, 0, 0, 255, 255 ) end addEvent ('ClientGPStest') addEventHandler ('ClientGPStest', g-rot, createGPStextCP)
  19. I want to forbid the use of such nicknames, but to test I asked people began change they nicknames at the same time to banned and then if two people have changed nicks to the forbidden, then the one player changed to correct, it disappeared them both a warning
  20. With your help almost finished the script >>> Client side finished <<< everything works, until more then one player begin to change the nicknames on banned How to assign a variable or a timer to player >>>Server side<<<? Or maybe do it differently? player_server.lua g_Root = getRootElement() forbidenListOfNicks = { 'fuck' , 'player' , 'huj' , 'kurwa' , 'dupa' , 'pizda' , 'cipa' , 'skurw' , 'kutas' , 'jebac' } function signalFromTimer (the_source ) triggerClientEvent ( the_source, "onPlayer_instruktion", g_Root ) end function signalFromTimer2 (the_source ) triggerClientEvent ( the_source, "onPlayer_instruktion2", g_Root ) end function signalFromTimer3 (the_source ) triggerClientEvent ( the_source, "onPlayer_instruktion3", g_Root ) end function signalInformationChat ( the_source ) outputChatBox ( "To remove the warning text from the screen and hide black strips change nickname!" , the_source, 0, 255, 0, 255 ) end function signalInformationKick ( the_source ) outputChatBox ( "You have 60 seconds to change the nickname, or you will be kicked!" , the_source, 255, 255, 0, 255 ) end function signalToKick ( the_source ) kickPlayer(the_source, "Despite warnings not changed nick!") end function forbidenPlayer () local joinedPlayerName = getPlayerName ( source ) for forbidenNickKeyFinder, forbidenNickFinded in ipairs(forbidenListOfNicks) do newNickFinder, newNickFinderEnd = string.find(string.lower(joinedPlayerName), forbidenNickFinded) outputChatBox ( "TESTjoin: key=" ..forbidenNickKeyFinder.. " forbiden=" ..forbidenNickFinded ) if newNickFinder then break end end if newNickFinder then setTimer ( signalFromTimer, 30*1000, 1, source ) setTimer ( signalFromTimer2, 45*1000, 1, source ) setTimer ( signalFromTimer3, 60*1000, 1, source ) setTimer ( signalInformationChat, 20*1000, 3, source) setTimer ( signalInformationKick, 80*1000, 1, source) setTimer ( signalToKick, 100*1000, 1, source) newNickFinderOCB = string.sub(joinedPlayerName, newNickFinder, newNickFinderEnd) outputChatBox ( "This part of nick is forbiden: " ..newNickFinderOCB ) end end addEventHandler ( "onPlayerJoin", g_Root, forbidenPlayer ) function forbidenChangePlayer (oldForNick, newForNick) for forbidenNickKeyFinder, forbidenNickFinded in ipairs(forbidenListOfNicks) do newNickFinder, newNickFinderEnd = string.find(string.lower(newForNick), forbidenNickFinded) oldNickFinder = string.find(string.lower(oldForNick), forbidenNickFinded) outputChatBox ( "TESTchange: key=" ..forbidenNickKeyFinder.. " forbiden=" ..forbidenNickFinded ) if newNickFinder or oldNickFinder then break end end if newNickFinder and oldNickFinder then newNickFinderOCB = string.sub(newForNick, newNickFinder, newNickFinderEnd) outputChatBox ( "This part of nick is forbiden NO: " ..newNickFinderOCB ) elseif newNickFinder then setTimer ( signalFromTimer, 30*1000, 1, source ) setTimer ( signalFromTimer2, 45*1000, 1, source ) setTimer ( signalFromTimer3, 60*1000, 1, source ) setTimer ( signalInformationChat, 20*1000, 3, source) setTimer ( signalInformationKick, 80*1000, 1, source) setTimer ( signalToKick, 100*1000, 1, source) newNickFinderOCB = string.sub(newForNick, newNickFinder, newNickFinderEnd) outputChatBox ( "This part of nick is forbiden N: " ..newNickFinderOCB ) elseif oldNickFinder then outputChatBox ( "test O" ) triggerClientEvent ( "onPlayer_hide_instruktion", g_Root ) timersFN = getTimers ( ) for timerKeyFN, timerValueFN in ipairs(timersFN) do killTimer ( timerValueFN ) end end end addEventHandler ( "onPlayerChangeNick", g_Root, forbidenChangePlayer ) function forbidenQuitPlayer() timersFN = getTimers ( ) for timerKeyFN, timerValueFN in ipairs(timersFN) do killTimer ( timerValueFN ) end end addEventHandler ( "onPlayerQuit", g_Root, forbidenQuitPlayer ) player_client.lua g_Root = getRootElement() local screenWidth, screenHeight = guiGetScreenSize() function createText () local forbiden_nick = getPlayerName(getLocalPlayer()) dxDrawText( forbiden_nick.. " change nick!", 10, 10, screenWidth-10, screenHeight-10, tocolor ( 255, 0, 0, 255 ), 1, "pricedown", "center", "center") end function createText2 () local forbiden_nick = getPlayerName(getLocalPlayer()) dxDrawText( "You are using a >>>" ..forbiden_nick.. "<<< nickname which is forbidden!", 10, 60, screenWidth-10, screenHeight-10, tocolor ( 0, 255, 0, 255 ), 2, "default", "center", "center") dxDrawText( "Change the nickname! You can change your nick in settings! <Esc> --> <settings>", 10, 150, screenWidth-10, screenHeight-10, tocolor ( 0, 0, 255, 255 ), 2, "default", "center", "center") end function createText3 () if k_zam_playFN > 6 then zamazywacz_ekrFN = "|" ..zamazywacz_ekrFN zamazywacz_ekrFN2 = "||" ..zamazywacz_ekrFN2 zamazywacz_ekrFN3 = "||||" ..zamazywacz_ekrFN3 k_zam_playFN = 0 else k_zam_playFN = k_zam_playFN +1 end dxDrawText( zamazywacz_ekrFN , 1, 1, screenWidth-1, screenHeight-1, tocolor ( 0, 0, 0, 255 ), 3, "pricedown", "center", "top", false, true) dxDrawText( zamazywacz_ekrFN2 , 1, 1, screenWidth-1, screenHeight-1, tocolor ( 0, 0, 0, 255 ), 2, "pricedown", "center", "top", false, true) dxDrawText( zamazywacz_ekrFN3 , 1, 1, screenWidth-1, screenHeight-1, tocolor ( 0, 0, 0, 255 ), 1, "pricedown", "center", "top", false, true) end function instruktionToPlayer () addEventHandler("onClientRender",g_Root, createText) end function instruktionToPlayer2 () addEventHandler("onClientRender",g_Root, createText2) end function instruktionToPlayer3 () k_zam_playFN = 0 zamazywacz_ekrFN = "|" zamazywacz_ekrFN2 = "||" zamazywacz_ekrFN3 = "||||" addEventHandler("onClientRender",g_Root, createText3) end function hideInstruktionToPlayer () removeEventHandler("onClientRender",g_Root, createText) removeEventHandler("onClientRender",g_Root, createText2) removeEventHandler("onClientRender",g_Root, createText3) end addEvent( "onPlayer_instruktion", true ) addEventHandler( "onPlayer_instruktion", g_Root, instruktionToPlayer ) addEvent( "onPlayer_instruktion2", true ) addEventHandler( "onPlayer_instruktion2", g_Root, instruktionToPlayer2 ) addEvent( "onPlayer_instruktion3", true ) addEventHandler( "onPlayer_instruktion3", g_Root, instruktionToPlayer3 ) addEvent( "onPlayer_hide_instruktion", true ) addEventHandler( "onPlayer_hide_instruktion", g_Root, hideInstruktionToPlayer )
  21. I start work on a script that allows players to collect points. I started from help but this is because to have some sort of algorithm of but will also describe what I wants to achieve an effect SCORING AND RANK SYSTEM To be able to score points and have own rank you must had completed 5 races on the server. All 5 races must be completed without disconnecting from the server! ###################################################################################################################### COMMANDS: /showpoints - show how many you should collect points to the next title /showrank - show grafic bar how much you should collect points to the next title /bonus - show how many race / wins to benefit from the bonus scoring ###################################################################################################################### POINTS Points gained in the race depends on the position at which you finish the race and the number of players on the server For more then eight players: 1. first place - 25 2. second place - 20 3. third place - 15 4. fourth place - 12 5. fifth place - 10 6. sixth place - 8 7. seventh place - 7 8. eighth place - 6 9. ninth place - 5 10. tenth place - 4 11. eleventh place - 3 12. twelfth place - 2 other places - 1 For more then three players and less then eight: 1. first place - 20 2. second place - 15 3. Third place - 10 4. fourth place - 8 5. fifth place - 6 6. sixth place - 4 7. seventh place - 2 For one to three players: 1. first place - 15 2. second place - 10 3. Third place - 5 If you play alone you earn for finish race - 5 points ###################################################################################################################### BONUS POINTS After you end 40 race (5 race to by rank not included): - for every 10 checkpoints points you earn 1 points in one race - for every 20 checkpoints points you earn 2 points in one race - for every 50 checkpoints points you earn 5 points in one race - for every 100 checkpoints points you earn 15 points in one race - for every 200 checkpoints points you earn 30 points in one race - for every 240 checkpoints points you earn 40 points in one race For example, in the map of the 255 cp earn additional collected points: 255/10 = 25points 255/20 = 12*2 = 24points 255/50 = 5*5 = 25points 255/100 = 2*15 = 30points 255/200 = 1*30 = 30points 255/240 = 1*40 = 40points 25 + 24 + 25 + 30 + 30 + 40 = 120 points!!! After you end 30 win (5 race to by rank not included): - for each 10 minutes of play you earn 2 points - for each 20 minutes of play you earn 5 points - for each 30 minutes of play you earn 15 points - for each 45 minutes of play you earn 25 points For example, if you play 51 minutes, earn additional collected points: 51/10 = 5*2 = 10 points 51/20 = 2*5 = 10 points 51/30 = 1*15 = 15 points 51/45 = 1*20 = 25 points 10 + 10 + 15 + 25 = 60 points!!! From the start, I am aware that I have somewhere to save the points allocated to players, best to use the database ... and the first problem I'm not sure whether I good understand about creating a table, in the case of the existing reading: function createSQLStatsPoints () executeSQLCreateTable ( "stats_points", "player_nick TEXT, player_race INTEGER, player_wins INTEGER, player_points INTEGER," ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createSQLStatsPoints ) And did I understand that the tables I could save up to registry.db using: executeSQLDropTable
  22. thank you very much for your help now everything works as I wanted but the console reports a warning I attach this part of the script if someone will need use this col_blip = createColSphere ( -84.0570, -2765.6428, 69.9104, 500) function create_blip (pla) createBlip ( -307.2204, -2752.5786, 70.8629, 47, 1, pla ) createBlip ( -310.3098, -2857.3950, 41.0316, 47, 1, pla ) createBlip ( -76.7017, -2877.6662, 38.5667, 47, 1, pla ) createBlip ( 54.8855, -2651.9997, 39.4814, 47, 1, pla ) createBlip ( -50.3280, -2481.7639, 35.7425, 47, 1, pla ) createBlip ( -64.4422, -2580.7946, 70.466, 47, 1, pla ) createBlip ( -62.2048, -2740.3339, 73.025, 47, 1, pla ) end addEventHandler ( "onColShapeHit", col_blip, create_blip ) function destroy_blip (pla) local blipsZ = getElementsByType( "blip" ) for i,elemetZ in ipairs(blipsZ) do if getBlipIcon(elemetZ) == 47 then destroyElement(elemetZ) end end end addEventHandler ( "onColShapeLeave", col_blip, destroy_blip )
  23. I read about this, but they write that these are optional parameters ... Now everything works like I wanted, but I do not know yet how to do that this text has disappeared when the "Player" change nickname to another I means, how to stop his "rendering" on-screen
  24. May not be using the proposed feature ... This should probably act, but I do not know why it does not want to ... function destroy_blip (pla) local blipsZ = getElementsByType( "blip" ) for i,elemetZ in ipairs(blipsZ) do if getElementID(elemetZ) == 47 then destroyElement(elemetZ) end end end addEventHandler ( "onColShapeLeave", col_blip, destroy_blip )
  25. the first function: as I enter into a certain area there are Blips the second function: I wont to remove this blips Blips are visible only to the person in the zone!
×
×
  • Create New...