-
Posts
90 -
Joined
-
Last visited
Everything posted by SheriFF
-
Server function giveBlood( playerSource, inputCommand ) if ( isObjectInACLGroup ( "user." ..getAccountName( getPlayerAccount( thePlayer ) ), aclGetGroup ( "Admin") ) ) then if ( getElementData( playerSource, "OnDuty" ) == true ) then outputChatBox( "You are already On-Duty!", playerSource, 255, 0, 0 ) else setElementData( playerSource, "OnDuty", true ) setElementData( playerSource, "food", 95, true ) setElementData( playerSource, "thirst", 95, true ) setElementData( playerSource, "temperature", 36.5, true ) setElementData( playerSource, "currentweapon_1", false, true ) setElementData( playerSource, "currentweapon_2", false, true ) setElementData( playerSource, "currentweapon_3", false, true ) setElementData( playerSource, "bleeding", false, true ) setElementData( playerSource, "brokenbone", false, true ) setElementData( playerSource, "pain", false, true ) setElementData( playerSource, "cold", false, true ) setElementData( playerSource, "bandit", false, true ) setElementData( playerSource, "humanity", 2500, true ) setElementData( playerSource, "skin", 210, true ) end else end end addCommandHandler( "duty", giveBlood ) function bloodBack( playerSource, inputCommand ) if ( isObjectInACLGroup ( "user." ..getAccountName( getPlayerAccount( playerSource ) ), aclGetGroup ( "Admin") ) ) then setElementData( playerSource, "blood", 12000, true ) setElementData( playerSource, "OnDuty", false, true ) else --output something end end addCommandHandler( "offduty", bloodBack ) Client function playerOnDamage( attacker, weapon, bodyPart, loss ) if ( getElementType( attacker ) == "player" and getElementData( source, "OnDuty" ) == true ) then local pX, pY, pZ = getElementPosition( source ) local aX, aY, aZ = getElementPosition( attacker ) local distance = getDistanceBetweenPoints3D( pX, pY, pZ, aX, aY, aZ ) if ( distance < 50 ) then -- change the distance if you need cancelEvent( ) end end end addEventHandler( "onClientPlayerDamage", getRootElement( ), playerOnDamage ) Not tested!
-
Please try to explain better your problem/request EDIT : Not tested (Client-Sided script) function playerOnDamage( attacker, weapon, bodyPart, loss ) if ( getElementType( attacker ) == "player" ) then local pX, pY, pZ = getElementPosition( source ) local aX, aY, aZ = getElementPosition( attacker ) local distance = getDistanceBetweenPoints3D( pX, pY, pZ, aX, aY, aZ ) if ( distance < 50 ) then cancelEvent( ) end end end addEventHandler( "onClientPlayerDamage", getRootElement( ), playerOnDamage )
-
NOT TESTED! (Not sure if is gonna work ) function startRegenOnDamage( attacker, attackerWeapon, bodyPart, loss ) if ( getAccountData( getPlayerAccount( source ), "regen" ) == true ) then startRegen( source ) end end addEventHandler( "onPlayerDamage", getRootElement( ), startRegenOnDamage ) function startRegen( thePlayer ) local playerHealth = getElementHealth( thePlayer ) local timesToExecute = math.ceil( ( 100 - playerHealth ) / 5 ) setTimer( healUpThePlayer, 7000, timesToExecute, thePlayer ) end function healUpThePlayer( playerToHeal ) if ( playerToHeal and getElementType( playerToHeal ) == "player" ) then local regenAmount = 100 - getElementHealth( playerToHeal ) if ( regenAmount < 5 ) then setElementHealth( playerToHeal, 100 ) return else setElementHealth( playerToHeal, getElementHealth( playerToHeal ) + 5 ) end end end When a player gets damaged, the script will test if the player has the regen data.If yes, the script will calculate the needed times to execute healUpThePlayer function( Ex: if the player has now 75 health, the function will be executed 5 times )
-
It was my pleasure
-
function onRegenStart( ) setTimer( healthUp, 7000, 0 ) end addEventHandler( "onResourceStart", getRootElement( ), onRegenStart ) function healthUp( ) for index, value in pairs ( getElementsByType( "player" ) ) do if ( getAccountData( getPlayerAccount( value ), "regen" ) == true ) then local playerHealth = getElementHealth( value ) setElementHealth( value, playerHealth + 5 ) end end end This should work( not tested ) Please,when naming a function, use capital letters when another word starts( Ex: yourFunctionName, NOT yourfunctionname ) because it looks better and helps you understand better what does that function do.
-
The error says that AUTOINCREMENT is compatible only with INTEGER PRIMARY KEY You declared gang_cod as an INT PRIMARY KEY AUTOINCREMENT , but this type doesn't exists Replace INT with INTEGER and the script should work
-
You forgot to put a comma.In line 33 replace this : local select = dbExec(db "SELECT account FROM ganguemembers WHERE account = '" ..player.. "' " ); with this : local select = dbExec(db,"SELECT account FROM ganguemembers WHERE account = '" ..player.. "' " );
-
@Simple01,de unde ai scos tu chestia asta?Contul acesta este facut pentru ca vreau sa refac posturile si pentru ca nu-mi placea numele celui vechi.Nu stiu de ce crezi tu asta deoarece eu am postat doar subiectul asta pentru a cere ajutor si nu mi-am creat 'o identitate falsa'. @Tekken,iti multumesc frumos pentru ajutorul acordat!
-
Inainte de a raspunde ca voi uni conturile,am citit regurile forumului
-
N-am fost atent când am scris răspunsul =) Oricum,voi ruga un administrator să unească cele 2 conturi
-
Sincer,nu-mi dau seama cu ce ma ajuta asta.Am vazut ca majoritatea scripturilor de acest fel contin un fisier '.fx' .Ma descurc cu scriptingul in Lua,insa nu inteleg ce trebuie sa scriu in fisierul '.fx' .
-
Inlocuirea texturilor unui obiect Salutare,stimati romani!Am observat ca este posibila inlocuirea texturilor unui obiect fara importarea unor noi fisiere txd,dff si col folosind 'shaders'.Rugamintea mea este sa-mi explicati ,cat mai detaliat,cum se poate realiza un astfel de script.Din cate am observat,pentru realizarea inlocuirii,resursa are nevoie si de un fisier '.fx' pe care nu am habar sa-l fac si (parca) de un material pe care il creezi folosind functia dxCreateMaterial.