Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. You already have a topic here: viewtopic.php?f=108&t=38307 Why did you create another related to the same thing?
  2. porton = createObject ( 968, 1811.3994140625, -1886.7998046875, 13.10000038147, 0, 270, 90) function ptaxi () local rx, ry, rz = getElementRotation(porton) if (math.floor(ry) == 270 and math.floor(rz) == 90) then moveObject(porton, 3000, 1811.3994140625, -1886.7998046875, 13.10000038147, 0, 90, 0) setTimer(moveObject, 7000, 1, porton, 3000, 1811.3994140625, -1886.7998046875, 13.10000038147, 0, -90, 0) end end addCommandHandler ("ptaxi", ptaxi)
  3. What do you mean? that error means you're trying to compare two userdata (like 2 teams, not their players).
  4. Are you sure that these teams exists? and the player is valid?
  5. Mind posting the exact error you're getting?
  6. Not sure, maybe this could help? https://wiki.multitheftauto.com/wiki/Math.round You can also use math.floor(number)
  7. What do you mean? you wanted a 5 seconds delay, you have it, and now you're asking for the same thing? Or zombies doesn't spawn one by one?
  8. Yeah, I forgot about that, now it should work fine. Copy it again.
  9. Castillo

    ID Of Pickup !

    That's not a pickup, must be a custom object replaced with engine functions.
  10. Ok, I think I've fixed it: ZombieLimit = get("zombies.MaxZombies")-- HOW MANY ZOMBIES SHOULD EXIST AT MAXIMUM? ZombieStreaming = get("zombies.StreamMethod") -- 1 to constantly stream zombies, 0 to only allow zombies to spawn via -- createZombie function, 2 to only allow spawning at set spawnpoints ZombiePedSkins = {13,22,56,67,68,70,92,97,105,108,126,127,152,162,167,188,195,206,209,212,229,230,258} --ALTERNATE SKIN --LISTS FOR ZOMBIES (SHORTER LIST IS TEXTURED ZOMBIES ONLY) --[[ ZombiePedSkins = { 7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,36,37,38,49,50,51, 52,53,54,55,56,57,58,59,60,61,62,63,64,66,67,68,70,71,72,73,75,76,77,78,79,80,81,82,83,85,87,88,89,90,91,92,93,94,95,96,97,98,9 9,100,101,102,103,104,105,106,108,109,110,112,113,114,115,116,117,118,120,121,122,123,124,125,126,127,129,130,131,132,133, 134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,153,154,155,156,157,158,159,161,162,163,164,165,1 66,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,193,194,195,196,19 7,198,199,200,201,202,203,204,205,206,207,209,210,211,212,213,214,215,216,217,218,219,229,230,231,232,233,234,235,236,237, 238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,275,276,279,281,2 82,283,284,285,286,288 } --]] ZombieSpeed = get("zombies.Speed") if ZombieSpeed == 0 then --super slow zombies (goofy looking) chaseanim = "WALK_drunk" checkspeed = 2000 elseif ZombieSpeed == 1 then -- normal speed chaseanim = "run_old" checkspeed = 1000 elseif ZombieSpeed == 2 then -- rocket zombies (possibly stressful on server) chaseanim = "Run_Wuzi" checkspeed = 680 else -- defaults back to normal chaseanim = "run_old" checkspeed = 1000 end resourceRoot = getResourceRootElement() moancount =0 moanlimit = 10 everyZombie = { } --IDLE BEHAVIOUR OF A ZOMBIE function Zomb_Idle (ped) if isElement(ped) then if ( getElementData ( ped, "status" ) == "idle" ) and ( isPedDead ( ped ) == false ) and (getElementData(ped, "zombie") == true) then local action = math.random( 1, 6 ) if action < 4 then -- walk a random direction local rdmangle = math.random( 1, 359 ) setPedRotation( ped, rdmangle ) setPedAnimation ( ped, "PED", "Player_Sneak", -1, true, true, true) setTimer ( Zomb_Idle, 7000, 1, ped ) elseif action == 4 then -- get on the ground setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, true) setTimer ( Zomb_Idle, 4000, 1, ped ) elseif action == 5 then -- stand still doing nothing setPedAnimation ( ped ) setTimer ( Zomb_Idle, 4000, 1, ped ) end end end end --BEHAVIOUR WHILE CHASING PLAYERS function Zomb_chase (ped, Zx, Zy, Zz ) if isElement(ped) then if (getElementData ( ped, "status" ) == "chasing") and (getElementData (ped, "zombie") == true) then local x, y, z = getElementPosition( ped ) if (getElementData ( ped, "target" ) == nil) and getElementData ( ped, "Tx" ) ~= false then local Px = getElementData ( ped, "Tx" ) local Py = getElementData ( ped, "Ty" ) local Pz = getElementData ( ped, "Tz" ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, x, y, z )) if (Pdistance < 1.5 ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) end end local distance = (getDistanceBetweenPoints3D( x, y, z, Zx, Zy, Zz )) if (distance < 1 ) then -- IF THE PED HASNT MOVED if (getElementData ( ped, "target" ) == nil) then local giveup = math.random( 1, 15 ) if giveup == 1 then setElementData ( ped, "status", "idle" ) else local action = math.random( 1, 2 ) if action == 1 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 3500, 1, ped, x, y, z ) end end else local Ptarget = (getElementData ( ped, "target" )) if isElement(Ptarget) then local Px, Py, Pz = getElementPosition( Ptarget ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz )) if (Pdistance < 1.2 ) then -- ATTACK A PLAYER IF THEY ARE CLOSE if ( isPedDead ( Ptarget ) ) then --EAT A DEAD PLAYER setPedAnimation ( ped ) setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, false) setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 10000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 10000, 1, ped ) zmoan(ped) else local action = math.random( 1, 6 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) else setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) end end else if ( isPedDead (Ptarget) ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 1800, 1, ped ) else local action = math.random( 1, 2 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) end end end else setElementData ( ped, "status", "idle" ) end end else setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true) --KEEP WALKING setTimer ( Zomb_chase, checkspeed, 1, ped, x, y, z ) --CHECK AGAIN end end end end --SET THE DIRECTION OF THE ZOMBIE function setangle () for theKey,ped in ipairs(everyZombie) do if isElement(ped) then if ( getElementData ( ped, "status" ) == "chasing" ) then local x local y local z local px local py local pz if ( getElementData ( ped, "target" ) ~= nil ) then local ptarget = getElementData ( ped, "target" ) if isElement(ptarget) then x, y, z = getElementPosition( ptarget ) px, py, pz = getElementPosition( ped ) else setElementData ( ped, "status", "idle" ) x, y, z = getElementPosition( ped ) px, py, pz = getElementPosition( ped ) end zombangle = ( 360 - math.deg ( math.atan2 ( ( x - px ), ( y - py ) ) ) ) % 360 -- --MAGIC SPELL TO MAKE PEDS LOOK AT YOU setPedRotation( ped, zombangle ) elseif ( getElementData ( ped, "target" ) == nil ) and (getElementData ( ped, "Tx" ) ~= false) then --IF THE PED IS AFTER THE PLAYERS LAST KNOWN WHEREABOUTS x = getElementData ( ped, "Tx" ) y = getElementData ( ped, "Ty" ) z = getElementData ( ped, "Tz" ) px, py, pz = getElementPosition( ped ) zombangle = ( 360 - math.deg ( math.atan2 ( ( x - px ), ( y - py ) ) ) ) % 360 -- --MAGIC SPELL TO MAKE PEDS LOOK AT YOU setPedRotation( ped, zombangle ) end end end end end --SETS THE ZOMBIE ACTIVITY WHEN STATUS CHANGES addEventHandler ( "onElementDataChange", getRootElement(), function ( dataName ) if getElementType ( source ) == "ped" and dataName == "status" then if (getElementData (source, "zombie") == true) then if ( isPedDead ( source ) == false ) then if (getElementData ( source, "status" ) == "chasing" ) then local Zx, Zy, Zz = getElementPosition( source ) setTimer ( Zomb_chase, 1000, 1, source, Zx, Zy, Zz ) local newtarget = (getElementData ( source, "target" )) if isElement (newtarget) then if getElementType ( newtarget ) == "player" then setElementSyncer ( source, newtarget ) end
  11. Try this: function enterVehicle ( theVehicle, seat, jacked) if ( policeVehicles[getElementModel ( theVehicle )] ) and (policeSkins[getElementModel ( source )] ) then timers[source] = setTimer(payThePlayer,60000,0,source) elseif ( FireCars[getElementModel ( theVehicle )] ) and (FireSkins[getElementModel ( source )] ) then timers[source] = setTimer(payThePlayer1,60000,0,source) elseif ( medicCars[getElementModel ( theVehicle )] ) and (medicSkins[getElementModel ( source )] ) then timers[source] = setTimer(payThePlayer2,60000,0,source) else removePedFromVehicle ( source ) -- force the player out of the vehicle outputChatBox("You're not allowed to use this vehicle", source) end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enterVehicle )
  12. Ok, I fixed all the comments that wasn't commented out. Copy the script again.
  13. Try this: function enterVehicle ( theVehicle, seat, jacked) if ( policeVehicles[getElementModel ( theVehicle )] ) and (policeSkins[getElementModel ( source )] ) then timers[source] = setTimer(payThePlayer,60000,0,source) else removePedFromVehicle ( source ) -- force the player out of the vehicle outputChatBox ( "Jus ne policininkas!", source ) -- end if ( FireCars[getElementModel ( theVehicle )] ) and (FireSkins[getElementModel ( source )] ) then timers[source] = setTimer(payThePlayer1,60000,0,source) else removePedFromVehicle ( source ) -- force the player out of the vehicle outputChatBox ( "Just ne gaisrininkas!", source ) -- end if ( medicCars[getElementModel ( theVehicle )] ) and (medicSkins[getElementModel ( source )] ) then timers[source] = setTimer(payThePlayer2,60000,0,source) else removePedFromVehicle ( source ) -- force the player out of the vehicle outputChatBox ( "Just ne medikas!", source ) -- end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enterVehicle )
  14. That line was meant to be commented out if I'm right, that's what I'd, copy my code again .
  15. Try this, not sure if it'll work. ZombieLimit = get("zombies.MaxZombies")-- HOW MANY ZOMBIES SHOULD EXIST AT MAXIMUM? ZombieStreaming = get("zombies.StreamMethod") -- 1 to constantly stream zombies, 0 to only allow zombies to spawn via -- createZombie function, 2 to only allow spawning at set spawnpoints ZombiePedSkins = {13,22,56,67,68,70,92,97,105,108,126,127,152,162,167,188,195,206,209,212,229,230,258} --ALTERNATE SKIN --LISTS FOR ZOMBIES (SHORTER LIST IS TEXTURED ZOMBIES ONLY) --[[ ZombiePedSkins = { 7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,36,37,38,49,50,51, 52,53,54,55,56,57,58,59,60,61,62,63,64,66,67,68,70,71,72,73,75,76,77,78,79,80,81,82,83,85,87,88,89,90,91,92,93,94,95,96,97,98,9 9,100,101,102,103,104,105,106,108,109,110,112,113,114,115,116,117,118,120,121,122,123,124,125,126,127,129,130,131,132,133, 134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,153,154,155,156,157,158,159,161,162,163,164,165,1 66,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,193,194,195,196,19 7,198,199,200,201,202,203,204,205,206,207,209,210,211,212,213,214,215,216,217,218,219,229,230,231,232,233,234,235,236,237, 238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,275,276,279,281,2 82,283,284,285,286,288 } --]] ZombieSpeed = get("zombies.Speed") if ZombieSpeed == 0 then --super slow zombies (goofy looking) chaseanim = "WALK_drunk" checkspeed = 2000 elseif ZombieSpeed == 1 then -- normal speed chaseanim = "run_old" checkspeed = 1000 elseif ZombieSpeed == 2 then -- rocket zombies (possibly stressful on server) chaseanim = "Run_Wuzi" checkspeed = 680 else -- defaults back to normal chaseanim = "run_old" checkspeed = 1000 end resourceRoot = getResourceRootElement() moancount =0 moanlimit = 10 everyZombie = { } --IDLE BEHAVIOUR OF A ZOMBIE function Zomb_Idle (ped) if isElement(ped) then if ( getElementData ( ped, "status" ) == "idle" ) and ( isPedDead ( ped ) == false ) and (getElementData(ped, "zombie") == true) then local action = math.random( 1, 6 ) if action < 4 then -- walk a random direction local rdmangle = math.random( 1, 359 ) setPedRotation( ped, rdmangle ) setPedAnimation ( ped, "PED", "Player_Sneak", -1, true, true, true) setTimer ( Zomb_Idle, 7000, 1, ped ) elseif action == 4 then -- get on the ground setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, true) setTimer ( Zomb_Idle, 4000, 1, ped ) elseif action == 5 then -- stand still doing nothing setPedAnimation ( ped ) setTimer ( Zomb_Idle, 4000, 1, ped ) end end end end --BEHAVIOUR WHILE CHASING PLAYERS function Zomb_chase (ped, Zx, Zy, Zz ) if isElement(ped) then if (getElementData ( ped, "status" ) == "chasing") and (getElementData (ped, "zombie") == true) then local x, y, z = getElementPosition( ped ) if (getElementData ( ped, "target" ) == nil) and getElementData ( ped, "Tx" ) ~= false then local Px = getElementData ( ped, "Tx" ) local Py = getElementData ( ped, "Ty" ) local Pz = getElementData ( ped, "Tz" ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, x, y, z )) if (Pdistance < 1.5 ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) end end local distance = (getDistanceBetweenPoints3D( x, y, z, Zx, Zy, Zz )) if (distance < 1 ) then -- IF THE PED HASNT MOVED if (getElementData ( ped, "target" ) == nil) then local giveup = math.random( 1, 15 ) if giveup == 1 then setElementData ( ped, "status", "idle" ) else local action = math.random( 1, 2 ) if action == 1 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped ) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 3500, 1, ped, x, y, z ) end end else local Ptarget = (getElementData ( ped, "target" )) if isElement(Ptarget) then local Px, Py, Pz = getElementPosition( Ptarget ) local Pdistance = (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz )) if (Pdistance < 1.2 ) then -- ATTACK A PLAYER IF THEY ARE CLOSE if ( isPedDead ( Ptarget ) ) then --EAT A DEAD PLAYER setPedAnimation ( ped ) setPedAnimation ( ped, "MEDIC", "cpr", -1, false, true, false) setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 10000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 10000, 1, ped ) zmoan(ped) else local action = math.random( 1, 6 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) else setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) end end else if ( isPedDead (Ptarget) ) then setTimer ( function (ped) if ( isElement ( ped ) ) then setElementData ( ped, "status", "idle" ) end end, 2000, 1, ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedRotation ( ped, getPedRotation(ped)-180) end end, 1800, 1, ped ) else local action = math.random( 1, 2 ) if action == 1 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Punch", getRootElement(), ped ) setTimer ( function (ped) if ( isElement ( ped ) ) then setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true ) end end, 800, 1, ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) elseif action == 2 then setPedAnimation ( ped) triggerClientEvent ( "Zomb_Jump", getRootElement(), ped ) setTimer ( Zomb_chase, 2000, 1, ped, x, y, z ) end end end else setElementData ( ped, "status", "idle" ) end end else setPedAnimation ( ped, "ped", chaseanim, -1, true, true, true) --KEEP WALKING setTimer ( Zomb_chase, checkspeed, 1, ped, x, y, z ) --CHECK AGAIN end end end end --SET THE DIRECTION OF THE ZOMBIE function setangle () for theKey,ped in ipairs(everyZombie) do if isElement(ped) then if ( getElementData ( ped, "status" ) == "chasing" ) then local x local y local z local px local py local pz if ( getElementData ( ped, "target" ) ~= nil ) then local ptarget = getElementData ( ped, "target" ) if isElement(ptarget) then x, y, z = getElementPosition( ptarget ) px, py, pz = getElementPosition( ped ) else setElementData ( ped, "status", "idle" ) x, y, z = getElementPosition( ped ) px, py, pz = getElementPosition( ped ) end zombangle = ( 360 - math.deg ( math.atan2 ( ( x - px ), ( y - py ) ) ) ) % 360 -- --MAGIC SPELL TO MAKE PEDS LOOK AT YOU setPedRotation( ped, zombangle ) elseif ( getElementData ( ped, "target" ) == nil ) and (getElementData ( ped, "Tx" ) ~= false) then --IF THE PED IS AFTER THE PLAYERS LAST KNOWN WHEREABOUTS x = getElementData ( ped, "Tx" ) y = getElementData ( ped, "Ty" ) z = getElementData ( ped, "Tz" ) px, py, pz = getElementPosition( ped ) zombangle = ( 360 - math.deg ( math.atan2 ( ( x - px ), ( y - py ) ) ) ) % 360 -- --MAGIC SPELL TO MAKE PEDS LOOK AT YOU setPedRotation( ped, zombangle ) end end end end end --SETS THE ZOMBIE ACTIVITY WHEN STATUS CHANGES addEventHandler ( "onElementDataChange", getRootElement(), function ( dataName ) if getElementType ( source ) == "ped" and dataName == "status" then if (getElementData (source, "zombie") == true) then if ( isPedDead ( source ) == false ) then if (getElementData ( source, "status" ) == "chasing" ) then local Zx, Zy, Zz = getElementPosition( source ) setTimer ( Zomb_chase, 1000, 1, source, Zx, Zy, Zz ) local newtarget = (getElementData ( source, "target" )) if isElement (newtarget) then if getElementType ( newtarget ) == "player" then setElementSyncer ( source, newtarget ) end
  16. Try this: local timers = {} function enterVehicle ( theVehicle, seat, jacked) if ( policeVehicles[getElementModel ( theVehicle )] ) and (policeSkins[getElementModel ( source )] ) then timers[source] = setTimer(payThePlayer,60000,0,source) else removePedFromVehicle ( source ) -- force the player out of the vehicle outputChatBox ( "Tu ne gaisrininkas!", source ) -- end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enterVehicle ) addEventHandler("onPlayerQuit",root, function () if isTimer(timers[source]) then killTimer(timers[source]) end end) function payThePlayer(thePlayer) if (not thePlayer) then if isTimer(timers[thePlayer]) then killTimer(timers[thePlayer]) end return end setElementData(thePlayer,"MONEY",tonumber(getElementData(thePlayer, "MONEY"))+180) outputChatBox ( "Jus gavote alga 180Lt!", thePlayer ) end
  17. That's because I set it to only run the timer once. And also I set it to 5 seconds, not 1 minute. function enterVehicle ( theVehicle, seat, jacked) if ( policeVehicles[getElementModel ( theVehicle )] ) and (policeSkins[getElementModel ( source )] ) then setTimer(payThePlayer,60000,0,source) else removePedFromVehicle ( source ) -- force the player out of the vehicle outputChatBox ( "Tu ne gaisrininkas!", source ) -- end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), enterVehicle ) -- function payThePlayer(thePlayer) if (not thePlayer) then return end setElementData(thePlayer,"MONEY",tonumber(getElementData(thePlayer, "MONEY"))+180) outputChatBox ( "Jus gavote alga 180Lt!", thePlayer ) end
  18. Castillo

    .question.

    function vehOwner (thePlayer, cmd, owner) local acc = getPlayerAccount (thePlayer) if (not acc or isGuestAccount(acc)) then return end local accName = getAccountName(acc) if ( hasObjectPermissionTo ( thePlayer , "function.banPlayer", true ) ) then local vehicle = getPedOccupiedVehicle(thePlayer) if (not vehicle) then outputChatBox("You must be in a vehicle to set it's owner.", thePlayer, 255, 0, 0) return end if setElementData (vehicle, "veh.owner", owner) then outputChatBox ("You successfully set the owner of this vehicle to ".. tostring(owner) ..".", thePlayer, 0, 255, 0) else outputChatBox ("Fail to set owner of this vehicle.", thePlayer, 255, 0, 0) end end end addCommandHandler ("setowner", vehOwner) function vehEnter (thePlayer) local acc = getPlayerAccount (thePlayer) if (not acc or isGuestAccount(acc)) then return end local accName = getAccountName(acc) local owner = getElementData(source, "veh.owner") if (not owner) then return end if (owner == accName) then outputChatBox ("Welcome to your vehicle.", thePlayer, 0, 255, 0) else outputChatBox ("This vehicle is owned by ".. tostring(owner) ..".", thePlayer, 255, 0, 0) cancelEvent() end end addEventHandler ("onVehicleStartEnter", root, vehEnter) This will set the owner of the vehicle you're driving. /setowner
  19. Did you check the debugscript (/debugscript 3) to seek for errors?
  20. I tested that script and it show's me, but I don't know if it'll show all players.
  21. function expcalculate() for index, player in ipairs(getElementsByType("player")) do if (not getElementData(player, "EXP")) then setElementData(player, "EXP", 0) end setElementData(player, "EXP",tonumber(getElementData(player, "EXP"))+1) end end setTimer(expcalculate,20000,0)
×
×
  • Create New...