Guest User

Untitled

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