||BuLLeT|| Posted December 29, 2012 Share Posted December 29, 2012 Hello, i just downloaded a drug store from community and i want this drug store cant use teams "Military" and "Police"! Server function restoreWeather() local ww,bb = getWeather() triggerClientEvent(source, "restoreWeather", source, ww) end addEvent("restoreWeather", true) addEventHandler("restoreWeather", getRootElement(), restoreWeather) function takeMoney(howmuch) takePlayerMoney(source,tonumber(howmuch)) end addEvent("takeMoney", true) addEventHandler("takeMoney", getRootElement(), takeMoney) client function timeCheck() local hh, mm = getTime() if (hh<7) then local ww, bb = getWeather() if (ww ~= -52123) then setWeather(-52123) end else local ww, bb = getWeather() if (ww ~= 190) then setWeather(190) end end end function fall() if (isDrugActive) then setPedAnimation(getLocalPlayer(), "ped", "getup_front",1000, false, false) setTimer(function() fall() end, math.random(10000, 30000), 1) setTimer(function() setControlState ('jump',true) end, 1500, 1) setTimer(function() setControlState ('jump',false) end, 2000, 1) end end function fades() local rnd = math.random(2,4) fadeCamera(false, rnd, math.random(1,255), math.random(1,255), math.random(1,255)) local xx, yy, zz = getElementPosition(getLocalPlayer()) setTimer(function() fadeCamera(true, 1) end, rnd*1000/2, 1) end function drugSteer() left=false right=false up=false down=false local keys = getBoundKeys ('vehicle_left') if keys then tmpLeft = false for keyName, state in pairs(keys) do if (getKeyState(keyName)) then tmpLeft=true end end if tmpLeft then left=true right=false end end local keys = getBoundKeys ('vehicle_right') if keys then tmpRight = false for keyName, state in pairs(keys) do if (getKeyState(keyName)) then tmpRight=true end end if tmpRight then left=false right=true end end if (left) then setControlState('vehicle_left', false) setControlState('vehicle_right', true) elseif (right) then setControlState('vehicle_right', false) setControlState('vehicle_left', true) else setControlState('vehicle_right', false) setControlState('vehicle_left', false) end local keys = getBoundKeys ('accelerate') if keys then tmpUp = false for keyName, state in pairs(keys) do if (getKeyState(keyName)) then tmpUp=true end end if tmpUp then down=false up=true end end local keys = getBoundKeys ('brake_reverse') if keys then tmpDown = false for keyName, state in pairs(keys) do if (getKeyState(keyName)) then tmpDown=true end end if tmpDown then down=true up=false end end if (up) then setControlState('accelerate', false) setControlState('brake_reverse', true) elseif (down) then setControlState('brake_reverse', false) setControlState('accelerate', true) else setControlState('brake_reverse', false) setControlState('accelerate', false) end end roll = 0 rollGrow = false function drugCam() if (rollGrow) then if (roll > 15) then rollGrow = false end roll = roll + 1 else if (roll < -15) then rollGrow = true end roll = roll -1 end local xx, yy, zz = getElementPosition(getLocalPlayer()) local rot = getPedRotation(getLocalPlayer()) local lx = xx + math.sin (math.rad(-rot)) * -10 local ly = yy + math.cos (math.rad(-rot)) * -10 setCameraMatrix(lx, ly, zz + 4, xx, yy, zz, roll) fxAddBlood(xx, yy, zz, 0, 0, 0, 6) end function startDrug(time) fadeCamera(false) setTimer(function(time) if (time == nil) then time = 10*1000 else if (tonumber(time) < 5000) then tiaaame = 10*1000 end end timerWeather = setTimer(function() timeCheck() end, 1000) timerFades = setTimer(function() fades() end, 4000) isDrugActive = true setTimer(function() fall() end, 1000, 1) addEventHandler("onClientRender", getRootElement(), drugSteer) addEventHandler("onClientPreRender", getRootElement(), drugCam) setTimer(function() stopDrug() end, time, 1) end, 1500, 1, time) end function stopDrug() fadeCamera(false) killTimer(timerFades) killTimer(timerWeather) isDrugActive = false fadeCamera(false) removeEventHandler("onClientRender", getRootElement(), drugSteer) removeEventHandler("onClientPreRender", getRootElement(), drugCam) fadeCamera(false) triggerServerEvent("restoreWeather", getLocalPlayer()) setTimer(function() setCameraTarget(getLocalPlayer()) fadeCamera(true) end, 2500, 1) end function startDrug2() startDrug(4) end function stopDrug2() stopDrug() end --addCommandHandler("sd", startDrug2) --addCommandHandler("sds", stopDrug2) function restoreWeather(ww) setWeather(ww) end addEvent("restoreWeather", true) addEventHandler("restoreWeather", getRootElement(), restoreWeather) function missionStart(whichMouse, state, absoluteX, absoluteY) local number = getElementData(source,"number") -- this is the button "id" local money=getPlayerMoney(getLocalPlayer()) if (number=='a') then if (money>=1000) then startDrug(1*60*1000) triggerServerEvent("takeMoney", getLocalPlayer(),1000) else outputChatBox("You don't have the money!", 255, 0, 0) end elseif (number=='b') then if (money>=3000) then startDrug(3*60*1000) triggerServerEvent("takeMoney", getLocalPlayer(),3000) else outputChatBox("You don't have the money!", 255, 0, 0) end elseif (number=='c') then if (money>=5000) then startDrug(6*60*1000) triggerServerEvent("takeMoney", getLocalPlayer(),5000) else outputChatBox("You don't have the money!", 255, 0, 0) end else if (money>=8000) then startDrug(10*60*1000) triggerServerEvent("takeMoney", getLocalPlayer(),8000) else outputChatBox("You don't have the money!", 255, 0, 0) end end --outputChatBox("#00ff00\"dfdf\" #ffffff started!",255,255,255,true) guiSetVisible (missionSelectWindow1, false) showCursor (false) end -- this fires when player hits the marker function missionSelect(hitPlayer, matchingDimension) if (hitPlayer == getLocalPlayer()) and (isPedOnGround (getLocalPlayer()) and not isPedInVehicle(hitPlayer)) then if isDrugActive then outputChatBox("You are already drugged! Do you want to die?!", 255, 0, 0) else guiSetVisible (missionSelectWindow1, true) guiBringToFront (missionSelectWindow1) showCursor (true) end end end function guiCancel () guiSetVisible (missionSelectWindow1, false) Link to comment
Castillo Posted December 29, 2012 Share Posted December 29, 2012 getPlayerTeam getTeamName Link to comment
||BuLLeT|| Posted December 29, 2012 Author Share Posted December 29, 2012 can you edit my server pls? i dont know how to add getPlayerTeam and getTeamName Link to comment
Castillo Posted December 29, 2012 Share Posted December 29, 2012 Well, then you better try to do it. Link to comment
||BuLLeT|| Posted December 29, 2012 Author Share Posted December 29, 2012 function restoreWeather() local ww,bb = getWeather() triggerClientEvent(source, "restoreWeather", source, ww) end addEvent("restoreWeather", true) addEventHandler("restoreWeather", getRootElement(), restoreWeather) function takeMoney(howmuch) takePlayerMoney(source,tonumber(howmuch)) end addEvent("takeMoney", true) addEventHandler("takeMoney", getRootElement(), takeMoney) function teamName ( source, key, newTeamName ) local playerTeam = getPlayerTeam ( source ) -- get the player's team if ( playerTeam ) then -- if he's on a team local oldTeamName = getTeamName ( playerTeam ) -- get the team's current name setTeamName ( playerTeam, Drug Dealer ) -- change its name outputChatBox ( "Changed " .. getPlayerName ( source ).."'s team name from " .. oldTeamName .. " to " .. newTeamName ) else outputChatBox ( getPlayerName ( source ) .. " isn't on a team" ) end end function whatTeamAmIOn ( source ) -- Get the player's team (source is the player who entered the command) local playerTeam = getPlayerTeam ( source ) if ( playerTeam ) then -- if he was on a team outputChatBox ( getPlayerName ( source ) .. " is on team: " .. getTeamName ( playerTeam ) ) else outputChatBox ( getPlayerName ( source ) .. " isn't on a team" ) end end -- Add console command to find your team when 'myteam' is typed. addCommandHandler ( "myteam", whatTeamAmIOn ) good? Link to comment
manve1 Posted December 29, 2012 Share Posted December 29, 2012 You copied the stuff from wiki. Link to comment
||BuLLeT|| Posted December 29, 2012 Author Share Posted December 29, 2012 ye, can you try to make it on my server.lua pls? idk how Link to comment
manve1 Posted December 29, 2012 Share Posted December 29, 2012 read what each function does ... Link to comment
||BuLLeT|| Posted December 29, 2012 Author Share Posted December 29, 2012 i did but i dont understand it... Link to comment
manve1 Posted December 29, 2012 Share Posted December 29, 2012 what are you trying to make with: getPlayerTeam and getTeamName? Link to comment
||BuLLeT|| Posted December 29, 2012 Author Share Posted December 29, 2012 i want this drug store cant use teams "Military" and "Police" Link to comment
manve1 Posted December 29, 2012 Share Posted December 29, 2012 u should use something like this: if ( getPlayerTeam( player ) == getTeamFromName('Military') ) or ( getPlayerTeam == getTeamFromName('Police') ) then --code end NOTE: This is only an example. Link to comment
||BuLLeT|| Posted December 30, 2012 Author Share Posted December 30, 2012 k, thanks ;D Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now