Jump to content

Monty

Members
  • Posts

    167
  • Joined

  • Last visited

Everything posted by Monty

  1. is there any function like onPlayerLeaveTeam or something like that?
  2. what's wrong? please help function createRobberTeam () robberTeam = createTeam ( "Criminal", 250, 0, 0 ) end addEventHandler ( "onResourceStart", resourceRoot, createRobberTeam ) addEvent ( "robberJobAccepted", true ) function givePlayerJob ( ) setPlayerTeam ( source, robberTeam ) playeraccount = getPlayerAccount(source) if getAccountData(playeraccount, "standardskin") == 0 then setElementModel(source, 0) else setElementModel(source,getAccountData(playeraccount,"standardskin")) end end end addEventHandler ( "robberJobAccepted", root, givePlayerJob )
  3. sorry... why my function for the 'always centered window' doesn't work? --//Register / Login panel function createLoginPanel() fadeCamera(true, 6, 0, 0, 0) setCameraMatrix(-1475.5, 831.18, 65.5, -1487.5, 800.18, 65.5) showPlayerHudComponent("radar", false) showPlayerHudComponent("area_name", false) local player = string.gsub(getPlayerName(getLocalPlayer()),"#%x%x%x%x%x%x", "") end function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) guiSetInputMode("no_binds_when_editing") end window = guiMyCwindow(301,250,"Login Panel",false) gang_lbl = guiCreateLabel(16,31,385,19,"'Welcome to the Gang War Server'",false,window) guiLabelSetHorizontalAlign(gang_lbl,"center",false) guiSetFont(gang_lbl,"default-bold-small") tabs = guiCreateTabPanel(16,54,388,186,false,window) login_tab = guiCreateTab("Login",tabs) lblLogin = guiCreateLabel(10,11,99,24,"Login:",false,login_tab) lblReg = guiCreateLabel(8,38,78,23,"Password:",false,login_tab) remember = guiCreateCheckBox(6,58,109,23,"Remember me?",false,false,login_tab) guiCheckBoxSetSelected(remember,true) login_edit = guiCreateEdit(96,7,212,23,player,false,login_tab) guiEditSetReadOnly(login_edit,true) pass_edit = guiCreateEdit(95,36,214,23,"",false,login_tab) guiEditSetMasked(pass_edit,true) welcome1 = guiCreateLabel(29,90,336,55,"Welcome!",false,login_tab) guiLabelSetHorizontalAlign(welcome1,"center",false) guiSetFont(welcome1,"sa-gothic") login_Btn = guiCreateButton(310,8,75,51,"Login",false,login_tab) reg_tab = guiCreateTab("Register",tabs) reg_lbl = guiCreateLabel(15,15,47,18,"Login:",false,reg_tab) reg_edit = guiCreateEdit(115,10,216,25,player,false,reg_tab) guiEditSetReadOnly(reg_edit,true) reglbl_pass = guiCreateLabel(14,48,59,17,"Password:",false,reg_tab) reg_pass_edit = guiCreateEdit(115,44,216,25,"",false,reg_tab) cfpass = guiCreateLabel(11,82,101,17,"Confirm Password:",false,reg_tab) guiEditSetMasked(reg_pass_edit,true) confreg_pass = guiCreateEdit(115,77,216,25,"",false,reg_tab) guiEditSetMasked(confreg_pass,true) sexlbl = guiCreateLabel(15,111,68,37,"Sex:",false,reg_tab) guiSetFont(sexlbl,"sa-header") female_radio = guiCreateRadioButton(182,115,16,19,"",false,reg_tab) male_radio = guiCreateRadioButton(115,114,16,19,"",false,reg_tab) guiRadioButtonSetSelected(male_radio,true) male_lbl = guiCreateLabel(114,135,33,14,"Male",false,reg_tab) female_lbl = guiCreateLabel(175,136,39,14,"Female",false,reg_tab) register_btn = guiCreateButton(243,122,137,31,"Register",false,reg_tab) infotwix = guiCreateLabel(18,245,130,19,"Login Panel by TwiX",false,window) guiLabelSetColor(infotwix,0,255,0) guiWindowSetSizable(window, false)--//Block editing size of the window. guiWindowSetMovable(window, false)--//Block move window. function LoginPanel() createLoginPanel() triggerServerEvent("getSavePassword", getLocalPlayer(), guiGetText(login_edit)) addEventHandler("onClientGUIClick", login_Btn, clientSubmitLogin) addEventHandler("onClientGUIClick", register_btn, clientSubmitRegister) addEventHandler("onClientPlayerChangeNick", getLocalPlayer(), destroyDataPasswordAndAddlogin) showCursor(true) guiSetInputEnabled(true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), LoginPanel) --//Register Players function clientSubmitRegister() if source == register_btn then local Login = guiGetText(reg_edit) local Password = guiGetText(reg_pass_edit) local ConfirmPassword = guiGetText(confreg_pass) --//Check the floor player. if guiRadioButtonGetSelected(male_radio) then sex = "Male" else sex = "Female" end if (Login == "") then outputChatBox("#CC0033[sERVER]: #339933Write your Login!", 0, 0, 0, true) return 0 end if (Password == "") then outputChatBox("#CC0033[sERVER]: #339933Write your Password!", 0, 0, 0, true) return 0 end if (Password ~= ConfirmPassword) then outputChatBox("#CC0033[sERVER]: #339933Passwords don't match!", 0, 0, 0,true) return 0 end triggerServerEvent("submitRegister", getLocalPlayer(), Login, Password, sex) end end --//Enter in account function clientSubmitLogin() if source == login_Btn then local Login = guiGetText(login_edit) local Password = guiGetText(pass_edit) local CheckBoxStat = guiCheckBoxGetSelected(remember) if (Login == "") then outputChatBox("#CC0033[sERVER]: #339933Write your Login!", 0, 0, 0, true) return 0 end if (Password == "") then outputChatBox("#CC0033[sERVER]: #339933Write your Password!", 0, 0, 0, true) return 0 end triggerServerEvent("submitLogin", getLocalPlayer(), Login, Password, CheckBoxStat) end end --//Close Windows addEvent("login_sucsess", true) addEventHandler("login_sucsess", getRootElement(), function (forPlayer) if forPlayer == getLocalPlayer() then --showCursor(false) guiSetInputEnabled(false) guiSetVisible(window, false) end end ) --//Add password and check box true. function addPassword(Password, Login) guiCheckBoxSetSelected(remember, true) guiSetText(pass_edit, Password) end addEvent("addPassword", true) addEventHandler("addPassword", getRootElement(), addPassword) --//Remove password when player changed nick function destroyDataPasswordAndAddlogin(oldNick, newNick) guiSetText(login_edit, string.gsub(newNick,"#%x%x%x%x%x%x", "")) guiSetText(reg_edit, string.gsub(newNick,"#%x%x%x%x%x%x", "")) if (guiGetText(pass_edit) ~= "") then guiSetText(pass_edit, "") end if (guiCheckBoxGetSelected(remember) == true) then guiCheckBoxSetSelected(remember, false) end end
  4. ehi ho trovato questo script sulla community... il minigun però non sapa, è solo un oggetto attaccato, come faccio a farlo sparare? function turret( source, commandName ) local x, y, z = getElementPosition( source ) local patriotgun1 = createObject(2985, 0, 0, 0) local patriotgun2 = createObject(2985, 0, 0, 0) local patriottank = createVehicle(464, 0, 0, 0) local patriot1 = createVehicle ( 470,x, y, z ) local c4 = createObject (1654, 0, 0, 0, 0) local c42 = createObject (1654, 0, 0, 0, 0) local c43 = createObject (1654, 0, 0, 0, 0) attachElements (patriottank, patriotgun1, -0, 0,1, 0,0,-90) attachElements (c4, patriot1, 0, 0, 0.35, -90) attachElements (c42, patriot1, 0.3, 0, 0, -90, 90, 0 ) attachElements (c43, patriot1, -0.3, 0, 0, -90, -90, 0) setElementAlpha(patriottank, 0) --setElementAlpha(patriotgun1, 0) attachElements( patriotgun1, patriot1, 0, 0, 0.4, 0, 0, 90 ) setVehicleDamageProof ( patriot1, true ) setVehicleDamageProof ( patriottank, true ) warpPedIntoVehicle(source, patriot1) end addCommandHandler( "humvee", turret ) --minigun1 minigun1 = createObject(2985, 97,2492, 15.6,0,0,180) miniggun1 = createVehicle(464, 0, 0, 0) setVehicleDamageProof ( miniggun1, true ) setElementAlpha(miniggun1, 0) attachElements( miniggun1, minigun1, 0, 0, 1, 0, 0, -90 )
  5. i need that a player follow anotherone when he get hit by nightstick
  6. is there something more simply
  7. hi... what's the name of the function to make a player follow another one
  8. Monty

    function error

    the console say failed to load the resource...
  9. Monty

    function error

    sorry what's wrong in this function function joinSAPD() if (isGuestAccount(getPlayerAccount(source)) == false) then local playeraccount = getPlayerAccount (source) if not getElementData(source,"Occupation") == "police" then setPlayerTeam(source,SAPDteam) setElementModel(source, 280) giveWeapon ( source, 3 ) if getElementData(source, "arrest") == 0 then setElementData(source, "arrest", "1") setElementData(source, "Occupation", "police", true) outputChatBox("You are now policeman.",source,0,255,0) else outputChatBox("Error: You already have this work",source,255,0,0) end else outputChatBox ('Error: Please login or register!',source,255,255,255,true) end if getElementData(source, "arrest") == 0 then setElementData(source, "arrest", "1") end end addEvent("setSAPD", true) addEventHandler("setSAPD",root,joinSAPD)
  10. Monty

    server ON

    hi, is there a way to keep my server online witohut keeping my laptop turned on????
  11. here is a part of a code... is it possible to save the weapons? addEventHandler( "onPlayerWasted", getRootElement( ), function() setTimer( spawnPlayer, 4000, 1, source, 1177.5682373047, -1323.2587890625, 14.077121734619,0, getElementModel(source),0,0, getPlayerTeam(source) ) end )
  12. sorry my bad, but no working anyway
  13. why doesn't work ? server createBlip ( 1552.4996337891, -1677.3264160156, 15.1953125, 30 ) addEventHandler("onPlayerLogin",root,function() local playeraccount = getPlayerAccount ( source ) local data = getAccountData(playeraccount, "arrest") -- you should finish it local acc = getAccountNamee(playeraccount) triggerClientEvent(source,"myEvent",source,data,acc) end ) function createSAPDTeam () SAPDteam = createTeam ("police", 100, 149, 237) end addEventHandler ("onResourceStart", resourceRoot, createSAPDTeam) function joinSAPD() setPlayerTeam(source,SAPDteam) setElementModel(source, 280) giveWeapon ( source, 3 ) setAccountData( playeraccount, "Occupation", "police") outputChatBox("You are now policeman.",source,0,255,0) end addEvent("setSAPD", true) addEventHandler("setSAPD",root,joinSAPD) function removeSAPD() setPlayerTeam(source,0) setAccountData( playeraccount, "Occupation", "unemployed") outputChatBox("you left your job.",source,0,255,0) end addEvent("removeSAPD", true) addEventHandler("removeSAPD",root,removeSAPD) function policeJob ( attacker, attackerweapon, bodypart, loss ) theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then if getTeamName( theTeam ) == "police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" then setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) outputChatBox ( "You have been jailed by "..theCop.. " for 10 seconds.", source ) local playeraccount = getPlayerAccount ( attacker ) arrests = tonumber(getAccountData(playeraccount, "arrest")) setAccountData(playeraccount, "arrest", arrests + 1 ) givePlayerMoney (attacker, 100) setTimer ( setElementPosition, 10000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) setPlayerWantedLevel (source, 0) end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob) client local marker = createMarker( 1552.4996337891, -1677.3264160156, 15.1953125, "Cylinder", 1.5, 0, 0, 255, 150) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"police job") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,140,108,35,"Take job",false,windowjob) GUIEditor_Label[2] = guiCreateLabel(19,59,108,35,"Arrests : " ,false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Close",false,windowjob) GUIEditor_Button[3] = guiCreateButton(22,200,110,36,"Quit Job",false,windowjob) GUIEditor_Memo[1] = guiCreateLabel(19,19,273,20,"are you sure you want to take this job?",false,windowjob) theTeam = getTeamFromName("police") GUIEditor_Memo[2] = guiCreateLabel(19,45,273,20,"On-duty officers : "..countPlayersInTeam(theTeam),false,windowjob) addEvent("myEvent",true) addEventHandler("myEvent",root,function(data, acc) guiSetText(GUIEditor_Label[2],"Arrests : "..data) guiSetText(GUIEditor_Label[2],"Account : "..acc) end ) function SAPDjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, SAPDjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, SAPDjobleave) function joinTeam() triggerServerEvent("setSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeTeam() triggerServerEvent("removeSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) function removeSAPDWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false)
  14. using the way suggested by alegrab how do I use that client code in a gui? (line 15) local marker = createMarker( 1552.4996337891, -1677.3264160156, 15.1953125, "Cylinder", 1.5, 0, 0, 255, 150) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"SAPD agent") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,140,108,35,"Take job",false,windowjob) GUIEditor_Label[2] = guiCreateLabel(179,140,108,35,"Arrests:" ,false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Close",false,windowjob) GUIEditor_Button[3] = guiCreateButton(22,200,110,36,"Quit Job",false,windowjob) GUIEditor_Memo[1] = guiCreateLabel(19,33,273,20,"are you sure you want to take this job?",false,windowjob) function SAPDjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, SAPDjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, SAPDjobleave) function joinTeam() triggerServerEvent("setSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeTeam() triggerServerEvent("removeSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[3] , removeTeam, false) function removeSAPDWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false)
  15. i don't know, i' in vacation and i cant turn on my server, but the console doesn't report errors
  16. hi why this gui doesn't set visible since i used get account data? line 14-15 GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(301,250,"SAPD agent") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,140,108,35,"Take job",false,windowjob) GUIEditor_Label[2] = guiCreateLabel(179,140,108,35,"Arrests:" ..tonumber(getAccountData(getPlayerAccount ( source ), "arrest")) ,false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Close",false,windowjob) GUIEditor_Button[3] = guiCreateButton(22,200,110,36,"Quit Job",false,windowjob) GUIEditor_Memo[1] = guiCreateLabel(19,33,273,20,"are you sure you want to take this job?",false,windowjob) function SAPDjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, SAPDjob) function FBIjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, SAPDjobleave) function joinTeam() triggerServerEvent("setSAPD",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeSAPDWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSAPDWindow, false)
  17. sorry my bad, the code tonumber
  18. what did you changed???
  19. why under the code give arithemtical error un account data createBlip ( 1552.4996337891, -1677.3264160156, 15.1953125, 30 ) function createSAPDTeam () SAPDteam = createTeam ("police", 100, 149, 237) end addEventHandler ("onResourceStart", resourceRoot, createSAPDTeam) function joinSAPD() setPlayerTeam(source,SAPDteam) setElementModel(source, 280) giveWeapon ( source, 3 ) setAccountData( playeraccount, "Occupation", "police") outputChatBox("You are now policeman.",source,0,255,0) end addEvent("setSAPD", true) addEventHandler("setSAPD",root,joinSAPD) function policeJob ( attacker, attackerweapon, bodypart, loss ) theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if (attackerweapon == 3) and (loss > 2 ) and (theWL > 0) then if getTeamName( theTeam ) == "police" or getTeamName( theTeam ) == "SWAT" or getTeamName( theTeam ) == "FBI" then setElementPosition (source, 4076.3999023438, -1788.5, 3.511967, true) theName = getPlayerName ( source ) theCop = getPlayerName ( attacker ) outputChatBox ( "You have been jailed by "..theCop.. " for 10 seconds.", source ) local playeraccount = getPlayerAccount ( attacker ) arrests = getAccountData(playeraccount, "arrest") setAccountData(playeraccount, "arrest", arrests + 1 ) givePlayerMoney (attacker, 100) setTimer ( setElementPosition, 10000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439) setPlayerWantedLevel (source, 0) end end end addEventHandler ("onPlayerDamage", getRootElement(), policeJob)
  20. Monty

    script editor

    i know, i start it, i edit a scrpi, i press save but don't save
×
×
  • Create New...