-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Why don't you make 1 event handler and then check. addEventHandler("onClientGUIClick",getRootElement(), function () if (source == button1) then elseif (source == button2) then end end)
-
"attempt to preform arithmetic on a boolean value"?!? help!!
Castillo replied to blurryshadow1's topic in Scripting
lol, that was obiously, if you want to use setAccountData you can't use onPlayerJoin because when the player joins he/she is not logged in -
This is strange, if you scripted that, why can't you create a simple meta.xml? i think you have stolen this script.
-
Maybe you should say "i'm becoming lazy" GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} function startup() GUIEditor_Window[1] = guiCreateWindow(0,0,0.99,1,"...SCEGLI UNA FAZIONE...",true) guiSetVisible(GUIEditor_Window[1],false) GUIEditor_Memo[1] = guiCreateMemo(0.0164,0.0517,0.5404,0.56,"21 dicembre 2012...\nLa data piu' conosciuta sulla faccia di\nquesto misero pianeta.\nFino ad un anno prima andava tutto bene,\nfino a quando, per i classici motivi\ndi soldi, non scoppio' l' ennesima,\ndisastrosa, guerra mondiale.\nFurono usate armi biologiche e nucleari,\nfino ad ottenere questo cazzo di risultato...\nUn mondo di merda ricoperto da zombies di merda\ntenuti in vita da quelle radiazioni e da quei composti \nchimici DI MERDA.\nNegli anni seguenti si sono formate diverse comunita':\ngli HUNTERS, i Reaper e gli Stalkers.\nIl tuo compito e' quello di entrare a fare parte di uno di questi\ngruppi e di ammazzare quei fottuti zombies.\nChe cosa stai aspettando ancora? e' il tuo momento.\n",true,GUIEditor_Window[1]) GUIEditor_Image[1] = guiCreateStaticImage(0.5101,0.1017,0.4836,0.4767,"images/mtalogo.png",true,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(0.0278,0.8267,0.2374,0.1217,"HUNTERS",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.3851,0.8267,0.2374,0.1217,"REAPER",true,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(0.7172,0.8267,0.2374,0.1217,"STALKERS",true,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(0.2841,0.6783,0.4306,0.0717,"VOGLIO FARE PARTE DEI:",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"center") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",false) addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], warpbasehunters, true ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], warpbasereaper, true ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], warpbasestalkers, true ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], selezionaskin, false ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], selezionaskin, false ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], selezionaskin, false ) end addEventHandler("onClientResourceStart",getResourceRootElement(),startup) function visibile() if (guiGetVisible(GUIEditor_Window[1])) then showCursor(false) guiSetVisible(GUIEditor_Window[1],false) else showCursor(true) guiSetVisible(GUIEditor_Window[1],true) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), visibile) function warpbasehunters () setElementPosition ( getLocalPlayer(), 40, 40, 40 ) guiSetVisible(GUIEditor_Window[1],false) end function warpbasereaper () setElementPosition ( getLocalPlayer(), 10, 10, 20 ) guiSetVisible(GUIEditor_Window[1],false) end function warpbasestalkers () setElementPosition ( getLocalPlayer(), 0, 0, 0 ) guiSetVisible(GUIEditor_Window[1],false) end function CreateSelectorWindow() wdwselector = guiCreateWindow(0.438,0.880,0.15,0.10,"",true) guiWindowSetMovable(wdwselector,false) btnLeft = guiCreateButton(0.0,0.4,0.200,0.350,"<-",true,wdwselector) btnRight = guiCreateButton(0.76,0.4,0.200,0.350,"->",true,wdwselector) btnSelect = guiCreateButton(0.30,0.4,0.400,0.350,"Seleziona",true,wdwselector) guiSetVisible(wdwselector, false) end function selezionaskin () CreateSelectorWindow() addEventHandler("onClientGUIClick", btnLeft, clientSkinLeft, false) addEventHandler("onClientGUIClick", btnSelect, clientSkinSelect, false) addEventHandler("onClientGUIClick", btnRight, clientSkinRight, false) if (wdwselector ~= nil) then guiSetVisible(wdwselector, true) triggerServerEvent("FrontCamera", getLocalPlayer()) end showCursor(true) end function clientSkinSelect(button) guiSetVisible(wdwselector, false) guiSetVisible(memo, false) showCursor(false) triggerServerEvent("SkinSelected", getLocalPlayer()) end function clientSkinRight(button) triggerServerEvent("SkinRight", getLocalPlayer()) end function clientSkinLeft(button) triggerServerEvent("SkinLeft", getLocalPlayer()) end
-
--server side code (define type="server" in meta.xml) function headShot(attacker, weapon, bodypart, loss) if (bodypart == 9) then killPed(source, attacker, weapon, bodypart) triggerClientEvent(attacker,"playSound",attacker) if (weapon == 25) or (weapon == 26) or (weapon == 27) then--//Åñëå âûñòðåë èç äðîáîâèêîâ òî, ñðûâàåì ãîëîâó. setPedHeadless(source, true) end end end addEventHandler("onPlayerDamage", getRootElement(), headShot) --client side code (define type="client" in meta.xml) addEvent("playSound",true) addEventHandler("playSound",getRootElement(), function () sound = playSound( "headshot.mp3", false ) end)
-
It is, use HEX colors, example: #FF0000[MM]#00FF00Castillo that will make [MM] in Red colour and Castillo in Green colour.
-
Are you kididng me? seriusly? that's the same code i've edited............. you should make new window(s) and change someWindowElement to your window element
-
Does it output any error?
-
Show us your addEventHandler code.
-
Well, it was really easy to "bind" it as you say, just adding stopSound(yourSoundElement) and voila! P.S: Congratz
-
"attempt to preform arithmetic on a boolean value"?!? help!!
Castillo replied to blurryshadow1's topic in Scripting
Try this ( replace Kills by the good elementData if it's wrong ): function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerConnect", getRootElement(), resetKills ) Citizen, onPlayerConnect is when a player connects, this should use onPlayerJoin instead. function resetKills() -- Set his kills to 0 ( I think it's a setElementData so ...) setElementData( source, "Kills", 0 ) end addEventHandler( "onPlayerJoin", getRootElement(), resetKills ) -
Guieditor is very easy to use, just make a folder named "guieditor" then make your gui and click on guieditor's menu "print code" - to print it on a gui memo. or "output code" - this will make a .txt (if doesn't exist already) with your GUI code.
-
I don't understand what do you want to do, could you put your script in English language firstly? and then explain again what do you want to do.
-
open = 0 function box() if open==0 then open = 1 showCursor(true) myWindow = guiCreateWindow(0.375, 0.375, 0.500, 0.500, "Map Test Help Commands - GUI Version", true) but1 = guiCreateButton(0.0, 0.1, 0.19, 0.1, "Fix", true, myWindow) but2 = guiCreateButton(0.0, 0.23, 0.19, 0.1, "Blow up", true, myWindow) but3 = guiCreateButton(0.0, 0.36, 0.19, 0.1, "Water Color", true, myWindow) elseif open==1 then open = 0 destroyElement(myWindow) end end open = 0 bindKey("l", "up", box) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == but1) then guiSetVisible(someWindowElement,true) elseif (source == but2) then guiSetVisible(someWindowElement2,true) elseif (source == but3) then guiSetVisible(someWindowElement3,true) end end) Was it that hard?
-
What you are saying could mean you have many resources with same command, because this is a server side and you are saying it's not triggering a client side event. i recommend looking at every script your server is running.
-
AMX it's the only program to run SA-MP scripts into MTA, you will have to learn how to script in MTA.
-
playSound stopSound and use this event handlers onClientResourceStart - to start the sound when the resource starts.
-
"attempt to preform arithmetic on a boolean value"?!? help!!
Castillo replied to blurryshadow1's topic in Scripting
Copy the code again, i've edited it. -
"attempt to preform arithmetic on a boolean value"?!? help!!
Castillo replied to blurryshadow1's topic in Scripting
----------//\\----------- ---//GangWar gamemode by SpawN\\--- ----------\\//----------- --//Ñîçäà¸ì êîìàíäû áàíä Grove_Street = createTeam("Grove Street", 0, 179, 4) --setTeamFriendlyFire(Grove_Street , false) Ballas = createTeam("Ballas", 211, 0, 174) --setTeamFriendlyFire(Ballas , false) Aztec = createTeam("Aztec", 0, 219, 222) --setTeamFriendlyFire(Aztec , false) LSPD = createTeam("LSPD", 100, 149, 237) --setTeamFriendlyFire(LSPD , false) --//Òàáëèöà ðåñïàâíîâ. Respawns = {["Grove Street"] = {2498.6701660156, -1684.5754394531, 13.416213035583}, ["Ballas"] = {2172.3395996094, -1794.5, 13.361840248108}, ["Aztec"] = {1828.4742431641, -1682.5, 13.546875} ,["LSPD"] = {1579.728515625, -1635.6196289063, 13.560563087463}} Weapons1 = {} Weapons2 = {} Weapons3 = {} blipPlayers = {} --//Ñïàâí èãðîêà. function playerSpawn(GangName, SkinID, WeaponSlot1, WeaponSlot2, WeaponSlot3) spawnPlayer(source, Respawns[GangName][1],Respawns[GangName][2],Respawns[GangName][3], 0, SkinID, 0, 0) setPlayerTeam(source, getTeamFromName(GangName)) fadeCamera(source, true) setCameraTarget(source, source) if WeaponSlot1 then giveWeapon(source, WeaponSlot1, 350, true) Weapons1[getPlayerName(source)] = WeaponSlot1 end if WeaponSlot2 then giveWeapon(source, WeaponSlot2, 250, true) Weapons2[getPlayerName(source)] = WeaponSlot2 end if WeaponSlot3 then giveWeapon(source, WeaponSlot3, 50, false) Weapons3[getPlayerName(source)] = WeaponSlot3 end setPlayerMoney(source, getAccountData(getPlayerAccount(source),"money")) setPlayerNametagText(source, getPlayerName(source).."["..getElementData(source,"id").."]") local r,g,b = getTeamColor(getTeamFromName(GangName)) blipPlayers[getPlayerName(source)] = createBlipAttachedTo(source, 0, 3, r, g, b, 255, 0, 99999.0)--//Ïðèêëåèâàåì ê èãðîêó áëèï(èêîíêó), ïîä öâåò êîìàíäû. showPlayerHudComponent(source,"radar", true) showPlayerHudComponent(source,"area_name", true) for i = 69,79 do setPedStat(source, i, 999) end end addEvent("playerSpawn", true) addEventHandler("playerSpawn", getRootElement(), playerSpawn) --//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. function RespawnPlayer(source, skin) local teamNeme = getTeamName(getPlayerTeam(source)) spawnPlayer(source, Respawns[teamNeme][1],Respawns[teamNeme][2],Respawns[teamNeme][3], 0, skin, 0, 0) if Weapons1[getPlayerName(source)] then giveWeapon(source, Weapons1[getPlayerName(source)], 350, true) end if Weapons2[getPlayerName(source)] then giveWeapon(source, Weapons2[getPlayerName(source)], 250, true) end if Weapons3[getPlayerName(source)] then giveWeapon(source, Weapons3[getPlayerName(source)], 50, false) end if (isPedHeadless(source) == true) then--//Äîáîâëÿåì èãðîêó ãîëîâó åñëå å¸ íåò. setPedHeadless(source, false) end end --//Ðåñïàâí èãðîêà ïîñëå ñìåðòè. function respawnDead(ammo, attacker, weapon, bodypart) if attacker then if (getElementType(attacker) == "player") then setPlayersStatsIFattackerPlayer(source, attacker) elseif (getElementType(attacker) == "vehicle") then setPlayersStatsIFattackerVehicle(source, attacker) end end if (getElementData(source,"F4") == false) then setTimer(RespawnPlayer, 5000, 1, source, getPlayerSkin(source)) elseif (getElementData(source,"F4") == true) then setTimer(triggerClientEvent, 5000, 1, "step1gangs", source) setElementData(source,"F4", false) end end addEventHandler("onPlayerWasted", getRootElement(), respawnDead) --//Óäîëÿåì ïðè ðåñïàâíå àâòîìîáèëÿ, äàííóþ î òîì êòî â íå¸ ñòðåëÿë, â ðåçóëüòàòå ÷åãî îíà âçîðâàëàñü. playersDamageVihecle = {}--//Òàáëèöà Àòàêóåùèõ àâòîìîáèëåé (åñëå ïîñëå íèõ òà÷êà çàãàðåëàñü). function onVehicleRespawn(exploded) if (getElementType(source) == "vehicle") then if playersDamageVihecle[source] then playersDamageVihecle[source] = nil if not playersDamageVihecle[source] then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933 Ýòó ìàøèóí óáðàëè ñ ìàñèâà, òðàíñïîðò âçîðâàíûé èãðîêàìè.!", getRootElement(), 0, 0, 0,true) end end end end addEventHandler("onVehicleRespawn", getRootElement(), onVehicleRespawn) --//Ôóíêöèÿ èçñåíÿþùÿÿ ñòàòèñòèêó èãðîêîâ. Óìåðøåãî è óáèéöû.(Åñëå àòàêóþùèé èãðîê) function setPlayersStatsIFattackerPlayer(HitPlayer, attacker) local accountAttacker = getPlayerAccount(attacker) local accountHitPlayer = getPlayerAccount(HitPlayer) if getAccountData(accountHitPlayer,"Deaths") then setAccountData(accountHitPlayer, "Deaths", tonumber(getAccountData(accountHitPlayer, "Deaths"))+1) else setAccountData(accountHitPlayer, "Deaths",1) end if (attacker ~= HitPlayer) then --//Åñëè ýòî íå ñàìîóáèéñòâî. if getAccountData(accountAttacker,"Kills") then setAccountData(accountAttacker, "Kills", tonumber(getAccountData(accountAttacker, "Kills"))+1) else setAccountData(accountAttacker, "Kills",1) end givePlayerMoney(attacker, 500) takePlayerMoney(HitPlayer, 500) end end --//Ôóíêöèÿ ñðîáàòûâàþùÿÿ êîãäà èãðîê, çàäàâëåí òà÷êîé. function setPlayersStatsIFattackerVehicle(HitPlayer, vehicle) local theAttacker = getVehicleOccupant(vehicle, 0) if (theAttacker) then setAccountData(getPlayerAccount(HitPlayer), "Deaths", getAccountData(getPlayerAccount(HitPlayer), "Deaths")+1) setAccountData(getPlayerAccount(theAttacker), "Kills", getAccountData(getPlayerAccount(theAttacker), "Kills")+1) takePlayerMoney(HitPlayer, 500) givePlayerMoney(theAttacker, 500) else setAccountData(getPlayerAccount(HitPlayer), "Deaths", getAccountData(getPlayerAccount(HitPlayer), "Deaths")+1) end end function quitPlayer() local playername = getPlayerName(source) destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. local theAccount = getPlayerAccount(source) setAccountData(theAccount, "money", getPlayerMoney(source)) end addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) --//Áèíäèì êëàâèøó F4 function joinplayerBindkey() bindKey(source,"F4", "down", nextGang) end addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) --//F4 ñìåíà êîìàíäû. Ïîñëå ñìåðòè. function nextGang(player, key, keyState) if (getElementData(player,"F4") == false) or (not getElementData(player,"F4")) then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933Âû âêëþ÷èëè âûõîä â ìåíþ âûáîðà áàíäû, ïîñëå ñìåðòè.", player, 0, 0, 0,true) setElementData(player,"F4", true) elseif (getElementData(player,"F4") == true) then outputChatBox("#CC0033[ÑÅÐÂÅÐ]: #339933Âû âûêëþ÷èëè âûõîä â ìåíþ âûáîðà áàíäû, ïîñëå ñìåðòè.", player, 0, 0, 0,true) setElementData(player,"F4", false) end end function quitPlayer() local playername = getPlayerName(source) destroyElement(blipPlayers[playername])--//Óäîëÿåì áëèï îáîçíà÷àþùèé ìåñòîïîëîæåíèå èãðîêà íà ðàäàðå. local theAccount = getPlayerAccount(source) setAccountData(theAccount, "money", getPlayerMoney(source)) end addEventHandler("onPlayerQuit", getRootElement(), quitPlayer) --//Áèíäèì êëàâèøó F4 function joinplayerBindkey() bindKey(source,"F4", "down", nextGang) end addEventHandler("onPlayerJoin",getRootElement(),joinplayerBindkey) Try it. -
[TROYAN] IMPORTANT WARNING ABOUT ~[EPP]~hama2O1o
Castillo replied to SHC//Sniper's question in Client
This topic was suposed to be a "warning" but, this has ended on a war between kids, so why don't you just stop fighting eachother. P.S: Maybe a Moderator should lock this topic. -
locations = { {1676.63,-1717.06,13.54,0}, {1542.68,-1675,13.55,0}, {2179.56,-1770.89,96.36,0}, {2189.72,-1671.97,96.37,0}, {2189.72,-1671.97,96.37,0}, {1728.70,-1668.57,22.60,0} } for i,v in pairs(locations) do local zomb = createPed (v[1],v[2],v[3]) setElementInterior(zomb,v[4]) end You can see that i added a new value named "0" which is the interior id.
-
--client side function selectTeam() triggerServerEvent("setTeam",getLocalPlayer()) end addEventHandler("onClientGUIClick",yourButtonElement,selectTeam,false) --server side addEvent("setTeam",true) addEventHandler("setTeam",getRootElement(), function () setPlayerTeam" class="kw6">setPlayerTeam(source,getTeamFromName("Some_Team")) outputChatBox("Your team has been set!", source) end)
