CMD:shakehand(playerid, params[])
{
new szMessage[128], iTargetID;
if(sscanf(params, "u", iTargetID)) return SendClientMessage(playerid,COLOR_GRAD1, "SYNTAX: /shakehand [playerid]");
new Float:p_fPos[3];
GetPlayerPos(iTargetID, p_fPos[0], p_fPos[1], p_fPos[2]);
if(!IsPlayerInRangeOfPoint(playerid, 4.0, p_fPos[0], p_fPos[1], p_fPos[2]))
return SendClientMessage(playerid, COLOR_WHITE, "You are not near the specified player.");
format(szMessage, sizeof(szMessage), "* %s has offered %s to shake hands.", GetPlayerName(playerid), GetPlayerName(iTargetID));
ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
format(szMessage,sizeof(szMessage), "%s has offered you to shake hands, '/accept handshake' to accept it.", GetPlayerName(playerid));
SendClientMessage(iTargetID, COLOR_ORANGE, szMessage);
format(szMessage,sizeof(szMessage), "You have offered %s to shake hands, wait for a response.", GetPlayerName(iTargetID));
SendClientMessage(playerid, COLOR_ORANGE, szMessage);
SetPVarInt(playerid, "hShakeRequest", iTargetID);
return 1;
}
CMD:accept(playerid, params[])
{
if(isnull(params)) {
SendClientMessage(playerid, COLOR_GRAD1, "SYNTAX: /accept [option]");
return SendClientMessage(playerid, COLOR_GRAD2, "Options: ['Handshake']");
}
if(strcmp(params, "handshake", true) == 0)
{
foreach(Player, i) {
if(GetPVarInt(i, "hShakeRequest") == playerid) {
new
Float: ppFloats[3], szMessage[128], Count, Float: Angle;
GetPlayerPos(i, ppFloats[0], ppFloats[1], ppFloats[2]);
if(!IsPlayerInRangeOfPoint(playerid, 5, ppFloats[0], ppFloats[1], ppFloats[2])) {
Count++;
SendClientMessage(playerid, COLOR_WHITE, "You are not near the person who offered you to shake hands.");
}
Count++;
GetPlayerFacingAngle( playerid, Angle );
SetPlayerFacingAngle( i, Angle+180 );
ApplyAnimation( playerid, "GANGS", "prtial_hndshk_biz_01", 3.7, 1, 1, 1, 0, 2200 );
ApplyAnimation( i, "GANGS", "prtial_hndshk_biz_01", 3.5, 1, 1, 1, 0, 2200 );
SetPVarInt(i, "hShakeRequest", INVALID_PLAYER_ID);
format(szMessage, sizeof(szMessage), "* %s has accepted the offer, and shook hands with %s.", GetPlayerName(i), GetPlayerName(playerid));
ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
return 1;
}