SA-MP Forums Archive
makeleader to be used by me - 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: makeleader to be used by me (/showthread.php?tid=332433)



makeleader to be used by me - AlXx - 08.04.2012

sorry for my bad english, but i have a problem.
i made this command, /makeleader, but i cant use it myself. I want to test it on myself, but it says "Invalid playerid"
Can anyone redo it so i can use this command on myself too?

pawn Код:
CMD:makeleader(playerid,params[])
{
    new id,fraks,string[186];
    //if(PlayerInfo[playerid][pAdmin] >= 1337)
    if(sscanf(params,"ui",id,fraks)) return SendClientMessage(playerid,0x00FF00FF,"Kasutus: /paneliidriks <mдngijaid> <fraksid>"); //usage: /makeleader <playerid><fractionid>
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x00FF00FF,"Selline mдngija puudub."); // Invalid playerid
   
    format(string,sizeof(string), "Sa panid mдngija %s number %d fraktsiooni liidriks.", id, fraks); // You made player %s to number %d fraction leader
    SendClientMessage(playerid, -1, string);
    PlayerInfo[id][pLiider] = fraks;
    return 1;
}



Re: makeleader to be used by me - Reklez - 08.04.2012

change this line

pawn Код:
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x00FF00FF,"Selline mдngija puudub."); // Invalid playerid
with this line

pawn Код:
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,0x00FF00FF,"Selline mдngija puudub."); // Invalid playerid



Re: makeleader to be used by me - AlXx - 08.04.2012

Quote:
Originally Posted by Reklez
Посмотреть сообщение
change this line

pawn Код:
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x00FF00FF,"Selline mдngija puudub."); // Invalid playerid
with this line

pawn Код:
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,0x00FF00FF,"Selline mдngija puudub."); // Invalid playerid
Didnt work. :/


Re: makeleader to be used by me - Boooth - 08.04.2012

Quote:
Originally Posted by AlXx
Посмотреть сообщение
sorry for my bad english, but i have a problem.
i made this command, /makeleader, but i cant use it myself. I want to test it on myself, but it says "Invalid playerid"
Can anyone redo it so i can use this command on myself too?

pawn Код:
CMD:makeleader(playerid,params[])
{
    new id,fraks,string[186];
    //if(PlayerInfo[playerid][pAdmin] >= 1337)
    if(sscanf(params,"ui",id,fraks)) return SendClientMessage(playerid,0x00FF00FF,"Kasutus: /paneliidriks <mдngijaid> <fraksid>"); //usage: /makeleader <playerid><fractionid>
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0x00FF00FF,"Selline mдngija puudub."); // Invalid playerid
   
    format(string,sizeof(string), "Sa panid mдngija %s number %d fraktsiooni liidriks.", id, fraks); // You made player %s to number %d fraction leader
    SendClientMessage(playerid, -1, string);
    PlayerInfo[id][pLiider] = fraks;
    return 1;
}
This is how I would do it;
pawn Код:
CMD:makeleader(playerid, params[]) {
    if(PlayerInfo[playerid][pAdmin] >= 1337) {
       
          new id,fraks,string[186];
        if(sscanf(params, "ud", id, fraks)) {
            return SendClientMessage(playerid,0x00FF00FF,"Kasutus: /paneliidriks <mдngijaid> <fraksid>");
        }
        else {

            PlayerInfo[id][pLiider] = fraks;

            new

                name1[MAX_PLAYER_NAME], string[128];

            GetPlayerName(id, name1, MAX_PLAYER_NAME);

            format(string, sizeof(string), "You have set %s to lead group %d.", name1, fraks);
            SendClientMessage(playerid, COLOR_WHITE, string);

            GetPlayerName(playerid, name1, MAX_PLAYER_NAME);

            format(string, sizeof(string), "Administrator %s has set you to lead group %d.", name1, fraks);
            SendClientMessage(userID, COLOR_WHITE, string);
        }
    }

    return 1;
}



