SA-MP Forums Archive
Help here. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help here. (/showthread.php?tid=402561)



Help here. - Laure - 27.12.2012

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;
}



Re: Help here. - Lordzy - 27.12.2012

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.


Re: Help here. - Laure - 27.12.2012

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.


Re: Help here. - Laure - 27.12.2012

Help??


Re: Help here. - Lordzy - 27.12.2012

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.


Re: Help here. - Laure - 27.12.2012

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


Re: Help here. - Lordzy - 27.12.2012

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;
}



Re: Help here. - Laure - 27.12.2012

Didnt fix my problem.


Re: Help here. - Laure - 27.12.2012

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



Re: Help here. - Lordzy - 27.12.2012

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.