Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-16-2009, 05:36 PM
[email protected] jamerson61894@yahoo.com is offline
Banned
Join Date: Jul 2008
Posts: 83
jamerson61894@yahoo.com is an unknown quantity at this point
Post parking space script

hi im making this parking script thing where you buy a space for the day and you can park your car there, and it doesnt allow anyone else to do so. I got a problem though, whenever I say /space 1, it is supposed to say Owner: player.account, but it doesnt. Also I think the script is supposed to be serverside, but whenever I make it serverside, anyone can go into the space and its not blockable so i gotta make it clientside. but the problem with it being clientside is that only I can see Ownerlayer.account;

heres the script:

PHP Code:
function onPlayerChats()
 {
if (
player.chat == "/space 1")
  {
if (
clientr.item.Money>1000)
   {
player.account=this.owner
clientr
.item.Money-=1000;
player.addMsg2("You have rented space 1 for the day!");
message Ownerplayer.account SPC!;

dontblock;
  }
else
player.addMsg2("You do not have enough money to rent a space!");
 }

Reply With Quote
  #2  
Old 07-16-2009, 07:39 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You're assigning the owner variable backwards.

this.variable = this.value;

Also you're mixing GS1 with GS2 again.. I could of sworn we went over this in another thread. Use this.chat instead of message.

this.chat = "whatever you want it to say" SPC player.account;

You can store the account in a attr[], and use that on the clientside to prevent people from walking into it or whatever you want.

Example:
PHP Code:
function onPlayerChats() {
  if (
player.chat == "setaccount") {
    
this.owner player.account;
    
this.attr[2] = this.owner;
  }
}
//#CLIENTSIDE
function onPlayerTouchsMe() {
  if (
this.attr[2] == player.accountplayer.chat "You are the owner!";

Using your properly scripted owner flag you can check if someone has rented the space or not with a check like so..

if (this.variable != null) echo("This variable has a value of" SPC this.variable @ "!");
__________________
Quote:
Reply With Quote
  #3  
Old 07-17-2009, 05:30 AM
Ronnie Ronnie is offline
Registered User
Join Date: Jun 2008
Location: Nj, USA
Posts: 48
Ronnie is on a distinguished road
Send a message via AIM to Ronnie
Use a trigger client, basically the same thing as trigger server just backwards

ie.
PHP Code:
function onactionserversidecmd ) {
  switch( 
cmd ) {
  
   case 
"test":
   
triggerclient("gui",this.name,"newb");
   break;

  }
 }
 

//#CLIENTSIDE

function onactionclientsidecmd ) {
  switch( 
cmd ) {
  
   case 
"newb":
   
player.chat "Not my parking space!";
   break;

  }
 } 
Reply With Quote
  #4  
Old 07-17-2009, 06:10 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
This is probably a level NPC, so triggerclient won't work.
Reply With Quote
  #5  
Old 07-17-2009, 06:18 AM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
Quote:
Originally Posted by DustyPorViva View Post
This is probably a level NPC, so triggerclient won't work.
just use a triggeraction to compensate. :P
__________________
Deep into the Darkness peering...
Reply With Quote
  #6  
Old 07-17-2009, 06:46 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by Angel_Light View Post
just use a triggeraction to compensate. :P
It depends entirely on how he has it set up.

I don't even see why he needs it. onPlayertouchsme() works on serverside too... so... He could also just pass the owner through an attr if that's all he needs for comparing.
Reply With Quote
Reply


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 08:25 PM.


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