Re: makeleader to be used by me - AlXx - 08.04.2012

Quote:
Originally Posted by Boooth
Посмотреть сообщение
This is how I would do it;
pawn Код:
CMD:makeleader(playerid, params[]) {
    if(PlayerInfo[playerid][pAdmin] >= 1337) {
       
          new id,fraks,string[186];
        if(sscanf(params, "ud", id, fraks)) {
            return SendClientMessage(playerid,0x00FF00FF,"Kasutus: /paneliidriks <mдngijaid> <fraksid>");
        }
        else {

            PlayerInfo[id][pLiider] = fraks;

            new

                name1[MAX_PLAYER_NAME], string[128];

            GetPlayerName(id, name1, MAX_PLAYER_NAME);

            format(string, sizeof(string), "You have set %s to lead group %d.", name1, fraks);
            SendClientMessage(playerid, COLOR_WHITE, string);

            GetPlayerName(playerid, name1, MAX_PLAYER_NAME);

            format(string, sizeof(string), "Administrator %s has set you to lead group %d.", name1, fraks);
            SendClientMessage(userID, COLOR_WHITE, string);
        }
    }

    return 1;
}
well.. You would do it wrong then. Still not working.


Re: makeleader to be used by me - Boooth - 08.04.2012

Well then, I suggest you download TeamViewer and send me the details so I can show that I am infact right.

I do not like accusations of being wrong and therefore am willing to prove you wrong.


Re: makeleader to be used by me - Cjgogo - 08.04.2012

pawn Код:
CMD:makeleader(playerid,params[])
{
    new id,fraks,string[186];
    //if(PlayerInfo[playerid][pAdmin] >= 1337)
    if(sscanf(params,"ui",id,fraks)) return SendClientMessage(playerid,0x00FF00FF,"Kasutus: /paneliidriks <mдngijaid> <fraksid>"); //usage: /makeleader <playerid><fractionid>
    if(!(IsPlayerConnected(id))) return SendClientMessage(playerid,0x00FF00FF,"Selline mдngija puudub."); // Invalid playerid  
    format(string,sizeof(string), "Sa panid mдngija %s number %d fraktsiooni liidriks.", id, fraks); // You made player %s to number %d fraction leader
    SendClientMessage(playerid, -1, string);
    PlayerInfo[id][pLiider] = fraks;
    return 1;
}
Try it like that(yes the only thing I have done was opening and closing one more bracket on isPlayerConnected function,but I remeber I had this bug also,and since that,this is they way how I check if the player is offline,try my code


Re: makeleader to be used by me - AlXx - 08.04.2012

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
pawn Код:
CMD:makeleader(playerid,params[])
{
    new id,fraks,string[186];
    //if(PlayerInfo[playerid][pAdmin] >= 1337)
    if(sscanf(params,"ui",id,fraks)) return SendClientMessage(playerid,0x00FF00FF,"Kasutus: /paneliidriks <mдngijaid> <fraksid>"); //usage: /makeleader <playerid><fractionid>
    if(!(IsPlayerConnected(id))) return SendClientMessage(playerid,0x00FF00FF,"Selline mдngija puudub."); // Invalid playerid  
    format(string,sizeof(string), "Sa panid mдngija %s number %d fraktsiooni liidriks.", id, fraks); // You made player %s to number %d fraction leader
    SendClientMessage(playerid, -1, string);
    PlayerInfo[id][pLiider] = fraks;
    return 1;
}
Try it like that(yes the only thing I have done was opening and closing one more bracket on isPlayerConnected function,but I remeber I had this bug also,and since that,this is they way how I check if the player is offline,try my code
Nope, still same thing.


Re: makeleader to be used by me - AlXx - 08.04.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
That extra bracket won't do anything at all. Are you sure you have the very latest version of sscanf? There was a bug with ids before. Also, make sure you are actually typing your real name - gang tags etc are still technically part of your name.
Thanks, downloaded newest version and works.