Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-11-2012, 01:05 AM
Bleachlover551 Bleachlover551 is offline
Soul Reaper
Bleachlover551's Avatar
Join Date: Jul 2012
Location: Brunswick
Posts: 34
Bleachlover551 is an unknown quantity at this point
Smile Voting Script [Help]

Okay so im completelly lost here i need this to be for every player.
like players can only vote once per day.

Script:
PHP Code:
function onPlayerchats() {
  if (
player.chat == "/yes") {
      
player.chat "Fp4:Yes!";
      
server.votes += 1;
      
updateChat();
}
}
function 
updateChat() {
  
this.chat "Votes: " server.votes;

I know im not that good at stuff like this lol but if u can help me out. i would love you forever
Reply With Quote
  #2  
Old 08-11-2012, 04:12 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
So what you'll do is you'll have to make use of a server time variable "timevar"/"timevar2" store that in a client string and then when the player comes to vote again, compare the distance between the current time and the recorded time, if it's greater than 24 hours let them vote again.

PHP Code:
function onPlayervotes(){
  if (
timevar2 clientr.voteTime >= 24*360){
    
server.votes ++;
    
clientr.voteTime timevar2;
    return 
true;
  }
  else return 
false;

Of course to set a clientr variable you must be on the serverside and there you wouldn't have the player scope so you still have some work to do.
Good luck.
Reply With Quote
  #3  
Old 08-11-2012, 05:53 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Tricxta View Post
you must be on the serverside and there you wouldn't have the player scope
In level NPC scripting it's fairly rare for the player not to be in scope. Just use onPlayerChats serverside and use the player scope it provides.
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.