yuhsing

Untitled

Oct 12th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1.  
  2. /*==========================================
  3. * returns the GID of an NPC
  4. *------------------------------------------*/
  5. BUILDIN_FUNC(getnpcid)
  6. {
  7. int num = script_getnum(st,2);
  8. struct npc_data* nd = NULL;
  9.  
  10. if( script_hasdata(st,3) )
  11. {// unique npc name
  12. if( ( nd = npc_name2id(script_getstr(st,3)) ) == NULL )
  13. {
  14. ShowError("buildin_getnpcid: No such NPC '%s'.\n", script_getstr(st,3));
  15. script_pushint(st,0);
  16. return 1;
  17. }
  18. }
  19.  
  20. switch (num) {
  21. case 0:
  22. script_pushint(st,nd ? nd->bl.id : st->oid);
  23. break;
  24. default:
  25. ShowError("buildin_getnpcid: invalid parameter (%d).\n", num);
  26. script_pushint(st,0);
  27. return 1;
  28. }
  29.  
  30. return 0;
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. // below part....
  42.  
  43. BUILDIN_DEF(getnpcid,"i?"),
Advertisement
Add Comment
Please, Sign In to add comment