22.10.2012, 19:26
hey.. i'm trying to make a /handshake command and when the player is using the command its change the players their face to each other...
pawn Код:
stock SetPlayerFacePlayer(playerid, giveplayer)
{
new Float:Px, Float:Py, Float: Pa;
GetPlayerPos(playerid, Px, Py, Pa);
new Float:fpX, Float:fpY, Float: fpZ;
GetPlayerPos(giveplayer, fpX, fpY, fpZ);
Pa = floatabs(atan((fpY-Py)/(fpX-Px)));
if(fpX <= Px && fpY >= Py) Pa = floatsub(180, Pa);
else if(fpX < Px && fpY < Py) Pa = floatadd(Pa, 180);
else if(fpX >= Px && fpY <= Py) Pa = floatsub(360.0, Pa);
Pa = floatsub(Pa, 90.0);
if(Pa >= 360.0) Pa = floatsub(Pa, 360.0);
if(!IsPlayerInAnyVehicle(playerid)) SetPlayerFacingAngle(playerid, Pa);
else SetVehicleZAngle(GetPlayerVehicleID(playerid), Pa);
}
if(strcmp(cmd, "/handshake", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(Offer[playerid] > -1)
{
giveplayerid = Offer[playerid];
if (ProxDetectorS(1.5, playerid, giveplayerid))
{
SetPlayerFacePlayer(playerid, giveplayer)
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
ApplyAnimation(playerid,"GANGS","hndshkfa",4.1,0,0,0,0,0);
ApplyAnimation(giveplayerid,"GANGS","hndshkfa",4.1,0,0,0,0,0);
PlayerInfo[playerid][pMember] = 11;
PlayerInfo[playerid][pRank] = 1;
format(string, sizeof(string), "You have joined Le Sangre Gang by %d", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have Invited %d to join the Le Sangre.", sendername);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_GRAD2, "{33CCFF}Welcome to Le Sangre Gang:{009999} go to /changeclothes for finishing your recruiting");
Offer[playerid] = -1;
Offer[giveplayerid] = -1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
}