SHOW:
|
|
- or go back to the newest paste.
1 | CMD:shakehand(playerid, params[]) | |
2 | { | |
3 | new szMessage[128], iTargetID; | |
4 | if(sscanf(params, "u", iTargetID)) return SendClientMessage(playerid,COLOR_GRAD1, "SYNTAX: /shakehand [playerid]"); | |
5 | ||
6 | new Float:p_fPos[3]; | |
7 | GetPlayerPos(iTargetID, p_fPos[0], p_fPos[1], p_fPos[2]); | |
8 | ||
9 | if(!IsPlayerInRangeOfPoint(playerid, 4.0, p_fPos[0], p_fPos[1], p_fPos[2])) | |
10 | return SendClientMessage(playerid, COLOR_WHITE, "You are not near the specified player."); | |
11 | ||
12 | format(szMessage, sizeof(szMessage), "* %s has offered %s to shake hands.", GetPlayerName(playerid), GetPlayerName(iTargetID)); | |
13 | ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); | |
14 | format(szMessage,sizeof(szMessage), "%s has offered you to shake hands, '/accept handshake' to accept it.", GetPlayerName(playerid)); | |
15 | SendClientMessage(iTargetID, COLOR_ORANGE, szMessage); | |
16 | format(szMessage,sizeof(szMessage), "You have offered %s to shake hands, wait for a response.", GetPlayerName(iTargetID)); | |
17 | SendClientMessage(playerid, COLOR_ORANGE, szMessage); | |
18 | SetPVarInt(playerid, "hShakeRequest", iTargetID); | |
19 | return 1; | |
20 | } | |
21 | CMD:accept(playerid, params[]) | |
22 | { | |
23 | if(isnull(params)) { | |
24 | SendClientMessage(playerid, COLOR_GRAD1, "SYNTAX: /accept [option]"); | |
25 | return SendClientMessage(playerid, COLOR_GRAD2, "Options: ['Handshake']"); | |
26 | } | |
27 | if(strcmp(params, "handshake", true) == 0) | |
28 | { | |
29 | foreach(Player, i) { | |
30 | if(GetPVarInt(i, "hShakeRequest") == playerid) { | |
31 | new | |
32 | Float: ppFloats[3], szMessage[128], Count, Float: Angle; | |
33 | ||
34 | GetPlayerPos(i, ppFloats[0], ppFloats[1], ppFloats[2]); | |
35 | ||
36 | if(!IsPlayerInRangeOfPoint(playerid, 5, ppFloats[0], ppFloats[1], ppFloats[2])) { | |
37 | Count++; | |
38 | SendClientMessage(playerid, COLOR_WHITE, "You are not near the person who offered you to shake hands."); | |
39 | } | |
40 | Count++; | |
41 | GetPlayerFacingAngle( playerid, Angle ); | |
42 | - | SetPlayerFacingAngle( targetplayerid, Angle+180 ); |
42 | + | SetPlayerFacingAngle( i, Angle+180 ); |
43 | ApplyAnimation( playerid, "GANGS", "prtial_hndshk_biz_01", 3.7, 1, 1, 1, 0, 2200 ); | |
44 | ApplyAnimation( i, "GANGS", "prtial_hndshk_biz_01", 3.5, 1, 1, 1, 0, 2200 ); | |
45 | SetPVarInt(i, "hShakeRequest", INVALID_PLAYER_ID); | |
46 | format(szMessage, sizeof(szMessage), "* %s has accepted the offer, and shook hands with %s.", GetPlayerName(i), GetPlayerName(playerid)); | |
47 | ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); | |
48 | } | |
49 | } | |
50 | } | |
51 | return 1; | |
52 | } |