![]() |
Removing weapons
Hey I'm just trying to make a weapon add and remove itself from my inventory, I can use addweapon(); and removeweapon() on levels but it doesn't work inside the weapons scripts. When I put them two commands in f2 it says its a unrecognized command. thank you and sorry for posting another noob topic
also im wondering how to drop a animation for a clip gani when the gun reloads so it stays on the ground NPC Code: |
Should be dogging that clientside and then do the adding and remodeling serverside.
|
I didn't post the whole script but it is clientside can you explain to me what you mean give me an example of how it should be because right now it just freezes my player and puts in f2 on scripts that it's an unrecognized command the removeweapon(); , but it works fine in the levels npcs
I tried adding it server side but it still didn't work |
It's possible to remove weapons clientside (this.destroy() in the weapon—DO NOT DO THIS SERVERSIDE, IT WILL DELETE THE WEAPON FROM THE SERVER) but to add weapons you need to use player.addWeapon(weapon_name) and that must be done serverside. To remove weapons from a player serverside, use player.removeWeapon(weapon_name).
|
Quote:
NPC Code: or how could I make it a function that the client side does and plays the serverside function like this NPC Code: I tried doing that before but it couldn't read the function |
You need to use triggers to communicate between clientside and serverside. See these posts:
http://forums.graalonline.com/forums...84&postcount=6 http://forums.graalonline.com/forums...17&postcount=4 |
I read it but im still having trouble doing it
NPC Code: its all in the same script I put the action above my clientside and its still not working ingame |
String literals (stuff like "weapon/bmp") should be in quotes.
|
is it proper otherwise? i'll try adding quotes I forgot to add them above ill add the quotes and see if that helps but other than that it should trigger the weapon change?
edit: I got it working, it added the gun but it didn't remove it ill test it out more later but it triggered the server side weapons change thank you cbk youre very helpful here on the forums I cant get it to remove the weapon I have it set up like this Quote:
I got it working with destroy(weapon/bmp); thanks cbk uve been very helpful now i'm trying to make it so it can go down in level how would I be able to do that, I have it right now like it shows above but I want to make a trigger for a key to make it add the previous gun NPC Code: basicly im wondering how to make it so it has two sever side triggers, I can currently can only make it have one serverside trigger I don't know how make it work... |
When you post code, wrap it in [PHP] tags instead of [CODE] tags.
destroy() doesn't take any parameters, so you should just write this.destroy() instead of this.destroy(Weapon/BMPTier2); Your first code looks fine; my guess is that your capitalization of the weapon name is off. I'm not certain but I'd guess player.removeWeapon might be case-sensitive. If it's not working, make sure you have the weapon name entered exactly as it should be (in some examples you use weapon/BMP and in others you use Weapon/BMP). You can also use this.name to refer to the current weapon name. If you want to handle multiple possible actions serverside, send a parameter instead of null in your trigger. The parameter will be passed to the onActionServerSide event. Something like this: PHP Code:
|
Quote:
|
Works perfectly now, thank you for the help. I managed to make an entire gunscript that works the way I need it to for my weapons.
|
All times are GMT +2. The time now is 09:22 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.