Raised This Month: $51 Target: $400
 12% 

Help with weapons please!!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
I'mSane
Member
Join Date: Apr 2010
Location: SPb, Russia
Old 11-25-2010 , 15:08   Help with weapons please!!!
Reply With Quote #1

I'd like to make a script running some command if a player killed another player using scout. Here's a part of my code:

PHP Code:
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
killer GetClientOfUserId(GetEventInt(event"attacker"));
    new 
String:weapon[100];
    
GetEventString(event"weapon"weapon100);
    
    if(
weapon == "scout")              //error at this line :(((
    
{
        
scout[killer]++;
    }

And the compiler says: "error 003: array must be indexed (variable "weapon")."

What's wrong here?
__________________
Sorry for noob questions.
Sorry for bad english.
I'mSane is offline
Send a message via Skype™ to I'mSane
FaTony
Veteran Member
Join Date: Aug 2008
Old 11-25-2010 , 17:05   Re: Help with weapons please!!!
Reply With Quote #2

You can only compare individual elements of arrays, StrEqual is what you're looking for.
__________________
FaTony is offline
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 11-26-2010 , 00:57   Re: Help with weapons please!!!
Reply With Quote #3

Also, Scout's entity class is "weapon_scout", not just "scout".
__________________
Lord Canistra is offline
I'mSane
Member
Join Date: Apr 2010
Location: SPb, Russia
Old 11-26-2010 , 07:06   Re: Help with weapons please!!!
Reply With Quote #4

Thank you FaTony, I'll try it.

Lord Canistra, when I added the line "PrintToChat(killer, "bla bla %s", weapon)" in Event_PlayerDeath, in game I received a message like this: "bla bla scout", not "bla bla weapon_scout".
__________________
Sorry for noob questions.
Sorry for bad english.
I'mSane is offline
Send a message via Skype™ to I'mSane
I'mSane
Member
Join Date: Apr 2010
Location: SPb, Russia
Old 11-26-2010 , 07:36   Re: Help with weapons please!!!
Reply With Quote #5

Yes, it works! Thanks guys.
__________________
Sorry for noob questions.
Sorry for bad english.
I'mSane is offline
Send a message via Skype™ to I'mSane
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 -4. The time now is 23:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode