makeleader to be used by me
#1

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;
}
Reply
#2

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
Reply
#3

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. :/
Reply
#4

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;
}
Reply
#5

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.
Reply
#6

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.
Reply
#7

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
Reply
#8

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.
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)