Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   PlayerHouse script (https://forums.graalonline.com/forums/showthread.php?t=21588)

lordhelmut 01-20-2002 04:43 PM

PlayerHouse script
 
// NPC made by Lord Helmut
if(created){
this.max=7;
}
if(playerchats) {
tokenize #c;
if (strequals(#t(0),AddTenant)){
tokenize server.p1htenants;
if(strequals(#a,#t(0))){
if (tokenscount<=this.max) {
tokenize #c;
addstring server.ph1tenants,#t(1);
}else{
message You already have #v(this.max) tenants!;
}
}
}
}

What would I change to add to that so that the owner can also say RemoveTenant 1 or 2 or whatever?

joseyisleet 01-20-2002 06:01 PM

uhhh
if (playerchats&&strequals(#a,#s(this.owner))&&strequ als(#c,remove 1)){
deletestring tennant1,;}


something like that?

lordhelmut 01-21-2002 12:19 AM

I think that might work =D accept is it delete or removestring

Shard_IceFire 01-21-2002 04:00 AM

What if you want to do a showimg list?
Like say you have this:
client.tenants=Bob,Frank,Joey,Ted
how do you turn it into a showimg thing of this:
Tenants:
Bob
Frank
Joey
Ted

-------

Also, how would you make it so there is a max amount of tenants?

lordhelmut 01-21-2002 09:09 AM

if you look at the script i made, you see it says this.max=7 meaning as long as the list is <= 7 its ok. When it exceeds it, it wont add anymore

lordhelmut 01-23-2002 01:26 AM

// NPC made by Lord Helmut
if(created){
this.max=7;
}
if(playerchats) {
tokenize #c;
if (strequals(#t(0),AddTenant)){
tokenize #s(server.ph1tenants);
if(strequals(#a,#t(0))){
if (tokenscount<=this.max) {
tokenize #c;
addstring server.ph1tenants,#t(1);
}else{
setplayerprop #c,You already have #v(this.max) tenants!;
}
}
}
if (strequals(#t(0),RemoveTenant)){
tokenize #s(server.ph1tenants);
if(strequals(#a,#t(0))){
removestring server.ph1tenants,#t(1);
}
}
}

Can anyone see any problems? For some reason when I make someone owner and they say addtenant it says You already have 0 tenants!

It works for me and lets me add people but anyone else it wont work for online =/

TDO2000 01-23-2002 04:35 AM

NPC Code:

// NPC made by TDO
if(created){
this.max=7;
}
if(playerchats) {
tokenize #c;
if(strequals(#a,#I(server.ph1tenants,0))){
//add new Tenant
if(startswith(AddTenant,#c)){
if(sarraylen(server.ph1tenants) <= this.max){
addstring server.ph1tenants,#t(1);
}
else {
setplayerprop #c,You already have #v(sarraylen(server.ph1tenants)-1) tenants!; //-1 cause of the owner
}
}
//remove tenant
if(startswith(RemoveTenant,#c)){
removestring server.ph1tenants,#t(1);
}
}
}



I do not use so many tokenizestuff u can handle it a better way with startswith and #I ;)
try it out

lordhelmut 01-23-2002 08:16 AM

*goes to look to see what #I does*

lordhelmut 01-23-2002 08:20 AM

KICK ASS!

Saga2001 01-23-2002 03:18 PM

lol d00d helmut, i swear, i made it...lol!

aesquivel 01-23-2002 09:21 PM

X.x lolz

TDO2000 01-23-2002 10:49 PM

Quote:

Originally posted by Saga2001
lol d00d helmut, i swear, i made it...lol!
um... what did u make???

lordhelmut 01-24-2002 04:23 AM

Quote:

Originally posted by TDO2000


um... what did u make???

I asked him to make a PH Script and he said he did but it took to long so I tried my hand at scripting :) And I just fixed my error too =D


All times are GMT +2. The time now is 12:52 PM.

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