SA-MP Forums Archive
[CMD] /makeleader - 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: [CMD] /makeleader (/showthread.php?tid=592957)



[CMD] /makeleader - BarFix - 31.10.2015

Код:
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...


Re: [CMD] /makeleader - IceBilizard - 31.10.2015

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



Re: [CMD] /makeleader - BarFix - 31.10.2015

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


Re: [CMD] /makeleader - Patrick - 31.10.2015

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'


Re: [CMD] /makeleader - jlalt - 31.10.2015

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;




Re: [CMD] /makeleader - BarFix - 31.10.2015

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.


Re: [CMD] /makeleader - AchievementMaster360 - 31.10.2015

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



Re: [CMD] /makeleader - BarFix - 31.10.2015

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.