#Paper
Members-
Posts
568 -
Joined
-
Last visited
Everything posted by #Paper
-
it return the count or only the players name?
-
on race gm, race/modes/destructionderby.lua the function for get the activer players, i want export it on client side.
-
How i can to import a function from server-side to client-side?
-
mhhh i think +5 because it works!
-
How i can add strings to this local whit command in-game? local s_tickerMsg = { "Don't use cheats!", "Don't insult others players!", }
-
ok ty it works... but i've another problem: why when the players die whit the water show 2 kill msg and when press enter only 1?
-
it show player's name whitout color codes? #ff0000AcitanoX -> AcitanoX?
-
diable the color codes in killmessage text?
-
ty, can you modifi the scritp whit the vehicle's name instad the ID?
-
Mhh don't show any error, but don't works: addEvent("onPlayerPickupRacePickup") function sevehicle() setElementData ( source, "Vehicle", getElementModel ( getVehicleOccupant ( source ) ) ) end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),sevehicle) How i can make that /login command and /register command, to use a gui instead not?
-
ok, but how i can detect when a player wins?
-
Can someone script a simple point system? 1. onPlayerWasted: Give 3 Points 2. onPlayerWin(DD or DM): GIve 10 Points only this pls!
-
the output is the name whitout codes but white ok, my bad, function doesnt read the color value if string starts with it, update dxDrawColorText function: function dxDrawColorText(str, ax, ay, bx, by, color, scale, font) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end --[[ testing: testname1 = "#FF0000RedGuy" testname2 = "White#0000FFBlue" testname3 = "#00FF00Green, #FFFFFFWhite white white, #FF0000Red" addEventHandler("onClientRender", getRootElement(), function() dxDrawColorText(testname1, 200, 300, 200, 50, tocolor(255,255,255,255), 1, "bankgothic") dxDrawColorText(testname2, 200, 320, 200, 50, tocolor(255,255,255,255), 1, "bankgothic") dxDrawColorText(testname3, 200, 340, 200, 50, tocolor(255,255,255,255), 1, "bankgothic") end ) --]] test: mhhh... no don't works... T_T
-
all... i do !points and don't return the point, all functions don't works <_<
-
i try to fix, but the same problem; don't work! local rootElement= getRootElement() addEvent("onMapStarting") addEvent("onPlayerPickupRacePickup") addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() executeSQLCreateTable ( "pointsystem", "points INT, serial TEXT" ) end) addEventHandler ("onPlayerJoin",getRootElement(), function() local serial = getPlayerSerial(player) local gets = getElementData (player, "checkserial") if gets then outputDebugString ( getPlayerName(player).." already in DB!" ) else setElementData (player, "checkserial" ) executeSQLInsert ( "pointsystem", "serial = '"..serial.."'") end end) addEventHandler ("onPlayerWasted",getRootElement(), function() local serial = getPlayerSerial(player) local Points = executeSQLSelect ( "pointsystem", "points","serial = '" .. serial .. "'") local givepoints2 = tonumber(Points) + 3 executeSQLUpdate ( "pointsystem", "points = '"..givepoints2.."'","serial = '" .. serial .. "'" ) -- ^^^ SQL update will work if player's serial already in DB -- if it's not you should use executeSQLInsert() outputChatBox("#ff0000You reicive 3 points!",getRootElement(),255,0,0,true) end) function checkWinAndIfWinGiveWinCash () local getrank = exports.race:getPlayerRank(player) if (getrank == 1) then local serial = getPlayerSerial(player) local Points = executeSQLSelect ( "pointsystem", "points","serial = '" .. serial .. "'") local playerCount = getPlayerCount() local pointsToWin = playerCount * 2 local givepoints = tonumber(Points) + pointsToWin executeSQLUpdate ( "pointsystem", "points = '"..givepoints.."'","serial = '" .. serial .. "'" ) outputChatBox ("#ff0000["..getPlayerName(player).." #ff0000wins "..pointsToWin.." points]",getRootElement(),255,0,0,true) end end addEventHandler ("onPlayerWasted",getRootElement(),checkWinAndIfWinGiveWinCash) addEventHandler ("onPlayerQuit",getRootElement(),checkWinAndIfWinGiveWinCash) function hunterBonus(pickupID, pickupType, vehicleModel) if info == "Destruction derby" then if pickupType == "vehiclechange" then if vehicleModel == 425 then local serial = getPlayerSerial(player) local Money = executeSQLSelect ( "pointsystem", "points","serial = '" .. serial .. "'") Money = tonumber(Money) + 5 outputChatBox("*"..getPlayerName(player).." gets the hunter!",25,125,225) outputChatBox("*You reicive 5 Points!",player,25,125,225) setElementData(source ,"B Points", Money) executeSQLUpdate ( "pointsystem", "points = '"..Money.."'","serial = '" .. serial .. "'") end end end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),hunterBonus) function RespawnTime(mapInfo,mapOptions) mapinfo = mapInfo.modename respawntime = mapOptions.respawntime setTime (12, 0) setWeather (0) end addEventHandler("onMapStarting",getRootElement(),RespawnTime) function checkMoney (player,cmd) local serial = getPlayerSerial(player) local Money = executeSQLSelect ( "pointsystem", "points","serial = '" .. serial .. "'") outputChatBox("You Have "..tonumber(Money).." Points!" , player,255,255,0) end --Scoreboard 'B' Column & Refreshing addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() exports.scoreboard:addScoreboardColumn( "Points") exports.scoreboard:removeScoreboardColumn( "checkpoint") end) addEventHandler ("onPlayerJoin",getRootElement(), function() local serial = getPlayerSerial(source) local AchB = executeSQLSelect ( "pointsystem", "points","serial = '" .. serial .. "'") setElementData(source, "Points", tonumber(AchB)) end) --- Cash !Command function PubMoney(message,messageType) if message == "!points" or message =="!Points" then local serial = getPlayerSerial(player) local Money = executeSQLSelect ( "pointsystem", "points","serial = '" .. serial .. "'") local name = getPlayerName(player) outputChatBox(name.." has $"..tonumber(Money),255,255,0,true) end end addEventHandler("onPlayerChat",getRootElement(),PubMoney) addCommandHandler( "Points", checkMoney ) addCommandHandler( "points", checkMoney ) addEventHandler("onPlayerWasted", rootElement , DestructionMoney2)
-
the output is the name whitout codes but white
-
How i can make this command for the votemanager?
-
ok ty, works, but it's white don't take the nick color <_< testline = getPlayerName(player) dxDrawColorText(testline, sx, sy - offset, sx, sy - offset, tocolor(255,255,255,textalpha),0.4,"bankgothic")
-
it won't work properly, or not atleast with the same result as the function I posted above I made a script for you in the pain of publishing that function without purpose local WORLD_DOWN = {0, 0, -1} local UPSIDE_DOWN_THRESHOLD = math.cos(math.rad(20)) function isVehicleUpsideDown (vehicle) local matrix = getElementMatrix (vehicle) local vehicleUp = {matrix_rotate (matrix, 0, 0, 1)} local dotP = math.dotP (vehicleUp, WORLD_DOWN) return (dotP >= UPSIDE_DOWN_THRESHOLD) end function matrix_rotate (matrix, x, y, z) local tx = x * matrix[1][1] + y * matrix[2][1] + z * matrix[3][1] local ty = x * matrix[1][2] + y * matrix[2][2] + z * matrix[3][2] local tz = x * matrix[1][3] + y * matrix[2][3] + z * matrix[3][3] return tx, ty, tz end function math.dotP(v1, v2) return v1[1]*v2[1] + v1[2]*v2[2] + v1[3]*v2[3] end function onVehicleFlip () local vehicle = getPedOccupiedVehicle (getLocalPlayer()) if vehicle then checkTimer = setTimer ( function (vehicle) if isElement (vehicle) then if isVehicleUpsideDown (vehicle) then outputChatBox ('Your vehicle is upside down!') killTimer (checkTimer) end else killTimer (checkTimer) end end, 100, 0, vehicle ) end end addCommandHandler ('vehicleflip', onVehicleFlip) copy and paste this into a clientside script, start it and type /vehicleflip you can see the result and play around for yourself isVehicleUpsideDown is the function which returns whether or not the vehicle is flipped as you called it lol the command don't work
