CMD:hire doesnt work prob.
#1

I created an /hire for the fation leaders but it doenst set the players faction when they did /hire And i don't see the problem.

pawn Code:
CMD:hire(playerid, params[])
{
    new playerb, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /hire [playerid]");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(PlayerInfo[playerb][pFac]) return SendClientMessage(playerid, COLOR_GREY, "Player is already in a faction.");
    if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't invite yourself.");
    new idx = Faction[playerb];
    PlayerInfo[playerb][pFac] = Faction[playerid];
    PlayerInfo[playerb][pFacRank] = 0;
    FacInfo[idx][facMembers] ++;
    PlayerInfo[playerb][pFacLeader] = 0;
    PlayerInfo[playerb][pFacDiv] = 0;
    PlayerInfo[playerb][pFacDivLeader] = 0;
    Faction[playerid] = 0;
    format(string, sizeof(string), " You hired %s in the faction %s.", RPN(playerb), RPFNEx(playerid));
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " %s has hired you in the %s", RPN(playerid), RPFNEx(playerid));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
}
Reply
#2

Someome?
Reply
#3

pawn Code:
CMD:hire(playerid, params[])
{
    new playerb, string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pFacLeader]) return SendClientMessage(playerid, COLOR_GREY, "You are not a faction leader.");
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /hire [playerid]");
    if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
    if(PlayerInfo[playerb][pFac]) return SendClientMessage(playerid, COLOR_GREY, "Player is already in a faction.");
    if(playerid == playerb) return SendClientMessage(playerid, COLOR_GREY, "You can't invite yourself.");
    new idx = Faction[playerb];
    FacInfo[idx][facMembers] ++;
    PlayerInfo[playerb][pFac] = Faction[playerid];
  /*  PlayerInfo[playerb][pFacRank] = 0;
    FacInfo[idx][facMembers] ++;
    PlayerInfo[playerb][pFacLeader] = 0;
    PlayerInfo[playerb][pFacDiv] = 0;
    PlayerInfo[playerb][pFacDivLeader] = 0;
    Faction[playerid] = 0;*/

    format(string, sizeof(string), " You hired %s in the faction %s.", RPN(playerb), RPFNEx(playerid));
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " %s has hired you in the %s", RPN(playerid), RPFNEx(playerid));
    SendClientMessage(playerb, COLOR_LIGHTBLUE, string);
    return 1;
}
Try this
Reply
#4

pawn Code:
new idx = Faction[playerb];
Isn't idx 0 all the time? I mean ... playerb is civilian, right?

pawn Code:
Faction[playerid] = 0;
Isn't this supposed to keep its value? Playerid is the leader, so he is not leaving his faction.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)