SA-MP Forums Archive
y_groups makeleader... ****** I NEED YOU! - 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: y_groups makeleader... ****** I NEED YOU! (/showthread.php?tid=485563)



y_groups makeleader... ****** I NEED YOU! - Scrillex - 04.01.2014

Hello everyone...

I have some little thing whats needed to be understand how it's possible to do..

So I need to set player in group but the question is how..

My question is how can I set it to check players PlayerInfo[playerid][pFac] and equally to that set his group..

Like if players pFac = 1 then Set players group to Group_SetPlayer(Ballas, playerid, false);
Here is cmd..
pawn Код:
YCMD:makeleader(playerid, params[],help)
{
    new targetid, factionid, string[128], targetname[24], playername[24];
    if(sscanf(params, "ui", targetid, factionid)) return SendClientMessage(playerid, -1, "Usage: /makeleader [playerid][factionid]");
    if(PlayerInfo[playerid][pAdmin] != 6) return SendClientMessage(playerid, -1, "You are not an admin");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Invalid playerid!");
    if(1 < factionid < 24)
    {
        GetPlayerName(playerid, playername, sizeof(playername));
        GetPlayerName(targetid, targetname, sizeof(targetname));
        format(string, sizeof(string), "You made %s leader of faction id %i!", targetname, factionid);
        SendClientMessage(playerid, -1, string);
        format(string, sizeof(string), "You were made leader of faction id %i by %s", factionid, playername);
        SendClientMessage(playerid, -1, string);
        PlayerInfo[playerid][pFac] = factionid;
        PlayerInfo[playerid][pLeader] = factionid;
    }
    else return SendClientMessage(playerid, -1, "Invalid factionid.  Factionid's: 1 - 24");
    return 1;
}



Re: y_groups makeleader... ****** I NEED YOU! - Patrick - 04.01.2014

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
Hello everyone...

I have some little thing whats needed to be understand how it's possible to do..

So I need to set player in group but the question is how..

My question is how can I set it to check players PlayerInfo[playerid][pFac] and equally to that set his group..

Like if players pFac = 1 then Set players group to Group_SetPlayer(Ballas, playerid, false);
Here is cmd..
pawn Код:
//code.
Do you notice something different? you used playerid(Code who used the command) instead of targetid(playerid who assigned)

Wrong
pawn Код:
PlayerInfo[playerid][pFac] = factionid, PlayerInfo[playerid][pLeader] = factionid;
Correct
pawn Код:
PlayerInfo[targetid][pFac] = factionid, PlayerInfo[targetid][pLeader] = factionid;



Re: y_groups makeleader... ****** I NEED YOU! - Scrillex - 04.01.2014

Uhh my bad.. but still in the same point.. But thanks for your good eye.. just how to set group by it is the question.. I even can't imagine.. Because I already added it under player spawn as checker..


Re: y_groups makeleader... ****** I NEED YOU! - Scrillex - 05.01.2014

BUMP!


Re: y_groups makeleader... ****** I NEED YOU! - BlackBank - 05.01.2014

Could you provide the code were you create the Group (Group_Create) and load/sort the faction data?


Re: y_groups makeleader... ****** I NEED YOU! - Scrillex - 05.01.2014

Yeah everything is done in that but I need to set it as it is.. Like Group_SetPlayer(faction, playerid, true);