BulletRja

Handshake System

Mar 7th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.74 KB | None | 0 0
  1. /*                        CREDITS                  
  2.  *
  3.  ***************BulletRaja [Making Script]
  4.  ***************Incognito [sscanf2]
  5.  ***************Zeex [ZCMD]
  6.  *
  7.  */
  8. #define FILTERSCRIPT
  9.  
  10. #include <a_samp>
  11. #include <sscanf2>
  12. #include <zcmd>
  13.  
  14. new ohand[MAX_PLAYERS][MAX_PLAYERS];
  15.  
  16. SetFacePlayer(playerid, giveplayerid)
  17. {
  18.     new Float:playerangle;
  19.     new Float:playermove = 5.0;
  20.     new Float:posx, Float:posy, Float:posz;
  21.     new Float:pix, Float:piy, Float:piz;
  22.     GetPlayerPos(giveplayerid, posx, posy, posz);
  23.     GetPlayerPos(playerid, pix, piy, piz);
  24.     playerangle = 180.0-atan2(pix-posx,piy-posy);
  25.     playerangle += playermove;
  26.     playermove *= -1;
  27.     SetPlayerFacingAngle(playerid, playerangle+playermove);
  28. }
  29.  
  30. main()
  31. {
  32.     print("\n----------------------------------");
  33.     print(" HandShake System by BulletRaja");
  34.     print("----------------------------------\n");
  35. }
  36. public OnFilterScriptInit()
  37. {
  38.     return 1;
  39. }
  40.  
  41. public OnFilterScriptExit()
  42. {
  43.     return 1;
  44. }
  45.  
  46. CMD:ohand(playerid, params[])
  47. {
  48.     new tmp[256], id, Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME];
  49.     if(sscanf(params, "d", id)) return SendClientMessage(playerid, -1, "USAGE: /ohand <playerid>");
  50.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Error: Invalid player id.");
  51.     GetPlayerPos(id, x, y, z);
  52.     GetPlayerName(playerid, name, sizeof(name));
  53.     if(!IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z)) return SendClientMessage(playerid, -1, "Error: You must be at that player to offer an hand shake.");
  54.     ohand[playerid][id]=1;
  55.     format(tmp, sizeof(tmp), "* %s has offer an hand shake.(/ahand)", name);
  56.     SendClientMessage(id, -1, tmp);
  57.     GetPlayerName(id, name, sizeof(name));
  58.     format(tmp, sizeof(tmp), "* You have offered %s an hand shake", name);
  59.     SendClientMessage(playerid, -1, tmp);
  60.     return 1;
  61. }
  62. CMD:ahand(playerid, params[])
  63. {
  64.     new tmp[256], id, Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME];
  65.     if(sscanf(params, "d", id)) return SendClientMessage(playerid, -1, "USAGE: /ahand <playerid>");
  66.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Error: Invalid player id.");
  67.     GetPlayerPos(id, x, y, z);
  68.     GetPlayerName(playerid, name, sizeof(name));
  69.     if(!IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z)) return SendClientMessage(playerid, -1, "Error: You must be at that player to accept hand shake.");
  70.     if(ohand[id][playerid]==0) return SendClientMessage(playerid, -1, "Error: That player did not offer you an hand shake.");
  71.     ohand[id][playerid]=0;
  72.     format(tmp, sizeof(tmp), "%s have accepted your hand shake", name);
  73.     SendClientMessage(id, -1, tmp);
  74.     GetPlayerName(id, name, sizeof(name));
  75.     format(tmp, sizeof(tmp), "You have accepted %s's hand shake", name);
  76.     SendClientMessage(playerid, -1, tmp);
  77.     ClearAnimations(playerid);
  78.     ClearAnimations(id);
  79.     SetFacePlayer(playerid, id);
  80.     SetFacePlayer(id, playerid);
  81.     new tp = random(6);
  82.     if(tp == 0) {
  83.         ApplyAnimation(playerid, "GANGS","hndshkaa", 4.0,0,0,0,0,0);
  84.         ApplyAnimation(id,"GANGS","hndshkaa",4.0,0,0,0,0,0);
  85.     }
  86.     else if(tp == 1) {
  87.         ApplyAnimation(playerid,"GANGS","hndshkba",4.0,0,0,0,0,0);
  88.         ApplyAnimation(id,"GANGS","hndshkba",4.0,0,0,0,0,0);
  89.     }
  90.     else if(tp == 2) {
  91.         ApplyAnimation(playerid,"GANGS","hndshkda",4.0,0,0,0,0,0);
  92.         ApplyAnimation(id,"GANGS","hndshkda",4.0,0,0,0,0,0);
  93.     }
  94.     else if(tp == 3) {
  95.         ApplyAnimation(playerid,"GANGS","hndshkea",4.0,0,0,0,0,0);
  96.         ApplyAnimation(id,"GANGS","hndshkea",4.0,0,0,0,0,0);
  97.     }
  98.     else if(tp == 4) {
  99.         ApplyAnimation(playerid,"GANGS","hndshkfa",4.0,0,0,0,0,0);
  100.         ApplyAnimation(id,"GANGS","hndshkfa",4.0,0,0,0,0,0);
  101.     }
  102.     else if(tp == 5) {
  103.         ApplyAnimation(playerid,"GANGS","prtial_hndshk_biz_01",4.0,0,0,0,0,0);
  104.         ApplyAnimation(id,"GANGS","prtial_hndshk_biz_01",4.0,0,0,0,0,0);
  105.     }
  106.     else {
  107.         ApplyAnimation(playerid,"GANGS","hndshkea",4.0,0,0,0,0,0);
  108.         ApplyAnimation(id,"GANGS","hndshkea",4.0,0,0,0,0,0);
  109.     }
  110.     return 1;
  111. }
  112. CMD:rhand(playerid, params[])
  113. {
  114.     new tmp[256], id, Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME];
  115.     if(sscanf(params, "d", id)) return SendClientMessage(playerid, -1, "USAGE: /rhand <playerid>");
  116.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Error: Invalid player id.");
  117.     GetPlayerPos(id, x, y, z);
  118.     GetPlayerName(playerid, name, sizeof(name));
  119.     if(!IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z)) return SendClientMessage(playerid, -1, "Error: You must be at that player to reject hand shake.");
  120.     if(ohand[id][playerid]==0) return SendClientMessage(playerid, -1, "Error: That player did not offer you hand shake.");
  121.     ohand[id][playerid]=0;
  122.     format(tmp, sizeof(tmp), "%s has rejected your hand shake", name);
  123.     SendClientMessage(id, -1, tmp);
  124.     GetPlayerName(id, name, sizeof(name));
  125.     format(tmp, sizeof(tmp), "You have rejected %s's hand shake", name);
  126.     SendClientMessage(playerid, -1, tmp);
  127.     return 1;
  128. }
Add Comment
Please, Sign In to add comment