1 player change all players prefixes
#1

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

BUMP
Reply
#3

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);
Reply
#4

Код:
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);
Reply
#5

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

Remove "playerid" in the sizeof expression.
Reply
#7

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

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

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);
Reply
#10

@Facerafter

Working. Thanks

Thanks all guys I really appreciate yours help.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)