Jump to content

SkatCh

Members
  • Posts

    365
  • Joined

  • Last visited

Everything posted by SkatCh

  1. SkatCh

    getAccountName

    nvm keep calm guys. anyways i will try it .
  2. SkatCh

    getAccountName

    yes bro me too i think it's right but i try didn't work can you fix it please: addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for i, p in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount (p) if ( getAccountName ( account ) ) then <------------- this line if ( getAccountData ( getAccountName ( p ), "vip" ) ) then setElementData ( p, "vip", true ); setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); startVip ( p ); end end end end );
  3. hi guys please i need some help here i create a vip system and i got some warinings here : just i want when i restart the resource evrey one will get his VIP status : addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () for i, p in ipairs ( getElementsByType ( "player" ) ) do if ( getAccountName ( p ) ) then <------------- this line if ( getAccountData ( getAccountName ( p ), "vip" ) ) then setElementData ( p, "vip", true ); setElementData ( p, "vip.time", tonumber ( getAccountData ( getAccountName ( p ), "vip.time" ) ) ); startVip ( p ); end end end end ); Warning : bad argument @ 'getAccountName' [expected account at argument 1 , got player]
  4. guys is there any function to convert a big number like this '10.235658946' to just two numbers '10' , i mean function like 'convertNumber'
  5. SkatCh

    Alliance

    no one will create something like that for free , you can use those function : "getTeamName" "getPlayerTeam" "onClientPlayerDamage" etc ... i will make it easy for you , example army can't kill swat. addEventHandler( "onClientPlayerDamage", root, function ( theAttacker ) if ( isElement( source ) ) and ( isElement( theAttacker ) ) then --- check if is element ... if ( getElementType(theAttacker) == "player" ) then if ( getTeamName( getPlayerTeam( theAttacker ) ) == "Army" ) and ( getTeamName( getPlayerTeam( source ) ) == "SWAT" ) then --- check teams cancelEvent() end
  6. hi guys please i need some help i'm trying to create a speed control system but i think that i have some thing wrong. just a part from my script : function speedCam( thePlayer ) local level = getPlayerWantedLevel ( thePlayer ) <--- this line local veh = getPlayerOccupiedVehicle( thePlayer ) <--- and this local fine = math.random(50,100) if (getElementSpeed(veh,"kph") > 140) and (getPlayerMoney( thePlayer ) > (fine)) then takePlayerMoney(thePlayer,fine) outputChatBox("A Speed Cam has captured you driving on "..(math.floor(getElementSpeed(veh))).."KM/H, A fine of $"..fine.." has been taken from you.(LIMIT:140KM/H)",thePlayer,255,255,255) warnings : bad argument @ 'getPlayerWantedLevel' [Expected player at argument 1, got marker] bad argument@ 'getPlayerOccupiedVehicle' [Expected ped at argument 1 , got vehicle]
  7. i already fix it i got a wraning here : local accountName = getAccountName(getPlayerAccount(source)) <---- getAccountName
  8. many things wrong in your script and didn't work anyways thx , can anyone else help me
  9. anyone can help me here ??
  10. bro i think you don't undrestand my question i will explane to you my idea , i create Table with some titles everyone can use them and now i'm thinking to create a special title for certain Players example your accountName is 'xXMADEXx' you will see a new title but other player can't see it , my script is working fine just i need to create some thing in server side to check player name because i can't use getAccountName in client side so that's why i need TriggerServerEvent did you undrestand my idea example i create this but it did work related to the first part : server function walking(AccountName, localPlayer) local accountName = getAccountName(localPlayer) if accountName then triggerClientEvent ("Special" , localPlayer, AccountName) end addEvent("On.tit", true) addEventHandler("On.tit",root,walking) client function specialTitles(accountName) guiGridListClear(grid_titles) triggerServerEvent ("On.tit",localPlayer,acountName) <------- i think that i need to put the TriggerServerEvent here to check the Account name if accountName == "xXMADEXx" then titlesTable["Pro member"] = true end end addEvent("Special", true) addEventHandler("Special", root, specialTitles)
  11. hi guys i'm doing my best to learn lua language but some time i need some help that's why i'm here i have a simple question . i create some special title for members let's say if your account name is 'xxxxxxx' you will get a special title . so i need to use getAccountName in this case i need to triggerServerEvent right . this my client side just a part from my script : function specialTitles(accountName) guiGridListClear(grid_titles) triggerServerEvent (......) <------- i think that i need to put the TriggerServerEvent here to check the Account name if accountName == "xxxxxxx" then titlesTable["xxxxxxxxx"] = true end end addEvent("Special", true) addEventHandler("Special", root, specialTitles) So my question is how can i add a function on the server side to check the player account name , sorry i'm not good enough with Trigger events , really i don't know how to use it . im sorry about my english
  12. bro i already tried it and i know that you need to add ')' in xXMADExx scrcipt in line 18 .
  13. didn't work you script can't save clothes , but xXMADEXx script is working fine i can see the same clothes when i login but when other players join i got this error bad argument @ 'addPedClothes' [Expected String at argument 2 , got boolean]
  14. check this for more information : https://wiki.multitheftauto.com/wiki/SetTime
  15. here you go you can use this simple script : addEventHandler( 'onClientRender', getRootElement( ), function( ) setTime( 22, 0 ) <----- Put time here end )
  16. For @ xXMADEXx your save script is working fine but i got some warnings when someone join the server : addEventHandler ( "onPlayerLogin", root, function ( _, account ) local clothes = getAccountData ( account, "Clothes" ) if not clothes then return end for i, v in pairs ( fromJSON ( clothes ) do local text, id = unpack ( v ) addPedClothes ( source, text, id, i ) <---- here this line end end ) bad argument @ 'addPedClothes' [Expected String at argument 2 , got boolean]
  17. no it's not local chat it's main chat just i gave an example that's all.
  18. thx bro i got many other problems and i fix them with the same method , thx again for ur help topic can be locked.
  19. hi please i need some help here i got this warning when i hit the marker : function hideAllButtonsInMainWnd( ) for i = 1, 17 do guiSetVisible( shopGUI.buttons[i], false ) <----------- this line end guiSetVisible( shopGUI.buttons[ "Paintjob" ], false ) end Bad argument @ guiSetVisible [expected gui-element at argument 1, got nil]
  20. can you tell me exactly how much i need to add or can i put it like this . local local_chat_range = 10000000000000000000
  21. thx so if i want someone to see my message from LV and he is in SF i need to increase the chat range right . like this local local_chat_range = "how much i need to put here" <----example = 50000 local sX, sY, sZ = getElementPosition(localPlayer) local rX, rY, rZ = getElementPosition(source) if (getDistanceBetweenPoints3D(sX, sY, sZ, rX, rY, rZ) <= local_chat_range) then chat = true end
  22. guys please i have a question what does it mean chat range exatly . like this local chat_range = 100
  23. ok bro i will try it please i want to ask you one more question ; i create a Gui button and i want when the player click it all his clothes will gone . i tried many function like removePedClothes , with "onClientGUIClick" but nothing happen , thank you edit: nvm i fix it
  24. hi guys pleas i need some help i want to create save system for my Cj clothes shop , because when i reconnect all clothes lost this is a part of the script . addEvent( "onChangeClothesCJ", true ) addEventHandler( "onChangeClothesCJ", root, function ( CJClothesTable, CJClothesString ) if ( CJClothesTable ) then for int, index in pairs( CJClothesTable ) do local texture, model = getClothesByTypeIndex ( int, index ) if ( texture ) then addPedClothes ( source, texture, model, int ) end end end end ) i want to use setAccountData but i don't know exactly how can i put it here .
×
×
  • Create New...