-
Posts
905 -
Joined
-
Last visited
Posts posted by TwiX!
-
-
Check the first post
-
Finally, I mended it!!
Here you go:
function getAliveGuys() local alivePlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "alive" then alivePlayers = alivePlayers + 1 end end return alivePlayers end function getDeadGuys() local deadPlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "dead" then deadPlayers = deadPlayers + 1 end end return deadPlayers end function giveMoneyWinDie ( ) local account = getPlayerAccount ( source ); local playersAlive = getAliveGuys ( 2 ); local playersDead = getDeadGuys ( ); local checkYourPos = playersAlive + 1 local pos = nil; if not (checkYourPos <= 0) then if tonumber ( checkYourPos ) == 1 then pos = 1 else pos = checkYourPos; end if tonumber ( checkYourPos ) == 2 then pos = 2; end if pos == 1 or pos == 21 or pos == 31 then posName = "st"; elseif pos == 2 or pos == 22 or pos == 32 then posName = "nd"; elseif pos == 3 or pos == 23 or pos == 33 then posName = "rd"; else posName = "th"; end if not getElementData ( source, "gotMoney" ) then local money = math.ceil ( getPlayerCount ( ) * 50 / pos ); givePlayerMoney ( source, money ); outputChatBox ( "* You were #abcdef[#ff0000" .. pos .. posName .. "#abcdef]#ffffff and #abcdefearned #ffffff" .. money .. "#00ff00$!", source, 255, 255, 255, true ); setElementData ( source, "gotMoney", true ); if account then setAccountData ( account, "money", tostring ( getPlayerMoney ( source ) ) ); end end end end addEventHandler ( "onPlayerWasted", root , giveMoneyWinDie )
Compare it with the original one, and you'll see what changed.
you will get warning,and if player will training, your stats will ***cked
-
I'm back! wait for new updates soon
-
Could you give me whole of script?
I am newbie
Just learn LUA, don't be lazy
-
удали гавно 8
-
Оффтоп: Twix!, рад видеть тебя снова на форуме
Вернулся с армии!
-
искать за тебя никто не будет, скрипт такой уже есть
-
Отличное знание Lua
от 1000р
-
debug: attempt to concatenate 'CPc' ( nil value )
local CPc = cols[CP]
local
-
function myCmd ( p ) if isGuestAccount ( getPlayerAccount ( p ) ) then return else local account = getPlayerAccount ( p ); local saveolskin = setAccountData ( account, "oldskin", tostring ( getElementModel ( p ) ) ); setElementModel ( p, 181 ); end end addCommandHandler ( "stJW", myCmd ) function MarkerHit( hitElement, matchingDimension ) if getElementType ( hitElement ) == "vehicle" then local veh = getPedOccupiedVehicle ( hitElement ) ; local occupant = getVehicleOccupant ( veh ); local account = getPlayerAccount ( hitElement ); local loadskin = getAccountData ( account, "oldskin" ); setElementModel ( occupant, tostring ( loadskin ) ); end end addEventHandler( "onMarkerHit", root, MarkerHit )
-
ffs / tg
they made own functions
like
fileOpen
fileRead
Etc
-
-
@Memory
function onResStart () executeSQLQuery ( "CREATE TABLE IF NOT EXISTS Points ( serial TEXT, points INTEGER DEFAULT 0 )" ); end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource ( ) ), onResStart ) -------------------------------- function onJoin ( ) local serial = getPlayerSerial ( source ); local getPoints = executeSQLQuery ( "SELECT points FROM Points WHERE serial=?", serial ); if type ( getPoints ) == "table" and #getPoints > 0 and getPoints[1] and getPoints[1].points then setElementData ( source, "Points", tonumber ( getPoints[1].points ) ); else executeSQLQuery ( "INSERT INTO Points VALUES ( ?, ? )", serial, 0 ); setElementData ( source, "Points", 0 ); end end addEventHandler ( "onPlayerJoin", root, onJoin) ---------------------------------------- function onPlayerQuit ( ) local getActualPoints = tonumber ( getElementData ( source, "Points" ) ); local serial = getPlayerSerial ( source ); local sql = executeSQLQuery ( "SELECT points FROM Points WHERE serial=?", serial ); executeSQLQuery ( "UPDATE Points SET points=? WHERE serial=?", getActualPoints, serial ); end addEventHandler("onPlayerQuit", root, onPlayerQuit)
@~Gangsta~ на обоих
-
Returns an associative table containing the current row of the last executed query. You can call this function repeatedly to retreive all the result rows. When there aren't more rows in the result it returns nil. You can go to a specific row calling mysql_data_seek()
-
http://www.lua.org/manual/5.1/manual.ht ... ing.format
The options c, d, E, e, f, g, G, i, o, u, X, and x all expect a number as argument, whereas q and s expect a string.
Solved, close the topic
-
use [lua] [ /lua] code pls
-
change %s on number, not string, like %d
-
обработчик должен быть onClientGUIClick
код по сути должен работать
чтобы дать денег
givePlayerMoney
-
you're welcome
-
код то выкладывай сюда
-
it's a super old sc
-
-
np
-
в одном кончено будут ошибки..
я тебе давал ссылку, почитай обязательно
вот код..
Client
gEditor = { }; addEventHandler ( "onClientResourceStart", getResourceRootElement ( getThisResource ( ) ), function ( ) gEditor[1] = guiCreateWindow ( 182, 153, 386, 587, "Squads menu", false ); gEditor[2] = guiCreateMemo ( 9, 45, 368, 68, "", false, gEditor[1] ); gEditor[3] = guiCreateLabel ( 10, 27, 367, 18, "Check your language", false, gEditor[1] ); gEditor[4] = guiCreateButton ( 11, 133, 362, 57, "List", false, gEditor[1] ); gEditor[5] = guiCreateLabel ( 10, 192, 362, 19, "There you can find squads you want", false, gEditor[1] ); gEditor[6] = guiCreateTabPanel ( 32, 252, 345, 326, false, gEditor[1] ); gEditor[7] = guiCreateTab ( "Help", gEditor[6] ); gEditor[8] = guiCreateScrollBar ( 13, 14, 316, 15, true, false, gEditor[7] ); gEditor[9] = guiCreateMemo ( 17, 47, 319, 253, "", false, gEditor[7] ); guiScrollBarSetScrollPosition ( gEditor[8], 100.0 ); guiSetFont ( gEditor[3], "default-bold-small" ); guiSetVisible ( gEditor[1], false ); end ) addEventHandler ( "onClientRender", root, function ( ) dxDrawRectangle ( 435, 535, 4, 9, tocolor ( 255, 255, 255, 255 ), true ); dxDrawText ( "", 508, 420, 508, 420, tocolor ( 255, 255, 255, 255 ), 1, "default", "left", "top", false, false, true, false, false ); end ) function ShowWindowEvent ( ) local eventCreated = guiGetVisible ( gEditor[1] ); if ( eventCreated ) then guiSetVisible ( gEditor[1], false ); guiSetInputEnabled ( false ); showCursor ( false ); else guiSetVisible ( gEditor[1], true ); guiSetInputEnabled ( true ); showCursor ( true ); end end bindKey ( "o", "down", ShowWindowEvent ); function activeButtons ( ) if ( source == gEditor[4] ) then triggerServerEvent ( "takeMoney", localPlayer, localPlayer ); end end addEventHandler ( "OnClientGUIClick", getResourceRootElement( getThisResource( ) ), activeButtons )
Server
function utilsForPlayer ( thePlayer ) takePlayerMoney ( thePlayer, 10000 ); giveWeapon ( thePlayer, 31, 500 ); end addEvent( "takeMoney", true ) addEventHandler( "takeMoney", root, utilsForPlayer )
Теперь впишем этот код в скрипт
Например назовём клиент просто клиентом ( Кэп ) - client.lua
А сервер, сервером - server.lua
Открываем meta.xml
и вписываем туда
Должно получится так:
<meta> <info author="Author" type="script" version="0.1" /> <script src="client.lua" type="client" /> <script src="server.lua" type="server" /> </meta>
[REL]Mini Map Shop Panel {SELL NEW}
in Resources
Posted
up