SA-MP Forums Archive
[NPC] Jeff the Paranoid - Grenade Dealer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [NPC] Jeff the Paranoid - Grenade Dealer (/showthread.php?tid=104123)



[NPC] Jeff the Paranoid - Grenade Dealer - Poke - 22.10.2009

Hi guys, wrote an NPC, called Jeff the Paranoid, located in Willowfield, LS

The guy is selling grenades to player.

- Dialogs used for the shop;
- Shop opens on key pressing;
- NPC movements are recorded in parts to add some messages;
- Meant to be used with gl_chatbubble, If not, u should add specific chatbubble scripts by urself, so it wont spam the global chat;
- Some code used from taxitest and gl_actions;
- needs to be tested!!!

Known bugs:

- NPC responses only 1 player at once, looks like it cannot be fixed while current response method is used;
- I failed to record animations, so it can't smoke and perform some other actions;
- response method is still buggy, cuz it was taken from taxi_test npc and wasn't meant to be used like this

Video:

Watch it on *******
Download:
www.filehosting.org
www.mediafire.com
www.rapidshare.com

*IMPORTANT* Mirrors are welcome.

*IMPORTANT* You can use whatever you need with notifying me about it, except the name and style of my NPC. Create more MMO-style NPC's!!!

PS My English might not be perfect, excuse me





Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - Poke - 25.10.2009

Added a Video.


Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - sebihunter - 25.10.2009

looks nice


Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - Joe Staff - 25.10.2009

I would consider completely re-writing the dialog portion and removing anything the NPC has to do on his own. All he should have to do is follow a recording and pause whenever someone is close enough. I don't see a reason for the NPC to tell the server if someone is able to buy or not, they should just have to be within range of the NPC.

A personal favorite method of Dialog use that I currently use.

pawn Код:
#define DIALOG_NONE 0
#define DIALOG_BUY 1
#define DIALOG_AFFIRM 2

pDialogID[MAX_PLAYERS];
pParameters[MAX_PLAYERS];

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  switch(pDialogID[playerid])
  {
    case DIALOG_NONE: return 1;
    case DIALOG_BUY:
    {
      if(!response)
      {
        pDialogID[playerid]=DIALOG_NONE;
        return SendClientMessage(playerid,0xFF0000FF,"See you around then.");
      }
      new string[128];
      format(string,sizeof(string),"Purchase %d grenades for $%d?",strval(inputtext),25*strval(inputtext));
      pParameters[playerid]=strval(inputtext);
      pDialogID[playerid]=DIALOG_AFFIRM;
      ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Purchase Grenades",string,"Accept","Nevermind");
    }
    case DIALOG_AFFIRM:
    {
      if(!response)
      {
        pDialogID[playerid]=DIALOG_BUY;
        ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Purchase Grenades","How many?","Purchase","Nevermind");
        return 1;
      }
      new string[128];
      GetPlayerName(playerid,string,sizeof(string));
      format(string,sizeof(string),"Thanks %s.   Purchased %d grenades for $%d",string,pParameters[playerid],25*pParameters[playerid]);
      SendClientMessage(playerid,0xFF0000FF,string);
      GivePlayerMoney(playerid,0-25*pParameters[playerid]);
      GivePlayerWeapon(playerid,16,pParameters[playerid]);
      pDialogID[playerid]=DIALOG_NONE;
    }
  }
  return 0;
}
To activate that you just do
pawn Код:
pDialogID[playerid]=DIALOG_BUY;
ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Purchase Grenades","How many?","Purchase","Nevermind");
You don't have to use that, but it should diminish your problem of single patron use.


Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - Poke - 25.10.2009

There's still one thing I didn't understood, looks like npc responces the same way? Actually that's the reason of 1-patron-at-time bug.

*UPDATE* Could you make an npc with your methods so I could watch the whole process step by step?


Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - Joe Staff - 25.10.2009

I'm not sure what in your script would cause single player use, but my method is allowing for player specific dialogs and shouldn't interfere with any other players. IF it still does then it's not the dialogs that's causing the issue.


Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - Poke - 25.10.2009

It's not the dialog thing, I'm sure. But thank you anyway, u gave me some new ideas what to change to make Jeff better.


Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - Poke - 25.10.2009

Added a mirror link.


Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - XCarBOn - 25.10.2009

Can you maybe add a pastebin link, please?


Re: [NPC] Jeff the Paranoid - Grenade Dealer *TESTING NEEDED* - Hary - 25.10.2009

Really nice