[CMD] /makeleader
#1

Код:
CMD:makeleader(playerid, params[])
{
	new giveplayerid, fac, str[126];
	if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to do this.");
	if(sscanf(params, "ui", giveplayerid, fac)) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction]");
	if(fac < 1 || fac > 5) return SendClientMessage(playerid, -1, "Valid faction number is 1-5");
	PlayerInfo[playerid][pFacLeader] = fac;
	PlayerInfo[playerid][pFaction] = fac;
	PlayerInfo[playerid][pFacRank] = 6;
	format(str, sizeof(str), "You have been give leadership powers over %s by %s.", GetFactionName(giveplayerid), GetName(playerid));
	SendClientMessage(giveplayerid, COLOR_CYAN, str);
	format(str, sizeof(str), "You have give %s leadership powers over %s.", GetFactionName(giveplayerid), GetName(playerid));
	SendClientMessage(playerid, -1, str);
	return 1;
}
Whenever this code is executed ingame, it brings up the wrong text, for E.G:



bear in mind, this is me giving leadership to SOMEONE else, yet it still says I have been given powers...
Reply
#2

try this

pawn Код:
CMD:makeleader(playerid, params[])
{
    new giveplayerid, fac, str[126];
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to do this.");
    if(sscanf(params, "ui", giveplayerid, fac)) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction]");
    if(fac < 1 || fac > 5) return SendClientMessage(playerid, -1, "Valid faction number is 1-5");
    PlayerInfo[playerid][pFacLeader] = fac;
    PlayerInfo[playerid][pFaction] = fac;
    PlayerInfo[playerid][pFacRank] = 6;
    format(str, sizeof(str), "You have been give leadership powers over %s by %s.", GetFactionName(giveplayerid), GetName(playerid));
    SendClientMessage(giveplayerid, COLOR_CYAN, str);
    format(str, sizeof(str), "You have give %s leadership powers over %s.", GetFactionName(giveplayerid), GetName(giveplayerid));
    SendClientMessage(playerid, -1, str);
    return 1;
}
Reply
#3

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
try this

pawn Код:
CMD:makeleader(playerid, params[])
{
    new giveplayerid, fac, str[126];
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to do this.");
    if(sscanf(params, "ui", giveplayerid, fac)) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction]");
    if(fac < 1 || fac > 5) return SendClientMessage(playerid, -1, "Valid faction number is 1-5");
    PlayerInfo[playerid][pFacLeader] = fac;
    PlayerInfo[playerid][pFaction] = fac;
    PlayerInfo[playerid][pFacRank] = 6;
    format(str, sizeof(str), "You have been give leadership powers over %s by %s.", GetFactionName(giveplayerid), GetName(playerid));
    SendClientMessage(giveplayerid, COLOR_CYAN, str);
    format(str, sizeof(str), "You have give %s leadership powers over %s.", GetFactionName(giveplayerid), GetName(giveplayerid));
    SendClientMessage(playerid, -1, str);
    return 1;
}
Nothing changed, still says "You have been given leadership ower over by
Reply
#4

I can see that you're alone in the server, I am pretty sure you're doing the command to your self. Obviously the playerid - will be you and giveplayerid - will be you, I also notice that you're assigning the variables to 'playerid' not to 'giveplayerid'
Reply
#5

i'm not sure but this have to work....

PHP код:
CMD:makeleader(playeridparams[])
{
    new 
giveplayeridfacstr[126];
    if(
PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to do this.");
    if(
sscanf(params"ui"giveplayeridfac)) return SendClientMessage(playerid, -1"USAGE: /makeleader [playerid/partofname] [faction]");
    if(
fac || fac 5) return SendClientMessage(playerid, -1"Valid faction number is 1-5");
    
PlayerInfo[playerid][pFacLeader] = fac;
    
PlayerInfo[playerid][pFaction] = fac;
    
PlayerInfo[playerid][pFacRank] = 6;
    
format(strsizeof(str), "You have been give leadership powers over %s by %s."GetFactionName(fac), GetName(playerid));
    
SendClientMessage(giveplayeridCOLOR_CYANstr);
    
format(strsizeof(str), "You have give %s leadership powers over %s."GetName(playerid),GetFactionName(fac));
    
SendClientMessage(playerid, -1str);
    return 
1;

Reply
#6

Quote:
Originally Posted by Patrick
Посмотреть сообщение
I can see that you're alone in the server, I am pretty sure you're doing the command to your self. Obviously the playerid - will be you and giveplayerid - will be you, I also notice that you're assigning the variables to 'playerid' not to 'giveplayerid'
You are wrong, i was assigning it so someone else.
Reply
#7

You are using playerid instead of giveplayerid, here.
pawn Код:
CMD:makeleader(playerid, params[])
{
    new giveplayerid, fac, str[126];
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to do this.");
    if(sscanf(params, "ui", giveplayerid, fac)) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction]");
    if(fac < 1 || fac > 5) return SendClientMessage(playerid, -1, "Valid faction number is 1-5");
    PlayerInfo[giveplayerid][pFacLeader] = fac;
    PlayerInfo[giveplayerid][pFaction] = fac;
    PlayerInfo[givelayerid][pFacRank] = 6;
    format(str, sizeof(str), "You have been give leadership powers over %s by %s.", GetFactionName(fac), GetName(playerid));
    SendClientMessage(giveplayerid, COLOR_CYAN, str);
    format(str, sizeof(str), "You have give %s leadership powers over %s.", GetName(playerid),GetFactionName(fac));
    SendClientMessage(playerid, -1, str);
    return 1;
}
Reply
#8

Quote:
Originally Posted by AchievementMaster360
Посмотреть сообщение
You are using playerid instead of giveplayerid, here.
pawn Код:
CMD:makeleader(playerid, params[])
{
    new giveplayerid, fac, str[126];
    if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to do this.");
    if(sscanf(params, "ui", giveplayerid, fac)) return SendClientMessage(playerid, -1, "USAGE: /makeleader [playerid/partofname] [faction]");
    if(fac < 1 || fac > 5) return SendClientMessage(playerid, -1, "Valid faction number is 1-5");
    PlayerInfo[giveplayerid][pFacLeader] = fac;
    PlayerInfo[giveplayerid][pFaction] = fac;
    PlayerInfo[givelayerid][pFacRank] = 6;
    format(str, sizeof(str), "You have been give leadership powers over %s by %s.", GetFactionName(fac), GetName(playerid));
    SendClientMessage(giveplayerid, COLOR_CYAN, str);
    format(str, sizeof(str), "You have give %s leadership powers over %s.", GetName(playerid),GetFactionName(fac));
    SendClientMessage(playerid, -1, str);
    return 1;
}
Much love.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)