Quote:
Originally Posted by Liberated
so would this be correct?( i doubt it since it since im such a nab, but w/e)
I also can't test it myself on testbed because somehow i can't open my Q inventory.
PHP Code:
onCreated()
{
player.attr[1] = "toygun.png";
setani("gunani","");
}
//#CLIENTSIDE
onWeaponFired()
{
this.chat = "BANG, owait, no bullet, it's a toygun!";
}
|
For one thing, you forgot the
function in front of your events.
I'm not sure why you're setting it serverside. That's being called when you update the weapon, not when you fire it. You would have to use triggers to call that, and that would be really stupid for a gun. Move all the stuff down into the
onWeaponFired event.
PHP Code:
//#CLIENTSIDE
function onWeaponFired()
{
player.attr[1] = "toygun.png";
setAni("gunani", null);
this.chat = "boom";
}
However, weapons are "invisible" - they don't have a physical location on your screen, so there's no way for you to see text, unlike with an NPC (e.g. a talking door). You most likely want to set the player's chat with this:
PHP Code:
player.chat = "chat";
which brings your script to
PHP Code:
//#CLIENTSIDE
function onWeaponFired()
{
player.attr[1] = "toygun.png";
setAni("gunani", null);
player.chat = "boom";
}
Normally you should only use serverside when you're doing something that affects multiple players (e.g. attacking players) or you need to do something in a way that is secure and cannot be easily "hacked" by players with memory editors. There's some more information about that
here and
here. I'm not sure if there's an article on communicating between the two, I'll try to find one. If not, I'll write one later.
EDIT: There's some information on triggers
here (use your browser's "Find" to look for
triggerserver and
triggerclient).