AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Employment MOD Help TSRP Amxx 1.7 (https://forums.alliedmods.net/showthread.php?t=29788)

kenx187x 06-12-2006 17:31

Employment MOD Help TSRP Amxx 1.7
 
Yes i found this on here and it is told to be broke and un finshed i want it where you can go up to a npc and type /buy and brings up list jobs u see
1.Waiter 2. janitor and you press 1 makes you waiter, reason i want this so i dont have to give new people e jobs and i can deal with bigger issues

Code:

public plugin_init() {
        register_clcmd("employment","menu_mymenu");
    register_menucmd( register_menuid( MENU_MYMENU_TITLE ) , 1023, "_menu_mymenu");
    register_menucmd( register_menuid( MENU_MYMENU2_TITLE ) , 1023, "_menu_mymenu2");


}
public menu_mymenu( id ) {

    new szMenu[512], iLen;
    new iKeys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<8)|(1<<9);

    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_TITLE );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_1 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_2 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_3 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_4 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_5 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_6 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_7 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_8 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU_NEXT );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_CANCEL );

    show_menu( id, iKeys, szMenu );
    return PLUGIN_HANDLED;
}

public cmd_mymenu(id) {
    menu_mymenu(id);
    return PLUGIN_HANDLED;
}

public _menu_mymenu( id, iKey ) {

    switch ( iKey )
    {
      case 0:    jobchange(id,"Banker", "10");
      case 1:    jobchange(id,"Waiter", "7");
      case 2:    jobchange(id,"Clerk", "8");
      case 3:    jobchange(id,"Gunsec", "7");
      case 4:    jobchange(id,"Scout", "7");
      case 5:    jobchange(id,"Bodyguard", "7");
      case 6:    jobchange(id,"Cop", "9");
    case 7:    jobchange(id,"Bouncer", "7");
      case 8:    menu_mymenu2(id);
    }

    return PLUGIN_HANDLED;
}

public menu_mymenu2( id ) {

    new szMenu[512], iLen;
    new iKeys = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<8)|(1<<9);

    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_TITLE );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_1 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_2 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_3 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_4 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_5 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_6 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_7 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_8 );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_MYMENU2_NEXT );
    iLen += format( szMenu[iLen], 512 - iLen, MENU_PREVIOUS );

    show_menu( id, iKeys, szMenu );
    return PLUGIN_HANDLED;
}



public _menu_mymenu2( id, iKey ) {

    switch ( iKey )
    {
      case 0:    jobchange(id,"Bellboy", "6");
      case 1:    jobchange(id,"Secretary", "8");
      case 2:    jobchange(id,"Nurse", "7");
      case 3:    jobchange(id,"Altar", "4");
      case 4:    jobchange(id,"Taxidriver", "5");
    case 5:    menu_mymenu2(id);
    case 6:    menu_mymenu2(id);
    case 7:    menu_mymenu2(id);
    case 8:    menu_mymenu2(id);
    case 9:    menu_mymenu(id);
    }

    return PLUGIN_HANDLED;
}


kenx187x 06-12-2006 18:41

anyone?

tetsoma 06-12-2006 18:44

i might know someone who will touch it

kenx187x 06-12-2006 19:17

and testoma do you know how to un precache models on map for like i can run more models for a carmod

tetsoma 06-12-2006 19:30

someone eles is going to have to fix that code

kenx187x 06-12-2006 20:32

anyone fix that plugin?

Lord_Destros 06-12-2006 20:36

Quote:

Originally Posted by kenx187x
and testoma do you know how to un precache models on map for like i can run more models for a carmod

Either use Suzuka's stripper2 plugin or remove existing plugins (and unprecache what they use). If you wish to remove sprites/models/sounds built into the map you have to use the first method.

Peli 06-12-2006 20:46

I can't help you on the NPC part, so I would look over Twilight Suzuka's Awesome Creating an NPC Guide.

Well for the command to access the NPC you would need to register this:
Code:
register_clcmd("say /buy", "clcmd_buy", 0, "Activates the menu for jobs")

Then, you would have to make a menu where you could link to that:
Code:
register_menucmd(register_menuid("Job Menu"), 1023, "menucmd_JobMenu")

Then, for the menu to actually work you need to complete the client command function:
Code:
public clcmd_jobmenu(id) {    new text[513]    format(text, 512, "\yJob Menu - ^n\w1. Waiter^n\w2. Janitor^n\w3. Exit^n^n")    new keys = (1<<0)|(1<<1)|(1<<2)    show_menu(id, keys, text, -1, "Job Menu")    return PLUGIN_HANDLED }

Finally, you can set the code/actions that take place for the actual menu:
Code:
public menucmd_JobMenu(id, key) {    switch(key)    {       case 0:       {          // Code for waiter here...       }       case 1:       {          // Code for Janitor here...       }       case 2:       {          // Exit       }    } }

Well here's it all together:
Code:
#include <amxmodx> #include <amxmisc> // Not sure if this is needed public plugin_init() {    register_clcmd("say /buy", "clcmd_buy", 0, "Activates the menu for jobs")    register_menucmd(register_menuid("Job Menu"), 1023, "menucmd_JobMenu") } public clcmd_jobmenu(id) {    new text[513]    format(text, 512, "\yJob Menu - ^n\w1. Waiter^n\w2. Janitor^n\w3. Exit^n^n")    new keys = (1<<0)|(1<<1)|(1<<2)    show_menu(id, keys, text, -1, "Job Menu")    return PLUGIN_HANDLED } public menucmd_JobMenu(id, key) {    switch(key)    {       case 0:       {          // Code for Waiter here...       }       case 1:       {          // Code for Janitor here...       }       case 2:       {           //  Exit       }    } }

This isn't perfect, might not work because I did it real fast without thinking straight. But it's just supposed to be helpful. :)

Lord_Destros 06-12-2006 21:58

Ummmm, that shouldn't work at all.

1. You never created a method named clcmd_buy
2. You never set origin on where NPC (the store only, not the model) should appear, I believe this would cause /buy to work anywhere around the map.

Yes, yes, i know you said this wouldn't work, just pointin it out though :D.

Peli 06-13-2006 16:22

Quote:

Originally Posted by Lord_Destros
Ummmm, that shouldn't work at all.

1. You never created a method named clcmd_buy
2. You never set origin on where NPC (the store only, not the model) should appear, I believe this would cause /buy to work anywhere around the map.

Yes, yes, i know you said this wouldn't work, just pointin it out though :D.

Maybe you didn't check to see that I didn't even focus on adding the NPC part, only the menu + command. He can implement that into his command later. I didn't include it because I don't know much about NPC's and I don't want to mess him up. :)


All times are GMT -4. The time now is 08:09.

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