Search the Community
Showing results for tags 'variables'.
-
-- Ez a server oldali script local rigPrice = 50000; function buyMiningRig(player, amount) local money = getPlayerMoney(localPlayer); if (money >= rigPrice) then money - rigPrice outputChatBox("#ffffff[Bitcoin] Sikeresen vettél egy bányászgépet!", 0, 0, 0, true); end end addCommandHandler("buyminingrig", root, buyMiningRig); -- Ez pedig a kliens oldali local maxMiningRigs = 50; local btcPrice = 1500000; local minerToggle = false; local playerBtc = 0; local miningRigs = 0; function mineBtc(howMuch) playerBtc + howMuch; if (minerToggle) then setTimer(mineBtc, 1000, 1, 0.00001); end end function displayBtc() outputChatBox("[Bitcoin] A jelenlegi bitcoinjaid száma:"..playerBtc.. ", és értéke :" ..btcprice/playerBtc); end addCommandHandler("btcamount", root, displayBtc) function toggleMinerOn() if (minerToggle == false) then minerToggle = true; outputChatBox("[Bitcoin] A bányászgép bekapcsolva!"); mineBtc(); elseif (minerToggle == true) then minerToggle = false; outputChatBox("[Bitcoin] A bányászgép kikapcsolva!"); end end addCommandHandler("togglebtc", root, toggleMiner); (A két script ugyan abba a meta-ba van beleírva!) A lényeg annyi lenne, hogy a szerver oldali scriptből hogy tudnék hozzáadni a "miningRigs" változóhoz egy adott mennyiséget. Ha valaki tudna ebbe segíteni, azt megköszönném, legyen bármilyen hosszú a script csak jó legyen.
-
The case looks like this, I have a variable (Let's call it Ammo) that IS TO be in the giveWeapon function (source, 22, Ammo, true) but the problem is that this Ammo variable has the script type "client" and the function is the server script type, so how can I make this variable in this function? If someone has not understood what is going on, there is still a code to simplify... -- Client side local Ammo = 60 local AmmoMarker = createMarker(0, 0, 1, "cylinder", 2.0) local WeaponMarker = createMarker(0, 0, 1, "cylinder", 2.0) addEventHandler("onClientMarkerHit", AmmoMarker, function() Ammo = Ammo + 1 end) addEventHandler("onClientMarkerHit", WeaponMarker, function() -- Here I get a weapon, the variable "Ammo" is the number of bullets end) -- Server Side --??? Problem with importing variable "Ammo"
-
Buenas!, les cuento que estoy teniendo un problema y no se cómo buscarlo en la wiki, y por eso recurro al foro. Lo que quiero hacer es varias paradas de recolección, y a partir de 30 segundos se le va a sumar 1 a cada parada de recolección. Estas paradas son de servidor para todos, y la idea es que cuando un jugador recolecta, se resta lo q habia sumado, para TODOS. Es decir el problema está que cuando al hacer un vector de parada X, se pone en Parada[X] ¿y ahí carga el dato, o no? Parada1 = 0 Parada2 = 0 Parada3 = 0 Parada4 = 0 function AgregarPasajeros() if (Parada1 < 8) then Parada1 = Parada1+1 if (Parada2 < 8) then Parada2 = Parada2+1 if (Parada3 < 8) then Parada3 = Parada3+1 if (Parada4 < 8) then Parada4 = Parada4+1 end end end end end addEventHandler("onResourceStart", getRootElement(AgregarPasajeros)) Timer = setTimer(AgregarPasajeros, 9000, 0) function FuncParada_58_A (DispPasajeros, pia) outputChatBox ("Se activa FUNC PARADA PRUEBA") outputChatBox ("La parada es:") outputChatBox (pia) if (Parada[pia] > 0) and (DispPasajeros > 0) then --Esto ¿? La "Parada[PIA]" con el pia que viene de cliente, está bien? outputChatBox ("Se cumple primera condicion") PasajSuben = 0 DispPasajeros = DispPasajeros -1 Parada[pia] = Parada[pia] -1 PasajSuben = PasajSuben +1 pia_server = pia setTimer ( SegundoPaso, 2000, 1, PasajSuben, pia_server) else if (Parada[pia] <= 0) or (DispPasajeros <= 0) then outputChatBox ("Se cumple segunda condicion") PasajSuben = 0 setTimer ( SegundoPaso, 1000, 1, PasajSuben, pia_server) else outputChatBox ("Algo falla") end end end addEvent( "HaciaServidor", true ) addEventHandler( "HaciaServidor", root, FuncParada_58_A )
-
- serverside
- variables
-
(and 1 more)
Tagged with:
-
function create() FO = createTeam ( "Forever", 255, 0, 0 ) AV = createTeam ( "Avalanche", 255, 255, 255 ) GH = createTeam ( "Ghost", 255, 123, 0 ) end function addplayer(player, cmd, target, clan) local recipient = getPlayerFromName(target) local accName = getAccountName ( getPlayerAccount ( recipient ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( clan ) ) then outputChatBox("* " .. recipientName .. " is already in your clan" , player, 255, 0, 0, true) else if recipient then local r, g, b local recipientName = getPlayerName(recipient) local playerName = getPlayerName(player) outputChatBox("*" .. recipientName .. " #FFFFFF has been added #FF0000" .. clan .. "#FFFFFF clan" , player, 255, 0, 0, true) outputChatBox("*" .. playerName .. " #FFFFFF added you to #FF0000" .. clan .. "#FFFFFF Clan", recipient, 255, 0, 0, true) setPlayerTeam ( recipient, clan ) r, g, b = getTeamColor (clan) setPlayerNametagColor ( recipient, r, g, b ) aclGroupAddObject (aclGetGroup(clan), "user."..accName) else outputChatBox("Sorry, we got 0 matches to the name" .. recipientName, player, 255, 0, 0) end end end function kickplayer(player, cmd, target, clan) local recipient = getPlayerFromName(target) local accName = getAccountName ( getPlayerAccount ( recipient ) ) -- get his account name local r,g,b if isObjectInACLGroup ("user."..accName, aclGetGroup ( clan ) ) then setPlayerTeam ( recipient, nil ) setPlayerNametagColor ( recipient, 225, 225, 225 ) aclGroupRemoveObject (aclGetGroup(clan), "user."..accName) else outputChatBox("The Player is Not in" .. clan .. "Clan" .. clan, player, 255, 0, 0) end end addCommandHandler("add", addplayer) addCommandHandler("ckick", kickplayer) addEventHandler ( "onResourceStart", getRootElement(), create ) This is a Clan system that i am working on, and when i run the script i get 2 errors , one is from the "setPlayerTeam" and the other one is from "GetTeamcolor" First One is : @ 'setPlayerTeam' [ Expected team at argument 2, got string 'AV' ] Second one is : @ 'getTeamColor' [Expected team at argument, got string 'AV'] Pls help me out , ik what this means but havent found a way to fix this And since This forum has helped me a lot , i am asking here , And also i would like to know a way to make this script to be able to Run for people In Acl group FOL , AVL and GHL ( which are clan leaders ) Thanks in Advance
- 2 replies
-
- setplayerteam
- teamcolor
-
(and 1 more)
Tagged with: