Help here.
#1

Hello i tried to make /factions command but neither the Leader name is working nor the members is.Please provide some assistance.
pawn Код:
CMD:factions(playerid, params[])
{
    new string[128], faction;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    {
        format(string, sizeof(string), "Los Santos Police Department | Leader: %s | Members: %d",FacInfo[PlayerInfo[playerid][1]][pFacLeader]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "San Andreas Government | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "The Hitman Agency | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "San Andreas News | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "Los Santos Fire and Medic Department | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "Federal Bureau of Investigation | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    return 1;
}
Reply
#2

It's because you added a '!' before 'IsPlayerLoggedIn' which means if player is not logged in.

pawn Код:
CMD:factions(playerid, params[])
{
        new string[128], faction;
        if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
        format(string, sizeof(string), "Los Santos Police Department | Leader: %s | Members: %d",FacInfo[PlayerInfo[playerid][1]][pFacLeader]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "San Andreas Government | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "The Hitman Agency | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "San Andreas News | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "Los Santos Fire and Medic Department | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "Federal Bureau of Investigation | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        return 1;
}
And while creating a topic, please use a descriptive title.
Reply
#3

Well that would give a client message if the player is not logged in or entered its password to login check it again
pawn Код:
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
And if i do like what you said, then when i type the command it will say me Login before using a command however i am logged in.
Reply
#4

Help??
Reply
#5

No, mine won't. Because it doesn't directly return the message. Test the command.


It was not right before, but then I fixed it.
Reply
#6

Yea as i said it gave a client message "You need to log in first before using any command" though i am logged in.
Reply
#7

Didn't you try:
pawn Код:
CMD:factions(playerid, params[])
{
        new string[128], faction;
        if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
        format(string, sizeof(string), "Los Santos Police Department | Leader: %s | Members: %d",FacInfo[PlayerInfo[playerid][1]][pFacLeader]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "San Andreas Government | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "The Hitman Agency | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "San Andreas News | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "Los Santos Fire and Medic Department | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "Federal Bureau of Investigation | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        return 1;
}
Reply
#8

Didnt fix my problem.
Reply
#9

I have it something like this, where it is not showing any leader name or number of fac members.
Reply
#10

pawn Код:
CMD:factions(playerid, params[])
{
    new string[128], faction;
    if(IsPlayerLoggedIn(playerid))
    {
        format(string, sizeof(string), "Los Santos Police Department | Leader: %s | Members: %d",FacInfo[PlayerInfo[playerid][1]][pFacLeader]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "San Andreas Government | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "The Hitman Agency | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "San Andreas News | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "Los Santos Fire and Medic Department | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, sizeof(string), "Federal Bureau of Investigation | Leader: %s | Members: %d", FacInfo[faction][FacLeader], FacInfo[faction][facMembers]);
        SendClientMessage(playerid, COLOR_WHITE, string);
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    return 1;
}
This works, I guess. Or else, show your 'IsPlayerLoggedIn' function.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)