/acceptgreet cmd?
#1

I want to make an /acceptgreet command but.. How do I play the animation for both players? I need a global variable or something?

pawn Код:
CMD:greet(playerid, params[])
{
    new id, number, string[64], Float:X, Float:Y, Float:Z;
    GetPlayerPos(id, X, Y, Z);

    if(sscanf(params,"u", id)) return SCM(playerid, COLOR_GREY,"[Usage]: /greet [playerid/partofname] [greet (0-6)].");
    if(playerid == id) return SCM(playerid, COLOR_LIGHTRED,"[Error]: You can't greet yourself.");

    if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z))
    {
        format(string, sizeof(string), "* %s would like to greet you, /acceptgreet.", GetName(playerid));
        SendClientMessage(playerid, COLOR_GOLD, string);
        greetInvited[id] = true;
    } else return SCM(playerid, COLOR_LIGHTRED, "[Error]: You're not close enough.");
    return 1;
}

CMD:acceptgreet(playerid, params[])
{
    if(greetInvited[playerid] == false) return SCM(playerid, COLOR_LIGHTRED,"[Error]: You're not invited to greet anyone");
    ApplyAnimation(playerid, "GANGS", "hndshkaa", 4.1, 0, 1, 1, 1, 1, 1);
    ApplyAnimation( ??, "GANGS", "hndshkaa", 4.1, 0, 1, 1, 1, 1, 1);
    return 1;
}
Reply
#2

pawn Код:
// global
new
    Player_Greet[ MAX_PLAYERS ]
;

// OnPlayerConnect:
Player_Greet[playerid] = INVALID_PLAYER_ID;

CMD:greet(playerid, params[])
{
    new id, number, string[64], Float:X, Float:Y, Float:Z;
    GetPlayerPos(id, X, Y, Z);

    if(sscanf(params,"u", id)) return SCM(playerid, COLOR_GREY,"[Usage]: /greet [playerid/partofname] [greet (0-6)].");
    if(playerid == id) return SCM(playerid, COLOR_LIGHTRED,"[Error]: You can't greet yourself.");

    if(IsPlayerInRangeOfPoint(playerid, 7.0, X, Y, Z))
    {
        format(string, sizeof(string), "* %s would like to greet you, /acceptgreet.", GetName(playerid));
        SendClientMessage(playerid, COLOR_GOLD, string);
        greetInvited[id] = true;
        greetNumber[id] = number;
        Player_Greet[id] = playerid;
    } else return SCM(playerid, COLOR_LIGHTRED, "[Error]: You're not close enough.");
    return 1;
}

CMD:acceptgreet(playerid, params[])
{
    if(greetInvited == false) return SCM(playerid, COLOR_LIGHTRED,"[Error]: You're not invited to greet anyone");
    ApplyAnimation(playerid, "GANGS", "hndshkaa", 4.1, 0, 1, 1, 1, 1, 1);
    ApplyAnimation(Player_Greet[playerid], "GANGS", "hndshkaa", 4.1, 0, 1, 1, 1, 1, 1);
    return 1;
}
If you also have a command to deny greet, reset it (send its value to INVALID_PLAYER_ID).
Reply
#3

Thanks, you've saved the day again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)