yuhsing

Untitled

Nov 27th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1.  
  2.  
  3. - script Sample#command -1,{
  4. OnInit:
  5. bindatcmd("tradepoint",strnpcinfo(0)+"::OnAtCommand");
  6. end;
  7.  
  8. OnAtCommand:
  9.  
  10. if( .@atcmd_parameters$[0] == "" || atoi( .@atcmd_parameters$[1] ) <= 0 ){
  11. dispbottom "Usage : @tradepoint <name> <amount> ";
  12. }else if( atoi( .@atcmd_parameters$[1] ) > @Points ){
  13. dispbottom "You didnt have that much of Points.";
  14. }else if( strcharinfo(0) == .@atcmd_parameters$[0] ){
  15. dispbottom "You cant trade the points with yourself....";
  16. }else if( !isloggedin( getcharid( 3,.@atcmd_parameters$[0] ) ) ){
  17. dispbottom "Player '"+.@atcmd_parameters$[0]+"' isnt online...";
  18. }else{
  19. .@Giver$ = strcharinfo(0);
  20. dispbottom "waiting responses from '"+.@atcmd_parameters$[0]+" ...";
  21. if( attachrid( getcharid( 3,.@atcmd_parameters$[0] ) ) ){
  22. mes "Player ^0055FF'"+.@Giver$+"'^000000 has sent you '"+.@atcmd_parameters$[1]+"' Points.";
  23. next;
  24. if( select("Accept:Reject") == 1 ){
  25. @Points += atoi( .@atcmd_parameters$[1] );
  26. mes "Gained ^FF0000"+atoi( .@atcmd_parameters$[1] )+"^000000 Points.";
  27. message .@Giver$,"Accepted the Trades.";
  28. }else{
  29. message .@Giver$,"Rejected the Trades.";
  30. .@Failed = 1;
  31. }
  32. close2;
  33. }
  34. attachrid( getcharid( 3,.@Giver$ ) );
  35. if( !.@Failed ) @Points -= atoi( .@atcmd_parameters$[1] );
  36. dispbottom ( .@Failed ?"Failed":"Success" )+" to transfer "+atoi( .@atcmd_parameters$[1] )+" Points to "+.@atcmd_parameters$[0]+" ....";
  37. dispbottom "Point Left : "+@Points+" Points";
  38. }
  39. end;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment