Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. https://wiki.multitheftauto.com/wiki/OnPlayerModInfo ? You mean if palyer replace some skins or vehicle or etc ? If yes it is.
  2. Kenix

    Login GUI

    addEvent( "submitLogin",true ) function loginHandler( username,password ) local account = getAccount ( username, password ) if account then logIn ( source, account, password ) outputChatBox("Nie si registrovany? Stlac F8 a napis register MENO HESLO.", source ) else outputChatBox("Zle zadane Meno alebo Heslo, skus znova prosim.",source ) end end addEventHandler( "submitLogin",root,loginHandler ) Because 2 argument in function logIn is account ( element )( not string ). But you use string I did not notice.
  3. Vehicle health or player health? addCommandHandler( 'veh_health', function( ) if isPedInVehicle( localPlayer ) then local veh = getPedOccupiedVehicle( localPlayer ) if veh then outputChatBox( 'Vehicle health: ' .. tostring( math.floor( getElementHealth( veh ) ) ) ) end end end ) So it get vehicle health.( If you in vehicle ). cmd veh_health. Updated.
  4. Kenix

    Login GUI

    Server addEvent( "submitLogin",true ) function loginHandler( username,password ) local account = getAccount ( username, password ) if account ~= false then logIn ( source, username, password ) outputChatBox("Nie si registrovany? Stlac F8 a napis register MENO HESLO.", source ) else outputChatBox("Zle zadane Meno alebo Heslo, skus znova prosim.",source ) end end addEventHandler( "submitLogin",root,loginHandler ) Because you use password with logIn player .( password is not element ) You need use element for login ( source event = player ).
  5. Это пример. Комментарии прочтите.
  6. Лучше так: PlayerStats = { } --Login: PlayerStats[ source ] = { } PlayerStats[ source ] [ "Time" ] = 0 --, либо тому чему тебе надо --Quit: PlayerStats[ source ] = nil On1xS,Ты забыл создать таблицу с индексом игрока ( юзердата ). Иначе ты не сможешь обратиться к таблице ( её нет = nil ).
  7. You can create it yourself.
  8. You mean replace or change model? If change model then use this https://wiki.multitheftauto.com/wiki/OnE ... odelChange
  9. Kenix

    User Panel

    No problem. Use argument relative in function guiCreateMemo to true ( not false ). I think better "recreate" it in guieditor ( change pos ) . And for dx drawing use this functions: function dxDrawRelativeText( text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawText( tostring(text), ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( right/resolutionX )*sWidth, ( bottom/resolutionY)*sHeight, color,( sWidth/resolutionX )*scale, mixed_font, alignX, alignY, clip, wordBreak, postGUI ) end function dxDrawRelativeImage( posX, posY, width, height, mixed,rotation,rotationCenterOffsetX,rotationCenterOffsetY,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawImage ( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, mixed, rotation, rotationCenterOffsetX, rotationCenterOffsetY, color, postGUI ) end function dxDrawRelativeRectangle( posX, posY, width, height,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawRectangle( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, color, postGUI ) end In resolutionX and resolutionY change your resolution.
  10. Kenix

    User Panel

    local bState, bDraw local sMsg = [[Recent Server Updates Illegal secrets Shop stands New HUD Helpchat on F1 User Panel New exteriors/interiors Minor bug fixes Mechanic Job fixed (You can only use it inside interiors) (There's garages for this, due to non-rp)) Vehicle Color Fix, Furnite Shops added (Blue doll blip on F11) ]] local nSw,nSh = guiGetScreenSize( ) local nWindowW = 280 local nWindowH = 400 local sWindowTitle = "User Panel " local nWindowTitleHeight = 20 local nWindowTitleColor = tocolor( 255,255,255,255 ) --local windowTitleBGColor = tocolor( 0,0,0,255 ) local nWindowBGColor = tocolor( 0,0,0,205 ) local nWindowX = nSw - 250 - nWindowW local nWindowY = nSh / 2.28 - nWindowH / 2 local nRepWinWidth, nRepWinHeight = 280, 450 local nRepWinX = nSw / 1.95 - ( nRepWinWidth / 2 ) local nRepWinY = nSh / 2 - ( nRepWinHeight / 2 ) local nX = nWindowX local nY = nWindowY + nWindowTitleHeight local nH = nWindowH - nWindowTitleHeight local uRoot = guiCreateMemo( 277,185,269,214,sMsg,false ) guiSetVisible( uRoot,false ) function fPress( ) bState = not bState guiSetVisible( uRoot,bState ) showCursor ( not isCursorShowing( ) ) bDraw = not bDraw end function fDraw( ) if bDraw then local playerName = getPlayerName ( localPlayer ) local money = getPlayerMoney( localPlayer ) local ping = getPlayerPing( localPlayer ) local playerX, playerY, playerZ = getElementPosition( localPlayer ) local playerZoneName = getZoneName( playerX, playerY, playerZ ) local health = getElementHealth( localPlayer ) local armour = getPedArmor( localPlayer ) local weaponType = getPedWeapon ( localPlayer ) if weaponType then weaponType = getWeaponNameFromID( weaponType ) else weaponType = '' end --local money = getElementData( localPlayer, "bankmoney" ) dxDrawRectangle( nX,nY,nWindowW,nH,nWindowBGColor ) dxDrawLine ( nRepWinX, nRepWinY + 28, nRepWinX + nRepWinWidth, nRepWinY + 28, tocolor ( 255, 255, 255, 150 ), 1 ) dxDrawLine ( nRepWinX, nRepWinY + 81, nRepWinX + nRepWinWidth, nRepWinY + 81, tocolor ( 255, 255, 255, 150 ), 1 ) dxDrawLine ( nRepWinX, nRepWinY + 102, nRepWinX + nRepWinWidth, nRepWinY + 102, tocolor ( 255, 255, 255, 150 ), 1 ) dxDrawLine ( nRepWinX, nRepWinY + 355, nRepWinX + nRepWinWidth, nRepWinY + 355, tocolor ( 255, 255, 255, 150 ), 1 ) dxDrawText( "Location: " ..tostring( playerZoneName ),nSw/2.88, nSh/1.34, nSw, nSh,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText( "Ping: " ..tostring( ping ),nSw/1.68, nSh/6.9, nSw,nSh,tocolor(255,255,0,190),0.5,"bankgothic","left","top",false,false,false) dxDrawText( "Health: "..tostring( health ),nSw/2.88, nSh/4.85, nSw,nSh,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText( "Recent Updates & Announcements",275.0,158.0,543.0,175.0,tocolor(255,255,0,190),0.6,"pricedown","center","top",false,false,false) dxDrawText( "" ..playerName,nSw/2.85, nSh/6.9, nSw,nSh,tocolor(255,255,0,190),0.5,"bankgothic","left","top",false,false,false) dxDrawText( "Bank ".. money, nSw/2.88, nSh/4.3, nSw,nSh,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText( "Armour ".. tostring( armour ), nSw/2.88, nSh/5.6, nSw,nSh,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText( "Skin: " .. tostring( getElementModel ( localPlayer ) ) , nSw/1.78, nSh/4.85, nSw,nSh,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText( "Weapon: " .. weaponType, nSw/2, nSh/4.3, nSw,nSh,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) dxDrawText( sWindowTitle,nWindowX,nWindowY,nWindowX + nWindowW,nWindowY + nWindowTitleHeight,nWindowTitleColor,0.5,"bankgothic","left","center") local veh = getPedOccupiedVehicle( localPlayer ) if veh then local vehicle = getVehicleName( veh,localPlayer ) dxDrawText( "Vehicle Name: " ..vehicle,nSw/2.88, nSh/1.39, nSw,nSh,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false ) else dxDrawText( "Vehicle Name: None",nSw/2.88, nSh/1.39, nSw,nSh,tocolor(255,255,255,205),0.5,"bankgothic","left","top",false,false,false ) end end end bindKey( 'F7', 'down', fPress ) addEventHandler( 'onClientRender',root,fDraw ) Updated. Rewrited Don't worry about red lines it's syntax bug in forum.
  11. local el = getElementsByType( 'spawnpoint' )[ 1 ] -- 1 элемент в мапе local data = getElementData( el,'posZ' ) -- Получаем дату из элемента. Т.е 10 outputChatBox( '--> posZ = ' .. tostring( data ) ) --> posZ 10 Карта some.map <map> <spawnpoint posX = "1234" posY = "123" posZ = "10" /> <!-- Это --> <spawnpoint posX = "1234" posY = "223" posZ = "20" /> <spawnpoint posX = "1234" posY = "323" posZ = "30" /> <spawnpoint posX = "1234" posY = "423" posZ = "40" /> </map> Карту в meta.xml не забудь добавить. Ты из неё будешь выдирать всё. Ты это имел ввиду?
  12. My bad Updated again. So if condition ( true ) then loop it.
  13. Minokon,You can use emulator amx.( Resource amx ) But amx emulator not have functions for draw 3d labels /* MTA AMX compatibility layer * * Extension functions */ #if defined _amx_included #endinput #endif #define _amx_included // MTA native lua(const fn[], {Float,_}:...); native amxRegisterPawnPrototypes(const prototype[][]); native amxVersion(&Float:ver); native amxVersionString(buffer[], maxsize); native md5hash(str[], const buf[], bufsize); // Events forward OnBotConnect(botid, name[]); forward OnBotEnterVehicle(botid, vehicleid, seatid); forward OnBotExitVehicle(botid, vehicleid); forward OnBotDeath(botid, killerid, weaponid, bodypart); forward OnVehicleDamage(vehicleid, Float:loss); forward OnPlayerShootingPlayer(playerid, attackerid, bodypart, Float:loss); forward OnPlayerWeaponSwitch(playerid, previousWeaponID, currentWeaponID); forward OnPlayerShoot(playerid, weapon, ammo, ammoInClip, Float:hitX, Float:hitY, Float:hitZ); forward OnMarkerCreate(markerid); forward OnMarkerHit(markerid, elemtype[], elemid, matchingDimension); forward OnMarkerLeave(markerid, elemtype[], elemid, matchingDimension); // World native SetSkyGradient(topRed = 0, topGreen = 0, topBlue = 0, bottomRed = 0, bottomGreen = 0, bottomBlue = 0); native ResetSkyGradient(); native GetCloudsEnabled(); native SetCloudsEnabled(stateid); native IsGarageOpen(garageid); native SetGarageOpen(garageid, stateid); native IsGlitchEnabled(name[]); native SetGlitchEnabled(name[], stateid); native SetFPSLimit(fps); native GetPlayerCount(); native GetRandomPlayer(); native GetDistanceBetweenPoints2D(Float:X1, Float:Y1, Float:X2, Float:Y2); native GetDistanceBetweenPoints3D(Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2); // Water native GetWaveHeight(); native SetWaveHeight(Float:height); native SetWaterLevel(Float:level); // Pickups native GetPickupType(pickupid); native SetPickupType(pickupid, typeid, amount, ammo = 500); native GetPickupWeapon(pickupid); native GetPickupAmount(pickupid); native GetPickupAmmo(pickupid); // Native Markers native CreateMarker(Float:X, Float:Y, Float:Z, type[], Float:size, red, green, blue, alpha); native DestroyMarker(markerid); native GetMarkerColor(markerid, colorid); // Color IDs: 0 = Red, 1 = Green, 2 = Blue, 3 = Alpha native GetMarkerIcon(markerid); // 0 = No icon, 1 = Arrow, 2 = Race finish native GetMarkerSize(markerid, &Float:size); native GetMarkerTarget(markerid, &Float:X, &Float:Y, &Float:Z); native GetMarkerType(markerid); // 0 = Checkpoint, 1 = Ring, 2 = Cylinder, 3 = Arrow, 4 = Corona native SetMarkerColor(markerid, red, green, blue, alpha); native SetMarkerIcon(markerid, iconid); // 0 = No icon, 1 = Arrow, 2 = Race finish native SetMarkerSize(markerid, Float:size); native SetMarkerTarget(markerid, Float:X, Float:Y, Float:Z); native SetMarkerType(markerid, typeid); // 0 = Checkpoint, 1 = Ring, 2 = Cylinder, 3 = Arrow, 4 = Corona native IsPlayerInMarker(markerid, playerid); native IsBotInMarker(markerid, botid); native IsVehicleInMarker(markerid, vehicleid); // Rules native GetRuleValue(rule[], const buf[], bufsize); native SetRuleValue(rule[], value[]); native RemoveRuleValue(rule[]); // Objects native GetObjectAlpha(objectid); native SetObjectAlpha(objectid, alpha); // Players native AddPlayerClothes(playerid, type, index); native GetPlayerClothes(playerid, type); native RemovePlayerClothes(playerid, type); native ShowPlayerMarker(playerid, show); native IsPlayerInWater(playerid); native IsPlayerOnFire(playerid); native IsPlayerDucked(playerid); native IsPlayerOnGround(playerid); native GetPlayerFightingStyle(playerid); native SetPlayerFightingStyle(playerid, styleid); native SetPlayerOnFire(playerid, fire); native GetPlayerStat(playerid, statid); native SetPlayerStat(playerid, statid, Float:value); native GetPlayerCanBeKnockedOffBike(playerid); native SetPlayerCanBeKnockedOffBike(playerid, stateid); native GetPlayerDoingDriveBy(playerid); native SetPlayerDoingDriveBy(playerid, stateid); native SetPlayerWeaponSlot(playerid, slotid); native SetPlayerHeadless(playerid, stateid); native GetPlayerBlurLevel(playerid); native SetPlayerBlurLevel(playerid, level); native GetPlayerAlpha(playerid); native SetPlayerAlpha(playerid, alpha); native FadePlayerCamera(playerid, fadeIn, Float:timeToFade = 1.0, red = 0, green = 0, blue = 0); native GetPlayerVehicleSeat(playerid); native GetPlayerVelocity(playerid, &Float:X, &Float:Y, &Float:Z); native SetPlayerVelocity(playerid, Float:X, Float:Y, Float:Z); native SetPlayerControlState(playerid, control[], stateid); // Vehicles native GetVehicleMaxPassengers(vehicleid); native GetVehicleVelocity(vehicleid, &Float:vx, &Float:vy, &Float:vz); native SetVehicleVelocity(vehicleid, Float:vx, Float:vy, Float:vz); native SetVehicleModel(vehicleid, model); native GetVehicleEngineState(vehicleid); native SetVehicleEngineState(vehicleid, stateid); native GetVehicleDoorState(vehicleid, door); native SetVehicleDoorState(vehicleid, door, stateid); native GetVehicleLightState(vehicleid, lightid); native SetVehicleLightState(vehicleid, lightid, stateid); native GetVehicleOverrideLights(vehicleid); native SetVehicleOverrideLights(vehicleid, stateid); native GetVehicleWheelState(vehicleid, wheelid); native SetVehicleWheelState(vehicleid, frontLeft = -1, rearLeft = -1, frontRight = -1, rearRight = -1); native GetVehiclePanelState(vehicleid, panelid); native SetVehiclePanelState(vehicleid, panelid, stateid); native GetVehicleAlpha(vehicleid); native SetVehicleAlpha(vehicleid, alpha); native GetVehiclePaintjob(vehicleid); native GetVehicleComponentInSlot(vehicleid, slot); native GetVehicleSirensOn(vehicleid); native SetVehicleSirensOn(vehicleid, stateid); native IsTrainDerailable(vehicleid); native IsTrainDerailed(vehicleid); native SetTrainDerailable(vehicleid, stateid); native SetTrainDerailed(vehicleid, stateid); native GetTrainDirection(vehicleid); native SetTrainDirection(vehicleid, direction); native GetTrainSpeed(vehicleid, &Float:speed); native SetTrainSpeed(vehicleid, &Float:speed); // Bots native CreateBot(modelid, Float:x, Float:y, Float:z, name[] = "Bot"); native SetBotHealth(botid, Float:health); native GetBotHealth(botid, &Float:health); native SetBotArmour(botid, Float:armour); native GetBotArmour(botid, &Float:armour); native SetBotPos(botid, Float:X, Float:Y, Float:Z); native GetBotPos(botid, &Float:X, &Float:Y, &Float:Z); native SetBotRot(botid, Float:RotX, Float:RotY, Float:RotZ); native GetBotRot(botid, &Float:RotX, &Float:RotY, &Float:RotZ); native IsBotInWater(botid); native IsBotOnFire(botid); native IsBotDucked(botid); native IsBotOnGround(botid); native GetBotFightingStyle(botid); native SetBotFightingStyle(botid, styleid); native SetBotOnFire(botid, fire); native GetBotStat(botid, statid); native SetBotStat(botid, statid, Float:value); native GetBotState(botid); native PutBotInVehicle(botid, vehicleid, seatid); native RemoveBotFromVehicle(botid); native SetBotControlState(botid, control[], stateid); native SetBotAimTarget(botid, &Float:X, &Float:Y, &Float:Z); native GetBotDoingDriveBy(botid); native SetBotDoingDriveBy(botid, stateid); native GetBotCanBeKnockedOffBike(botid); native SetBotCanBeKnockedOffBike(botid, stateid); native SetBotWeaponSlot(botid, slotid); native SetBotHeadless(botid, stateid); native BotKill(botid); native GetBotAlpha(botid); native SetBotAlpha(botid, alpha); native GetBotName(botid, const buf[], bufsize); native GetBotVehicleSeat(botid); native GetBotVelocity(botid, &Float:X, &Float:Y, &Float:Z); native SetBotVelocity(botid, Float:X, Float:Y, Float:Z); But adamix update this: https://github.com/adamix/amx-emulator
  14. local request = executeSQLQuery( "SELECT COUNT FROM vehiculos" ) if type( request ) == 'table' and #request > 0 then for i,v in pairs( request ) do outputChatBox( "Index = '" .. tostring( i ) .. "' , Value = '" ..tostring( v ) ) end end ?
  15. cocowen,I think better create custom event like 'onClientSomeUpdate' and trigger to server if change. if you use onClientRender and trigger to server you kill server. Fps server very down ( 10-30 fps ). Traffic will be a huge.
  16. 1.You trigger to server in render oO? 2.Can you show full code client please.
  17. You can this: tTable = { value1 = { }; value2 = { }; value3 = { }; } Or this tTable = { } tTable.value1 = { } tTable.value2 = { } tTable.value3 = { } It same. You mean it? Or i not understand ..
  18. Yeah, because in event onPlayerLogin 2 argument is account ( element ) ( userdata ). So you need get name account from account ( element ) ( userdata ). addEventHandler( 'onPlayerLogin',root, function( _,account ) -- account variable is ( element ) ( userdata ). outputChatBox( 'Account Name is '..getAccountName( account ) ) -- getAccountName function return string with account name. end ) Example
  19. if ( type( itemid ) == "number" ) then You check here if your variable number. Can you show full function where you trigger event getItemDes. P.S use [lua][/lua]
  20. Kenix

    User Panel

    Learn https://wiki.multitheftauto.com/wiki/Scr ... troduction http://www.lua.org/manual/5.1/
  21. Oh i found problem. My internet shut down ( on hour ) when i did edit my post. And it changed post, not saved. Sorry Solidsnake14.( for the misunderstanding ) P.S Sometimes if you edit post it not show in moderator logs.
×
×
  • Create New...