Makeleader help
#1

Код:
CMD:makeleader(playerid, params[])
{
	if (Player[playerid][pAdmin] < 4)
		return SCM(playerid, ADMIN_COLOR, ADMIN_MESSAGE);
	
	new para1, faction; 
	if (sscanf(params, "ui", para1, faction))
	{
		SendClientMessage(playerid, COLOR_WHITE, "{00E6FF}USAGE:{FFFFFF} /makeleader [PlayerID/PartOfName] [Faction 1 - 15]");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "1: Police Department || 2: F.B.I || 3: National Guard || 4: Medics");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "5: The Mafia || 6: The Triads || 7: Mayor || 8: Hitman Agency");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "9: News Reporter || 10: Taxi Company || 11: Los Santos Vagos || 12: Varrios Los Aztecas");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "13: Ballas || 14: Grove Street || 15: NFS Club");
		return 1;
	}
	
	if (para1 == INVALID_PLAYER_ID)
		return SCM(playerid, -1, "Player is not connected.");
	
	if (faction < 1 || faction > 15)
		return SCM(playerid, -1, "{00E6FF}USAGE:{FFFFFF} /makeleader [PlayerID/PartOfName] {FF0000}[Faction 1 - 15]");
		
	
	new str[72], skin;
	switch (faction)
	{
		case 1: {str = "0xFF0000FF"; skin = 250;}
		case 2: {str = "Name2"; skin = 12;}
		case 14: {str = "Name15"; skin = 55;}
	}
	SetPlayerSkin(para1, skin);
	SetPlayerName(para1, strval(str));
	
	format(str, sizeof (str), "You have set %s (%i)'s faction to %i.", str, para1, faction);
	SendClientMessage(playerid, -1, str);
	
	GetPlayerName(playerid, str, 24);
	format(str, sizeof (str), "Your faction has been changed to %i by %s (%i)", faction, str, playerid);
	SendClientMessage(para1, -1, str);
	Player[para1][pLeader] = faction;
	return 1;
}
This script changes the player's name, but I want to change it so it changes their Name COLOR.
How would I be able to do this?
Reply
#2

http://forum.sa-mp.com/showpost.php?...99&postcount=9

You could have just told me that you didn't understand, you didn't have to make a new thread.
Код:
new color, skin;
switch (faction)
{
	case 1: {color = 0xFF0000FF; skin = 250;}
	case 2: {color = 0x00FF00FF; skin = 12;}
	case 14: {color = 0x0000FFFF; skin = 55;}
}
SetPlayerSkin(para1, skin);
SetPlayerColor(playerid, color);
Reply
#3

Quote:
Originally Posted by Stinged
Посмотреть сообщение
http://forum.sa-mp.com/showpost.php?...99&postcount=9

You could have just told me that you didn't understand, you didn't have to make a new thread.
Код:
new color, skin;
switch (faction)
{
	case 1: {color = 0xFF0000FF; skin = 250;}
	case 2: {color = 0x00FF00FF; skin = 12;}
	case 14: {color = 0x0000FFFF; skin = 55;}
}
SetPlayerSkin(para1, skin);
SetPlayerColor(playerid, color);
sorry, I thought that topic got a bit lost.
thanks.
Reply
#4

Код:
format(string, sizeof (string), "You have set %s's faction to %i.", para1, faction );
	SendClientMessage(playerid, -1, string);
	
	GetPlayerName(para1, faction, sizeof(faction));
	format(string, sizeof (string), "Your faction has been changed to %i by %s (%i)", faction, para1);
	SendClientMessage(para1, -1, string);
	Player[para1][pLeader] = faction;
	return 1;
}
What about these though?
I tried to edit them
Reply
#5

bump
@Stinged
Reply
#6

para1 = integer
faction = string


lines
format(string, sizeof (string), "Your faction has been changed to %i by %s (%i)", faction, para1);
SendClientMessage(para1, -1, string);

Only 2 variables, 1 missing.

Код:
        GetPlayerName(para1, faction, sizeof(faction));
        format(string, sizeof (string), "You have set %i's faction to %s.", para1, faction );
	SendClientMessage(playerid, -1, string);
	
	format(string, sizeof (string), "Your faction has been changed to %i by %s (%i)", faction, para1);
	SendClientMessage(para1, -1, string);
	Player[para1][pLeader] = faction;
	return 1;
}
Reply
#7

Код:
GM.pwn(507) : error 035: argument type mismatch (argument 2)
GM.pwn(507) : error 035: argument type mismatch (argument 2)
line 507:
Код:
GetPlayerName(para1, faction, sizeof(faction));
Reply
#8

Change:
Код:
new para1, faction;
to
Код:
new para1, faction[30];
Reply
#9

Look at the documentation:
https://sampwiki.blast.hk/wiki/GetPlayerName

Look at what kind of variable 'faction' is, and why it doesn't work that way.
Reply
#10

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Change:
Код:
new para1, faction;
to
Код:
new para1, faction[30];
Why would he do that? Can't you see that faction is in fact an integer, and not a string?

Код:
CMD:makeleader(playerid, params[])
{
	if (Player[playerid][pAdmin] < 4)
		return SCM(playerid, ADMIN_COLOR, ADMIN_MESSAGE);
	
	new para1, faction; 
	if (sscanf(params, "ui", para1, faction))
	{
		SendClientMessage(playerid, COLOR_WHITE, "{00E6FF}USAGE:{FFFFFF} /makeleader [PlayerID/PartOfName] [Faction 1 - 15]");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "1: Police Department || 2: F.B.I || 3: National Guard || 4: Medics");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "5: The Mafia || 6: The Triads || 7: Mayor || 8: Hitman Agency");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "9: News Reporter || 10: Taxi Company || 11: Los Santos Vagos || 12: Varrios Los Aztecas");
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "13: Ballas || 14: Grove Street || 15: NFS Club");
		return 1;
	}
	
	if (para1 == INVALID_PLAYER_ID)
		return SCM(playerid, -1, "Player is not connected.");
	
	if (faction < 1 || faction > 15)
		return SCM(playerid, -1, "{00E6FF}USAGE:{FFFFFF} /makeleader [PlayerID/PartOfName] {FF0000}[Faction 1 - 15]");
		
	
	new color, skin;
	switch (faction)
	{
		case 1: {color = 0xFF0000FF; skin = 250;}
		case 2: {color = 0x00FF00FF; skin = 12;}
		case 14: {color = 0x0000FFFF; skin = 55;}
	}
	SetPlayerSkin(para1, skin);
	SetPlayerColor(playerid, color);
	
	GetPlayerName(para1, str, 24);
	format(str, sizeof (str), "You have set %s's faction to %i.", str, faction);
	SendClientMessage(playerid, -1, str);
	
	GetPlayerName(playerid, str, 24);
	format(str, sizeof (str), "Your faction has been changed to %i by %s (%i)", faction, str, playerid);
	SendClientMessage(para1, -1, str);
	Player[para1][pLeader] = faction;
	return 1;
}
I hate giving full codes, but you clearly don't want to try to do stuff yourself, as Infinity posted what you needed to get the player's name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)