Jump to content

Help script


Xwad

Recommended Posts

Posted

My script is not working pls help! DEBUGSCRIPT 3: WARNING: moneyS.lua: Bad argumentum @ "givePkayerMoney' [Expected element at argumentum 1,got nil]

  
function rewardTimer() 
setTimer ( rewardOnRun, 10000, 1 ) 
givePlayerMoney ( source, 3000 ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), rewardTimer ) 
  
  
  
function rewardOnRun() 
givePlayerMoney ( source, 3000 ) 
setTimer ( rewardTimer, 10000, 1 ) 
end 
  

Posted

Try this:

  
function rewardTimer(player) 
local player = source or player 
setTimer ( rewardOnRun, 10000, 1,player ) 
givePlayerMoney ( player, 3000 ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), rewardTimer ) 
  
  
  
function rewardOnRun(player) 
givePlayerMoney ( player, 3000 ) 
setTimer ( rewardTimer, 10000, 1,player ) 
end 
  

You did not give any argument to the rewardOnRun() function.

This would make it work, although i am not sure what you are trying to do with the code.

  • Like 1
Posted

Its working thanks! The script is for my new terminator gamemode. I will release it soon. You will see what im doing with the code:D

Posted

one more question. I want to kill the timer if the player die but its not working:/

  
function rewardTimer(player) 
local player = source or player 
local Timer = setTimer ( rewardOnRun, 100, 1,player ) 
givePlayerMoney ( player, 1 ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), rewardTimer ) 
  
  
  
function rewardOnRun(player) 
givePlayerMoney ( player, 1 ) 
setTimer ( rewardTimer, 100, 1,player ) 
end 
  
  
  
function stopTimer() 
if isTimer ( Timer ) then killTimer ( Timer )  
end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), stopTimer ) 
  

Posted

Remove local here

local Timer = setTimer ( rewardOnRun, 100, 1,player ) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

This is also working thx! But i have a last last last question xD i want to make that the timer will only start if the player has skin 201. I made it but its not working:/ What shuld be the problem?

  
function rewardTimer(player) 
if getElementModel(source) == 201 then 
local player = source or player 
Timer = setTimer ( rewardOnRun, 100, 1,player ) 
givePlayerMoney ( player, 1 ) 
else 
cancelEvent() 
end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), rewardTimer ) 
  

Posted
This is also working thx! But i have a last last last question xD i want to make that the timer will only start if the player has skin 201. I made it but its not working:/ What shuld be the problem?

Code 1:

function rewardTimer() 
    local skinId = getElementModel(source) 
    if not skinId == 201 then return end  
    Timer = setTimer ( rewardOnRun, 100, 1,source ) 
    givePlayerMoney (source, 1000 ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), rewardTimer ) 

or

function rewardTimer (_,_,_,_,_,skin) 
    if not tonumber(skin) == 201 then return end  
    Timer = setTimer ( rewardOnRun, 100, 1,source ) 
    givePlayerMoney (source, 1000 ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(),rewardTimer) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

if i use this code then the timer is not working:/ so i edited the script like this: but then the timer was starting on all skins again:/

  
function rewardTimer(player) 
local skinId = getElementModel(source) 
if not skinId == 201 then return end 
local player = source or player 
Timer = setTimer ( rewardOnRun, 100, 1,player ) 
givePlayerMoney ( player, 1 ) 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), rewardTimer ) 
  
  
  
  
  
  
  
  
  
  
  
function rewardOnRun(player) 
givePlayerMoney ( player, 1 ) 
setTimer ( rewardTimer, 100, 1,player ) 
end 
  
  
  
function stopTimer() 
if isTimer ( Timer ) then killTimer ( Timer ) 
end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), stopTimer ) 
  
  

  • 1 month later...
Posted

one more quesiton. Why is it not giving me the money? The script starts that function with a timer

  
function captureAreaA1(commandName, player) 
local player = source or player 
UA1 = createRadarArea (  -2731.27, -2592, 250, 380, 255, 255, 31, alpha ) 
givePlayerMoney ( player, 1000 ) 
if isElement(markerG1) then 
destroyElement ( GA1 ) 
end 
end 
  

Posted
one more quesiton. Why is it not giving me the money? The script starts that function with a timer
  
function captureAreaA1(commandName, player) 
local player = source or player 
UA1 = createRadarArea (  -2731.27, -2592, 250, 380, 255, 255, 31, alpha ) 
givePlayerMoney ( player, 1000 ) 
if isElement(markerG1) then 
destroyElement ( GA1 ) 
end 
end 
  

if it's client side

wiki: Note: Using this function client side (not recommended) will not change a players money server side.

Posted

Becaouse i also need commands for that function. And for that i need that argumentum. So why is the givePlayerMoney nkt working?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...