SA-MP Forums Archive
1 player change all players prefixes - 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: 1 player change all players prefixes (/showthread.php?tid=552923)



1 player change all players prefixes - dan40o - 27.12.2014

1 player can change all prefixes for all players.

on the top

Код:
new prefix[MAX_PLAYERS];
OnPlayerText

Код:
                    new customprefix[256];
		    new customprefixplayer[MAX_PLAYER_NAME];
		    GetPlayerName(playerid, customprefixplayer, sizeof(customprefixplayer));
		    format(customprefix, sizeof(customprefix), "{b800db}[{ffffff}%s{b800db}]{940000}%s: {ffffff}%s", prefix, customprefixplayer, text);
		    SendClientMessageToAll(GetPlayerColor(playerid), customprefix);
CMD:

Код:
                new tag[16];
		if(sscanf(params,"s[16]",tag)) return SendClientMessage(playerid, WHITE, "USAGE:/setmyprefix [text]");
		format(prefix, sizeof(prefix), tag, prefix);
		return 1;



Re: 1 player change all players prefixes - dan40o - 28.12.2014

BUMP


Re: 1 player change all players prefixes - Facerafter - 28.12.2014

Try this.
Код:
new prefix[MAX_PLAYERS][16];
Код:
                new tag[16];
		if(sscanf(params,"s[16]",tag)) return SendClientMessage(playerid, WHITE, "USAGE:/setmyprefix [text]");
		format(prefix[playerid], sizeof(prefix[playerid]), "%s", tag);
		return 1;
Код:
                  new customprefix[256];
		    new customprefixplayer[MAX_PLAYER_NAME];
		    GetPlayerName(playerid, customprefixplayer, sizeof(customprefixplayer));
		    format(customprefix, sizeof(customprefix), "{b800db}[{ffffff}%s{b800db}]{940000}%s: {ffffff}%s", prefix[playerid], customprefixplayer, text);
		    SendClientMessageToAll(GetPlayerColor(playerid), customprefix);



Re: 1 player change all players prefixes - dan40o - 28.12.2014

Код:
D:\Samp Server\gamemodes\ServerFile.pwn(7811) : error 001: expected token: "]", but found "-identifier-"
D:\Samp Server\gamemodes\ServerFile.pwn(7811) : warning 215: expression has no effect
D:\Samp Server\gamemodes\ServerFile.pwn(7811) : error 001: expected token: ";", but found "]"
D:\Samp Server\gamemodes\ServerFile.pwn(7811) : error 029: invalid expression, assumed zero
D:\Samp Server\gamemodes\ServerFile.pwn(7811) : fatal error 107: too many error messages on one line
LINE: format(prefix[playerid], sizeof(prefix[playerid]), "%s", tag);


AW: 1 player change all players prefixes - Flori - 28.12.2014

When you use the parameter playerid under OnPlayerText it is just logic that each players prefix will be changed. Bc each playerid calls OnPlayerText when writing anything in the chat. Use SetPlayerName instead:
https://sampwiki.blast.hk/wiki/SetPlayerName


Re: 1 player change all players prefixes - Vince - 28.12.2014

Remove "playerid" in the sizeof expression.


Re: 1 player change all players prefixes - dan40o - 28.12.2014

But with SetPlayerName will write the prefix and the player name in the file? or?


Re: 1 player change all players prefixes - Facerafter - 28.12.2014

Oeps sorry
Change
Код:
format(prefix[playerid], sizeof(prefix[playerid]), "%s", tag);
to this
Код:
	format(prefix[playerid], sizeof(tag), "%s", tag);



AW: Re: 1 player change all players prefixes - Flori - 28.12.2014

Quote:
Originally Posted by dan40o
Посмотреть сообщение
But with SetPlayerName will write the prefix and the player name in the file? or?
You get the playername first, then you make a format in which you make some thing like: %s%s, the name and prefix and then you set the name to that format.

pawn Код:
new name[MAX_PLAYER_NAME];
new string[24];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s%s",name,prefix);
SetPlayerName(playerid,string);



Re: 1 player change all players prefixes - dan40o - 28.12.2014

@Facerafter

Working. Thanks

Thanks all guys I really appreciate yours help.