kiss.pwn 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include <a_samp>
  2. #include <zcmd>
  3. // by me (Mean)
  4. stock ArePlayersFacing(playerid, targetid) {
  5. new
  6. Float:angle1,
  7. Float:angle2,
  8. Float:difference
  9. ;
  10. GetPlayerFacingAngle(playerid, angle1);
  11. GetPlayerFacingAngle(targetid, angle2);
  12. if(angle1 > angle2) difference = angle1 - angle2;
  13. else difference = angle2 - angle1;
  14. if(difference < 190 && difference > 170) return 1;
  15. return 0;
  16. }
  17. CMD:kiss(playerid, params[]) {
  18. new id = strval(params);
  19. if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000, #ERROR: Player not connected!);
  20. if(isnull(params)) return SendClientMessage(playerid, -1, #USAGE: /kiss [ID]);
  21. new
  22. Float:x,
  23. Float:y,
  24. Float:z
  25. ;
  26. GetPlayerPos(id, x, y, z);
  27. if(ArePlayersFacing(playerid, id) && IsPlayerInRangeOfPoint(playerid, 1.5, x, y, z)) {
  28. new
  29. string[128],
  30. aName[MAX_PLAYER_NAME],
  31. pName[MAX_PLAYER_NAME]
  32. ;
  33. GetPlayerName(playerid, aName, sizeof aName);
  34. GetPlayerName(id, pName, sizeof pName);
  35. ApplyAnimation(playerid, "KISSING", "Playa_Kiss_02", 10.0, 0, 0, 0, 0, 5000, 1);
  36. ApplyAnimation(id, "KISSING", "Playa_Kiss_02", 10.0, 0, 0, 0, 0, 5000, 1);
  37. format(string, sizeof string, #You just got kissed by %s!, aName);
  38. SendClientMessage(id, -1, string);
  39. format(string, sizeof string, #You just kissed %s!, pName);
  40. SendClientMessage(playerid, -1, string);
  41. }
  42. else SendClientMessage(playerid, 0xFF0000, #ERROR: Player not in range or you are not facing the player!);
  43. return 1;
  44. }