![]() |
Help with bank script.
Ok, so I started making this bank script and I got a little confused.
Basically when you walk into a bank, you say '/create account' and when you say that, it adds a weapon called '-Bank/Account' to your attributes. Im trying to set it to where if you already have a bank account and you say '/create account' and you have the weapon '-Bank/Account' in your attributes already, it will say2 You already have a bank account. Here is what I have so far. PHP Code:
Thanks alot -Jamerson =] |
First off, addweapon can only be done serverside, depending on if this is a level npc, or another weapon npc, you might just want to make the entire script serverside.
For detecting player chat, use if (player.chat == "chat") One = sign denotes changing the variable. And you shouldnt mix gs1 with gs2. PHP Code:
PHP Code:
PHP Code:
And you dont need to check the players chat again if the player doesnt have the weapon. A simple "else" statement would do. Edit: And i just read that the script is in the bank level, so you should just make the entire script serverside (Remove //#CLIENTSIDE), and it would work. |
An easier way to do what Jazz said about finding if they have the weapon would be
PHP Code:
PHP Code:
|
I actually never thought of doing it that way.
I started detecting weapons my way when I saw it done on a friends server, and always used that method, since it worked. Altho, i've seen alot of worse methods to detect it...I'll probably start doing it that way. Thanks. ;] |
so is this right?
function onPlayerchats() { if (player.chat == "/open account") { if (player.weapons.index(findweapon("-Bank/Account")) > 0) { say2("You already have a bank account"); } else say2("You have opened a bank account!"); player.addWeapon("-Bank/Account"); } } |
PHP Code:
And you were also missing an opening bracket in your else statement. |
| All times are GMT +2. The time now is 01:19 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.