Jump to content
  • 0
Sign in to follow this  
kukayasko

What is wrong with this code?

Question

Quote

-    script    hourlypoints    FAKE_NPC,{
OnPCLoginEvent:    
if (getgmlevel() == 99){
initnpctimer;
end;
}

OnTimer1000:
    getitem 20172,1;
    stopnpctimer;
    end;
    
OnPCLogoutEvent:
stopnpctimer;
}

Edited by kukayasko

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

firstly, you should describe what you are trying to achieve in the future when seeking support.

When OnTimer is triggered, there is no player attached, so its trying to getitem without player attached.
better to use addtimer/deltimer for this function

also you dont need to stop the timer when they logout, since the data gets erased at that point anyway

Share this post


Link to post
Share on other sites
  • 0

Alright.

 

Im trying to make a hourly reward.

Sorry, lost what I had described when edited this topic.

 

So how I attache a player to this code? Thought that just "get item" will be enough

Share this post


Link to post
Share on other sites
  • 0

You are using the wrong timer command.

*addtimer(<ticks>, "NPC::OnLabel")
*deltimer("NPC::OnLabel")
*addtimercount("NPC::OnLabel", <ticks>)

These commands will create, destroy, and delay a countdown timer - 
addtimer() to create, deltimer() to destroy and addtimercount() to delay
it by the specified number of ticks. For all three cases, the event label 
given is the identifier of that timer. The timer runs on the character 
object that is attached to the script, and can have multiple instances. 
When the label is run, it is run as if the player that the timer runs on 
has clicked the NPC.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.