Raised This Month: $ Target: $400
 0% 

Unsure of how


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 05-25-2006 , 23:44   Unsure of how
Reply With Quote #1

Is this right? Basicly what I'm trying to do is that the victim can affect the killer somehow, menu wise.

Code:
public DeathMSG() {     new killer = read_data(1);     new victim = read_data(2);     new iMenu[256];     new key = (1<<0|1<<1)     format(iMenu,sizeof(iMenu), "Neo...^n");     add(iMenu,sizeof(iMenu), "^n1. The matrix");     add(iMenu,sizeof(iMenu), "^n2. Has you.");     show_menu(victim, key, iMenu); } public wtfness(victim, killer, key) {     // when they press the button and stuff code. }
__________________
LEWL.
NewUser is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 05-26-2006 , 00:01  
Reply With Quote #2

Is that your whole plugin? Paste all the code.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 05-26-2006 , 00:56  
Reply With Quote #3

Quote:
Originally Posted by Suicid3
Is that your whole plugin? Paste all the code.
I was just writing a draft. I wasn't going to get started on the actual plugin until I was sure.
__________________
LEWL.
NewUser is offline
Pablo
BANNED
Join Date: May 2006
Location: Mexico City, Mexico
Old 05-26-2006 , 01:51  
Reply With Quote #4

go here -> http://wiki.amxmodx.org/index.php/Ad...28AMX_Mod_X%29

look about a third of the way down the page for these two code sample blocks... they *may* be germaine to what you are coding:
(I'm thinking you want hook_death...)

Quote:
Code:
public plugin_init()
{
    register_plugin("Message Demo", "1.0", "BAILOPAN")
    //this message informs everyone of a death, so we use
    // flag "a" - global event
    register_event("DeathMsg", "hook_death", "a")
}
 
public hook_death()
{
    new Killer = read_data(1) //get the first message parameter
    new Victim = read_data(2) //get the second message parameter
    new headshot = read_data(3) //was this a headshot?
    new weapon[32]
    read_data(4, weapon, 31)  //get the weapon name
}
Or, let's say we want to make a simple function for generating a death message:

Code:
stock make_deathMsg(Killer, Victim, const weapon[])
{
    //message_begin starts a message.  NEVER start two messages at once.
    //MSG_ALL means send the message to everyone
    //get_user_msgid returns the id of a message name
    //{0,0,0} is the origin vector - not used here
    //0 is the target - no specific target here
    message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0) 
    write_byte(Killer)
    write_byte(Victim)
    write_string(weapon)
    message_end()
}
Pablo is offline
NewUser
Member
Join Date: Mar 2006
Location: over there
Old 05-26-2006 , 13:46  
Reply With Quote #5

Not exactly.

Maybe this will help y'all understand a little better.

Code:
new iCash[33]; #define cash_low #define cash_medium #define cash_last // ... public DeathMSG() {     new killer = read_data(1)     new victim = read_data(2)     new iMenu[256];     new key = (1<<0|1<<1)     format(iMenu,sizeof(iMenu), "Neo...^n");     add(iMenu,sizeof(iMenu),"^n1. The matrix");     add(iMenu,sizeof(iMenu),"^n2. Has you...");     show_menu(victim, key, iMenu); } public iMenu_exec(victim, killer, key) {     if(key == 0)     {         if(iCash[killer] == cash_low)         {             iCash[killer] = cash_medium             return PLUGIN_HANDLED;         if(iCash[killer] == cash_medium)         {             iCash[killer] = cash_last             return PLUGIN_HANDLED;         if(iCash[killer] == cash_last)         {             // my stuff             return PLUGIN_HANDLED;         }         iCash[killer] = cash_low         return PLUGIN_HANDLED;     }     else if(key == 1)     {         return PLUGIN_HANDLED;     }     return PLUGIN_HANDLED; }
__________________
LEWL.
NewUser is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-26-2006 , 15:10  
Reply With Quote #6

What you have can work, you just need a global var to store who killed who...

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> enum CashLevel {      CASH_LOW = 0,      CASH_MEDIUM,      CASH_HIGH }; new myKiller[33]; new CashLevel:cashLevel[33]; // ... //Just a func to label their cash //Will set a users cash level and return it. CashLevel:SetCashLevel(id) {          if(cs_get_user_money < 2000) {                 cashLevel[id] = CASH_LOW;                 return CASH_LOW;          }                        //....          return CASH_LOW; // We really should never reach here... } public DeathMSG() {     new killer = read_data(1)     new victim = read_data(2)                 myKiller[victim] = killer;     // Why are you prefixing this with i, it's a string, not an array of ints!                 new iMenu[256];     new key = (1<<0|1<<1)     format(iMenu,sizeof(iMenu), "Neo...^n");     add(iMenu,sizeof(iMenu),"^n1. The matrix");     add(iMenu,sizeof(iMenu),"^n2. Has you...");     show_menu(victim, key, iMenu); } public iMenu_exec(id, key) {                      SetCashLevel(myKiller[id]);                            switch(key) {                      //Key number 1 pressed          case 0: {                            if(cashLevel[myKiller[id]] == CASH_LOW)                                  // Do something here                       }                        //Key number 2                        case 1: // ...                  }     return PLUGIN_HANDLED; }

*Ok, something is wrong with the small tags, code came out poorly formatted

This what I think you were trying to do. Also, I typed the code up in the post a reply section, so there is most likely errors, it's just a snippet anyway. Let me know if you need any help understanding the script.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
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 16:35.


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