Lucario Posted May 15, 2013 Share Posted May 15, 2013 Hi, i im now making a police job with freeze pistol when a cop shoot a criminal, when i shoot a crim, it say, bad argument @getPlayerTeam, and if someone jail me, the timer doesnt work in the jail, and the handcuffer doesnt recieve the money, someone can help me please, part of the Code: All server side: function pistolaCong (attacker, attackerweapon, bodypart, loss) if attacker and getElementType(attacker) == "player" then theTeam2 = getPlayerTeam ( attacker ) theWL2 = getPlayerWantedLevel ( source ) theSkin2 = getElementModel ( attacker ) if (attackerweapon == 23) and (loss > 1) and (theWL2 > 0) then if getTeamName( theTeam2 ) == "Policia" or getTeamName( theTeam2 ) == "SWAT" or getTeamName( theTeam2 ) == "FBI" or getTeamName( theTeam2 ) == "Ejercito" then fadeCamera ( source, true, 2.0, 191, 191, 191 ) setTimer ( setElementFrozen, 3000, 1, source, false) end end end end addEventHandler ("onPlayerDamage", getRootElement(), pistolaCong) function trabajoPolicia ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) then if getTeamName( theTeam ) == "Policia" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Ejercito" then setElementPosition (source, 3306.1, 1195.7, 945, true) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) warnText( "Has Sido Encarcelado Por "..theCop.. ".", source ) warnText( "Has Encarcelado a "..theName, attacker ) local playeraccount = getPlayerAccount ( attacker ) oldArrest = getAccountData(playeraccount, "arrest") if oldArrest then newArrest = setAccountData(playeraccount, "arrest", tonumber(oldArrest) + 1 ) else newArrest = setAccountData(playeraccount, "arrest", 1 ) end setPlayerWantedLevel (source, 0) if ( theWL > 1 ) then setTimer ( setElementPosition, 20000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 3000 * theWL ) end if ( theWL > 2 ) then setTimer ( setElementPosition, 40000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 6000 * theWL ) end if ( theWL > 3 ) then setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 9000 * theWL ) end if ( theWL > 4 ) then setTimer ( setElementPosition, 80000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 12000 * theWL ) end if ( theWL > 5 ) then setTimer ( setElementPosition, 100000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 15000 * theWL ) end if ( theWL > 6 ) then setTimer ( setElementPosition, 120000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 18000 * theWL ) end end end end end addEventHandler ("onPlayerDamage", getRootElement(), trabajoPolicia) Link to comment
فاّرس Posted May 15, 2013 Share Posted May 15, 2013 Hmm, i'm don't know what the problem and i'm don't think it's work , but try this , if attacker and attacker ~= source and theTeam2 and getElementType(attacker) == "player" then in line 2 Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 this dont work please fix it Link to comment
فاّرس Posted May 15, 2013 Share Posted May 15, 2013 Can you tell me what do you want to do specifically? Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 Of course friend, i want to make work the cop job, when a cop hit other crim, the crim will be jailed you know, next i will put the handcuffed, but now the problem is when a cop hit a crim without stars, the crim is jailed, and the cop doesnt receive money, and i was maked too a special pistol, the silenced pistol, when a cop shoot a crim with stars with the pistol, the player will froze for 3 sec with a fadecamera, depend if a cop hit a crim with 3 stars, he receive more money than 1 star, and the crim go to the jail for more time pd: you maked double post Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 Of course friend, i want to make work the cop job, when a cop hit other crim, the crim will be jailed you know, next i will put the handcuffed, but now the problem is when a cop hit a crim without stars, the crim is jailed, and the cop doesnt receive money, and i was maked too a special pistol, the silenced pistol, when a cop shoot a crim with stars with the pistol, the player will froze for 3 sec with a fadecamera, depend if a cop hit a crim with 3 stars, he receive more money than 1 star, and the crim go to the jail for more timePd: you maked double post Edit: now you deleted it Link to comment
فاّرس Posted May 15, 2013 Share Posted May 15, 2013 Try this : function trabajoPolicia ( attacker, attackerweapon, bodypart, loss ) local theTeam = getPlayerTeam ( attacker ) local theWL = getPlayerWantedLevel ( source ) local theSkin = getElementModel ( attacker ) if ( attacker and attacker ~= source and theTeam and getTeamName( theTeam ) == "Policia" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Ejercito" ) then if (attackerweapon == 3) and (loss > 2 ) then setElementPosition (source, 3306.1, 1195.7, 945, true) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) warnText( "Has Sido Encarcelado Por "..theCop.. ".", source ) warnText( "Has Encarcelado a "..theName, attacker ) local playeraccount = getPlayerAccount ( attacker ) oldArrest = getAccountData(playeraccount, "arrest") if oldArrest then newArrest = setAccountData(playeraccount, "arrest", tonumber(oldArrest) + 1 ) else newArrest = setAccountData(playeraccount, "arrest", 1 ) end setPlayerWantedLevel (source, 0) if ( theWL > 1 ) then setTimer ( setElementPosition, 20000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 3000 * theWL ) end if ( theWL > 2 ) then setTimer ( setElementPosition, 40000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 6000 * theWL ) end if ( theWL > 3 ) then setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 9000 * theWL ) end if ( theWL > 4 ) then setTimer ( setElementPosition, 80000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 12000 * theWL ) end if ( theWL > 5 ) then setTimer ( setElementPosition, 100000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 15000 * theWL ) end if ( theWL > 6 ) then setTimer ( setElementPosition, 120000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 18000 * theWL ) end end end end addEventHandler ("onPlayerDamage", getRootElement(), trabajoPolicia) and can you tell me why you make setTimer for setElementPosition Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 for set the jail timer, then the prisoner will be free Link to comment
Moderators IIYAMA Posted May 15, 2013 Moderators Share Posted May 15, 2013 if the theWL is higher then 6 then the source(player) will be set 6 times to another locations. + 6 timers running onPlayerDamage. I don't know what the use of that is. if theWL == 1 then This script also is going to overhead your mysql lite data base.(account data) Better to store it in the ram and update it in amount of time. (you are using the event onPlayerDamage) Link to comment
Moderators IIYAMA Posted May 15, 2013 Moderators Share Posted May 15, 2013 if theWL == 1 then elseif theWL == 2 then elseif theWL == 3 then elseif theWL == 4 then elseif theWL == 5 then elseif theWL == 6 then end Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 I must begin form theWL = 0 and use else? Link to comment
Moderators IIYAMA Posted May 15, 2013 Moderators Share Posted May 15, 2013 0? is 0 wanted stars? If you want that to check then yes. (elseif) if theWL == 0 then elseif theWL == 1 then -- if [b]not[/b] theWL == 0 then ---------> elseif theWL == 1 then end Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 function policeJob ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) then if getTeamName( theTeam ) == "Policia" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Ejercito" then setElementPosition (source, 3306.1, 1195.7, 945, true) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) warnText( "Has Sido Encarcelado Por "..theCop.. ".", source ) warnText( "Has Encarcelado a "..theName, attacker ) local playeraccount = getPlayerAccount ( attacker ) oldArrest = getAccountData(playeraccount, "arrest") if oldArrest then newArrest = setAccountData(playeraccount, "arrest", tonumber(oldArrest) + 1 ) else newArrest = setAccountData(playeraccount, "arrest", 1 ) end setPlayerWantedLevel (source, 0) if theWL > 1 then setTimer ( setElementPosition, 20000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 3000 * theWL ) elseif theWL > 2 then setTimer ( setElementPosition, 40000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 6000 * theWL ) elseif theWL > 3 then setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 9000 * theWL ) elseif theWL > 4 then setTimer ( setElementPosition, 80000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 12000 * theWL ) elseif theWL > 5 then setTimer ( setElementPosition, 100000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 15000 * theWL ) elseif theWL > 6 then setTimer ( setElementPosition, 120000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 18000 * theWL ) end end end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob) Now? And can anyone say or fix the error of the pistol freeze: function freezeWeapon (attacker, attackerweapon, bodypart, loss) if attacker and attacker ~= source and theTeam2 and getElementType(attacker) == "player" then theTeam2 = getPlayerTeam ( attacker ) theWL2 = getPlayerWantedLevel ( source ) theSkin2 = getElementModel ( attacker ) if (attackerweapon == 23) and (loss > 1) and (theWL2 > 0) then if getTeamName( theTeam2 ) == "Policia" or getTeamName( theTeam2 ) == "SWAT" or getTeamName( theTeam2 ) == "FBI" or getTeamName( theTeam2 ) == "Ejercito" then fadeCamera ( source, true, 2.0, 191, 191, 191 ) setTimer ( setElementFrozen, 3000, 1, source, false) end end end end addEventHandler ("onPlayerDamage", getRootElement(), freezeWeapon) Link to comment
Moderators IIYAMA Posted May 15, 2013 Moderators Share Posted May 15, 2013 You can find the error your self. Login with admin and write /debugscript 3 You know nothing will happen when you have 1 star? if theWL > 1 then This means that is higher then 1. If the value is 1 nothing will happen, I hope you understand that. (use operator ==, means eagle) Open in notepad ++ to get a full vision of the code. local policeJobTeams = {["Policia"]=true,["SWAT"]=true,["FBI"]=true,["Ejercito"]=true} function policeJob ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then --theSkin = getElementModel ( attacker ) -- when you don't use it, mark it as diabled. if attackerweapon == 3 and loss > 2 then if policeJobTeams[getTeamName( getPlayerTeam ( attacker ) )] then setElementPosition (source, 3306.1, 1195.7, 945, true) local theName = getPlayerName ( source ) local theCop = getPlayerName ( attacker ) warnText( "Has Sido Encarcelado Por "..theCop.. ".", source ) warnText( "Has Encarcelado a "..theName, attacker ) local playeraccount = getPlayerAccount ( attacker ) local oldArrest = getAccountData(playeraccount, "arrest") local newArrest -- you haven't used this boolean, but will I let it as it is. if oldArrest then newArrest = setAccountData(playeraccount, "arrest", tonumber(oldArrest) + 1 ) else newArrest = setAccountData(playeraccount, "arrest", 1 ) end local theWL = getPlayerWantedLevel ( source ) setPlayerWantedLevel (source, 0) if theWL == 1 then setTimer ( setElementPosition, 20000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 3000 * theWL ) elseif theWL == 2 then setTimer ( setElementPosition, 40000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 6000 * theWL ) elseif theWL == 3 then setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 9000 * theWL ) elseif theWL == 4 then setTimer ( setElementPosition, 80000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 12000 * theWL ) elseif theWL == 5 then setTimer ( setElementPosition, 100000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 15000 * theWL ) elseif theWL == 6 then -- max level is 6........ setTimer ( setElementPosition, 120000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 18000 * theWL ) end end end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob) Here you unfreeze a player with a timer without any reasons. setTimer ( setElementFrozen, 3000, 1, source, false) Something must freeze this player (if it did), but is isn't in this script. Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 A cop shooting with silenced pistol can freeze he, if the player have stars, if not, cancel event freeze player and cancel event fade camera. Yes i understand, but tell me in a what star i must begin with if, 2/3/0, what? this i cant understand Link to comment
Moderators IIYAMA Posted May 15, 2013 Moderators Share Posted May 15, 2013 I don't understand your question 100% Read this: Returns an int from 0 to 6 representing the player's wanted level, false if the player does not exist. https://wiki.multitheftauto.com/wiki/Ge ... antedLevel Normal a player starts without stars. When he did something wrong, he gets a star.... if that is what you mean. Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 I alredy have this in my full script, i dont give it because the people stole from me, look, i want if a crim with stars got shooted by police he will freeze for 3 sec, and fadecamera grey, when the 3 seconds pass, he will be unfrozen, and i want to, if a player got 1 level star he will jailed for 40 seconds, if 2 for 60 sec, etc, and the cop who jail the crim, earn more money every star, can you understand me now? Edit: the shooted weapon is silenced pistol Link to comment
Moderators IIYAMA Posted May 15, 2013 Moderators Share Posted May 15, 2013 indeed, you should not post the whole script. I also don't post my scripts, only help with some mta tricks to improve the performance of the code. But you can't expect from somebody, that he can fix something that isn't in the posted script. Link to comment
Lucario Posted May 15, 2013 Author Share Posted May 15, 2013 Oh im sorry, here is the code, im realy sorry Server Side: afText = {} myTextItem = {} function warnText ( aWText, player ) if ( myTextItem[player] ) then textDestroyTextItem ( myTextItem[player]) end afText[player] = textCreateDisplay () textDisplayAddObserver( afText[player], player ) myTextItem[player] = textCreateTextItem ( aWText, 0.22, 0.8,0.5 , 255, 0, 0, 255, 3 ) textDisplayAddText ( afText[player], myTextItem[player] ) -- outputChatBox ( textA, player ) setTimer ( textDestroyTextItem, 5000, 1, myTextItem[player], player ) end createBlip ( 1552.4996337891, -1677.3264160156, 15.1953125, 30 ) createBlip ( -1604.5458984375, 712.25848388672, 12.8671875, 30 ) createBlip ( 2340.9245605469, 2456.0463867188, 13.96875, 30 ) function createSAPDTeam () SAPDteam = createTeam ("Policia", 100, 149, 237) end addEventHandler ("onResourceStart", resourceRoot, createSAPDTeam) function joinSAPD(id) setPlayerTeam(source,SAPDteam) setPlayerNametagColor ( source, 100, 149, 237 ) setElementModel(source, id) giveWeapon ( source, 3 ) playeraccount = getPlayerAccount( source ) setAccountData( playeraccount, "team", "police", true ) warnText("Ahora Eres un Policia.",source,0,255,0) end addEvent("getJob", true) addEventHandler("getJob",root,joinSAPD) function removeSAPD() setPlayerTeam(source, Civil) takeWeapon(source, 3) playeraccount = getPlayerAccount(source) if not getAccountData(playeraccount, "standardskin") then setElementModel(source, 0) else setElementModel(source,getAccountData(playeraccount,"standardskin")) end warnText("Ahora Eres un Civil.",source,255,0,0) end addEvent("removeSAPD", true) addEventHandler("removeSAPD",root,removeSAPD) function policeJob ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) then if getTeamName( theTeam ) == "Policia" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" or getTeamName( theTeam ) == "Ejercito" then setElementPosition (source, 3306.1, 1195.7, 945, true) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) warnText( "Has Sido Encarcelado Por "..theCop.. ".", source ) warnText( "Has Encarcelado a "..theName, attacker ) local playeraccount = getPlayerAccount ( attacker ) oldArrest = getAccountData(playeraccount, "arrest") if oldArrest then newArrest = setAccountData(playeraccount, "arrest", tonumber(oldArrest) + 1 ) else newArrest = setAccountData(playeraccount, "arrest", 1 ) end setPlayerWantedLevel (source, 0) if theWL > 1 then setTimer ( setElementPosition, 20000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 3000 * theWL ) elseif theWL > 2 then setTimer ( setElementPosition, 40000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 6000 * theWL ) elseif theWL > 3 then setTimer ( setElementPosition, 60000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 9000 * theWL ) elseif theWL > 4 then setTimer ( setElementPosition, 80000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 12000 * theWL ) elseif theWL > 5 then setTimer ( setElementPosition, 100000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 15000 * theWL ) elseif theWL > 6 then setTimer ( setElementPosition, 120000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) givePlayerMoney (attacker, 18000 * theWL ) end end end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob) function consoleCreateMarker ( source ) local playerAccount = getPlayerAccount(source) local arrest = getAccountData(playeraccount, "arrest") if not arrest then outputChatBox("No Tienes Ningun Arresto",source) else outputChatBox("Arrestos: "..arrest,source) end end addCommandHandler ( "arrestos", consoleCreateMarker ) function freezeWeapon (attacker, attackerweapon, bodypart, loss) if attacker and attacker ~= source and theTeam2 and getElementType(attacker) == "player" then theTeam2 = getPlayerTeam ( attacker ) theWL2 = getPlayerWantedLevel ( source ) theSkin2 = getElementModel ( attacker ) if (attackerweapon == 23) and (loss > 1) and (theWL2 > 0) then if getTeamName( theTeam2 ) == "Policia" or getTeamName( theTeam2 ) == "SWAT" or getTeamName( theTeam2 ) == "FBI" or getTeamName( theTeam2 ) == "Ejercito" then fadeCamera ( source, true, 2.0, 191, 191, 191 ) setTimer ( setElementFrozen, 3000, 1, source, false) end end end end addEventHandler ("onPlayerDamage", getRootElement(), freezeWeapon) Client Side: local g_screenX, g_screenY = guiGetScreenSize(); local gScale = 0.3; local gAlphaDistance = 25; local gMaxDistance = 50; -- Max Distance local gTextAlpha = 120; local gTextSize = 1; local gAlphaDiff = gMaxDistance - gAlphaDistance; gScale = 1 / gScale * 800 / g_screenY; local gMaxScaleCurve = { { 0, 0 }, { 3, 3 }, { 13, 5 } }; local gTextScaleCurve = { { 0, 0.8 }, { 0.8, 1.2 }, { 99, 99 } }; local gTextAlphaCurve = { { 0, 0 }, { 25, 100 }, { 120, 190 }, { 255, 190 } }; local markerp = createMarker( 1552.4996337891, -1677.3264160156, 15.1953125, 'Cylinder', 1.5, 0, 0, 255, 150 ); local marker1p = createMarker( -1604.5458984375, 712.25848388672, 12.8671875, 'Cylinder', 1.5, 0, 0, 255, 150 ); local marker2p = createMarker( 2340.9245605469, 2456.0463867188, 13.96875, 'Cylinder', 1.5, 0, 0, 255, 150 ); addEventHandler ( 'onClientRender', root, function ( ) -- local x, y, z = getCameraMatrix(); local x1, y1, z1 = getElementPosition ( markerp ); local x2, y2, z2 = getElementPosition ( marker1p ); local x3, y3, z3 = getElementPosition ( marker2p ); local distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); local distance_2 = getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ); local distance_3 = getDistanceBetweenPoints3D( x, y, z, x3, y3, z3 ); -- -- Marker #1 if distance_1 <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ); if x1_ and y1_ then -- local scale = 1 / ( gScale * ( distance_1 / gMaxDistance ) ); local alpha = ( ( distance_1 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); -- dxDrawText( "Trabajo de Policia", x1_, y1_, x1_, y1_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end -- Marker #2 elseif distance_2 <= gMaxDistance then local x2_, y2_ = getScreenFromWorldPosition( x2, y2, z2 + 0.95, 0.06 ); if x2_ and y2_ then -- local scale = 1 / ( gScale * ( distance_2 / gMaxDistance ) ); local alpha = ( ( distance_2 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); -- dxDrawText( "Trabajo de Policia", x2_, y2_, x2_, y2_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end -- Marker #3 elseif distance_3 <= gMaxDistance then local x3_, y3_ = getScreenFromWorldPosition( x3, y3, z3 + 0.95, 0.06 ); if x3_ and y3_ then -- local scale = 1 / ( gScale * ( distance_3 / gMaxDistance ) ); local alpha = ( ( distance_3 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); -- dxDrawText( "Trabajo de Policia", x3_, y3_, x3_, y3_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end end ); function math.evalCurve( curve, input ) if input < curve[ 1 ][ 1 ] then return curve[ 1 ][ 2 ]; end for idx = 2, #curve do if input < curve[ idx ][ 1 ] then local x1 = curve[ idx - 1 ][ 1 ]; local y1 = curve[ idx - 1 ][ 2 ]; local x2 = curve[ idx ][ 1 ]; local y2 = curve[ idx ][ 2 ]; local alpha = ( input - x1 ) / ( x2 - x1 ); return math.lerp( y1, y2, alpha ); end end return curve[ #curve ][ 2 ]; end function math.lerp( from, to, alpha ) return from + ( to-from ) * alpha; end Wnd = guiCreateWindow ( 0.2, 0.2, 0.50, 0.60, "Trabajo de Policia Version Full", true ) guiSetAlpha( Wnd, 1 ) button = guiCreateButton ( 0.5, 0.8, 0.45, 0.15, "Cerrar", true, Wnd ) button1 = guiCreateButton ( 0.01, 0.8, 0.45, 0.15, "Escoger Trabajo", true, Wnd ) label = guiCreateLabel ( 0.05, 0.1, 0.9, 0.2, "Los Policias Pueden Arrestar Criminales \nPegandoles 3 Veces con la Porra.", true, Wnd ) showCursor(false) guiSetVisible( Wnd, false ) guiWindowSetSizable( Wnd, false ) guiWindowSetMovable( Wnd, false ) skins = { {"Policia 1", 280}, {"Policia 2", 281}, {"Ranger 1", 283}, {"Ranger 2", 288}, {"Vigilante de Trafico", 284}, } skinG = guiCreateGridList(0.01, 0.3, 0.99, 0.5, true, Wnd) guiGridListAddColumn(skinG, "Skins", 0.85) for i,skins in ipairs(skins) do row = guiGridListAddRow(skinG) -- guiGridListSetItemText(skinG, row, 1, tostring(skins[1]), false, false) guiGridListSetItemData(skinG, row, 1, tostring(skins[2])) end function SAPDjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(Wnd) then guiSetVisible(Wnd, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", markerp, SAPDjob) addEventHandler("onClientMarkerHit", marker1p, SAPDjob) addEventHandler("onClientMarkerHit", marker2p, SAPDjob) function takeJob() local row, col = guiGridListGetSelectedItem(skinG) if (row and col and row ~= -1 and col ~= -1) then local models = tonumber(guiGridListGetItemData(skinG, row, 1)) if model ~= "" then triggerServerEvent("getJob", localPlayer, models) guiSetVisible(Wnd,false) showCursor(false) end end end addEventHandler("onClientGUIClick", button1, takeJob, false) function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button, close) Link to comment
Castillo Posted May 15, 2013 Share Posted May 15, 2013 Your client side code isn't yours. Topic locked. Link to comment
Recommended Posts