-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
function boss ( ) createTeam ( "Nemsis", 255, 0, 0 ) local Team = getTeamFromName ( "Nemsis" ) local nemesi = exports [ "slothbot" ]:spawnBot (1193.3, -2038.8, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) local nemesi1 = exports [ "slothbot" ]:spawnBot (1174.6, -2045.7, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) local nemesi2 = exports [ "slothbot" ]:spawnBot (1155.3, -2021, 69.0, 90, 1, 0, 0, Team, 38, "hunting", "following" ) local nemesi3 = exports [ "slothbot" ]:spawnBot (1137, -2038, 69, 90, 1, 0, 0, Team, 38, "hunting", "following" ) local botTeam = exports [ "slothbot" ]:getBotTeam ( nemesi ) if ( botTeam ) then outputChatBox ( "nemesi bot is on the team Nemsis" ) else outputChatBox ( "nemesi bot is not in a team." ) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), boss ) Try that.
-
What? I didn't get anything of what you just said.
-
Store that data on a table the way I mentioned above.
-
So, that means that the bot is not being set to that team.
-
Use a table, each time a player damages, store it on that table in a format: table [ victim ] = attacker, then on wasted, you check if the player that died is on that table.
-
First try to do it.
-
local deliverP = { --Los Santos {1787.7626953125, -2555.7822265625, 13}, {-1662.8570556641, -291.42846679688, 14}, {1448.5712890625, 1508.5714111328, 10}, } local PilotPlane = createVehicle ( 593, 1890.3594970703, -2493.8330078125, 13.53911781311 ) local data = { } function PilotDeliver ( thePlayer ) local team = getPlayerTeam ( thePlayer ) if ( team and getTeamName ( team ) == "Pilot" ) then if ( data [ thePlayer ] and isElement ( data [ thePlayer ].delBlip ) and isElement ( data [ thePlayer ].delmarker ) ) then return outputChatBox ( "You already got a destination.", thePlayer, 255, 0, 0 ) end local x, y, z = unpack ( deliverP [ math.random ( #deliverP ) ] ) data [ thePlayer ] = { delBlip = createBlip ( x, y, z, 51 ), delmarker = createMarker ( x, y, z, "cylinder", 5, 255, 160, 0, 100 ) } addEventHandler ( "onMarkerHit", data [ thePlayer ].delmarker, DelPayment ) outputChatBox ( "You have a new flight , go to location bliped on your map!", thePlayer, 255, 100, 0, true ) end end addCommandHandler ( "startshift", PilotDeliver ) function DelPayment ( hitElement ) if ( getElementType ( hitElement ) == "player" ) then local vehicle = getPedOccupiedVehicle ( hitElement ) if ( vehicle and getElementModel ( vehicle ) == 593 ) then local randomPay = math.random ( 2000, 5000 ) givePlayerMoney ( randomPay ) outputChatBox ( "You Arrived to your distenation , This is your payment".. tostring ( randomPay ) .."$", hitElement, 255, 100, 0, true ) if ( data [ hitElement ] ) then if isElement ( data [ hitElement ].delBlip ) then destroyElement ( data [ hitElement ].delBlip ) end if isElement ( data [ hitElement ].delmarker ) then destroyElement ( data [ hitElement ].delmarker ) end end end end end
-
local deliverP = { --Los Santos {1787.7626953125, -2555.7822265625, 13}, {-1662.8570556641, -291.42846679688, 14}, {1448.5712890625, 1508.5714111328, 10}, } local PilotPlane = createVehicle ( 593, 1890.3594970703, -2493.8330078125, 13.53911781311 ) local data = { } function PilotDeliver ( thePlayer ) local team = getPlayerTeam ( thePlayer ) if ( team and getTeamName ( team ) == "Pilot" ) then local x, y, z = unpack ( deliverP [ math.random ( #deliverP ) ] ) data [ thePlayer ] = { delBlip = createBlip ( x, y, z, 51 ), delmarker = createMarker ( x, y, z, "cylinder", 5, 255, 160, 0, 100 ) } addEventHandler ( "onMarkerHit", data [ thePlayer ].delmarker, DelPayment ) outputChatBox ( "You have a new flight , go to location bliped on your map!", thePlayer, 255, 100, 0, true ) end end addCommandHandler ( "startshift", PilotDeliver ) function DelPayment ( hitElement ) if ( getElementType ( hitElement ) == "player" ) then local vehicle = getPedOccupiedVehicle ( hitElement ) if ( vehicle and getElementModel ( vehicle ) == 593 ) then local randomPay = math.random ( 2000, 5000 ) givePlayerMoney ( randomPay ) outputChatBox ( "You Arrived to your distenation , This is your payment".. tostring ( randomPay ) .."$", hitElement, 255, 100, 0, true ) if ( data [ hitElement ] ) then if isElement ( data [ hitElement ].delBlip ) then destroyElement ( data [ hitElement ].delBlip ) end if isElement ( data [ hitElement ].delmarker ) then destroyElement ( data [ hitElement ].delmarker ) end end end end end
-
Remove this part: (hitElement == localPlayer) and, to check if the vehicle is a Dodo, use getElementModel.
-
Use getPlayerTeam + getTeamName.
-
Post what you tried.
-
function initiate ( ) local team = getPlayerTeam ( source ) if ( team ) then if ( countPlayersInTeam ( team ) == 1 ) then destroyElement ( team ) end end end addEventHandler ( "onPlayerQuit", getRootElement(), initiate )
-
Well, you'll have to do the same as I did with the timers, but with the texts.
-
http://pastebin.com/zZ1N4hC9
-
Post the code on pastebin.com, because the forums replaced some of the words with ":O".
-
Create a global table, then each time you jail someone, instead of using one variable, use the table and use the player as index.
-
The problem must be that it's using the same variable for all the timers.
-
That's because WASSim made a mistake. local x,y,z = 0, 0, 0 local colcircler = createColCircle ( x,y,z,50 ) local before function hit(hitElement, matchingDimension) if (getElementType ( hitElement ) == "vehicle") then local oldmaxVelocity = getVehicleHandlingProperty ( hitElement, "maxVelocity" ) setElementData(hitElement, "maxVelocity", oldmaxVelocity) setVehicleHandling ( hitElement, "maxVelocity", value ) end end addEventHandler("onColShapeHit", colcircler, hit) function leave(leaveElement, matchingDimension) if (getElementType ( leaveElement ) == "vehicle") then local oldmaxVelocity = getElementData(leaveElement, "maxVelocity"); if (oldmaxVelocity) then setVehicleHandling ( leaveElement, "maxVelocity", oldmaxVelocity ) end end end addEventHandler("onColShapeLeave", colcircler, leave) function getVehicleHandlingProperty ( element, property ) if isElement ( element ) and getElementType ( element ) == "vehicle" and type ( property ) == "string" then -- Make sure there's a valid vehicle and a property string local handlingTable = getVehicleHandling ( element ) -- Get the handling as table and save as handlingTable local value = handlingTable[property] -- Get the value from the table if value then -- If there's a value (valid property) return value -- Return it end end return false -- Not an element, not a vehicle or no valid property string. Return failure end
-
Yes, that's what I meant.
-
function boss ( ) local Team = createTeam ( "Nemsis", 255, 0, 0 ) local nemesi = exports ["slothBot"]:spawnBot (1193.3, -2038.8, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") local nemesi1 = exports ["slothBot"]:spawnBot (1174.6, -2045.7, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") local nemesi2 = exports ["slothBot"]:spawnBot (1155.3, -2021, 69.0, 90, 1, 0, 0, Team, 38, "hunting", "following") local nemesi3 = exports ["slothBot"]:spawnBot (1137, -2038, 69, 90, 1, 0, 0, Team, 38, "hunting", "following") local botTeam = exports [ "slothbot" ]:getBotTeam ( nemesi ) if ( botTeam ) then outputChatBox ( "nemesi bot is on the team Nemsis" ) else outputChatBox ( "nemesi bot is not in a team." ) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), boss ) Try that and see what it outputs to the chatbox when you start the resource. P.S: Bots won't show up on the scoreboard ( TAB ).