[solved] need help : Type mismatch in paremeter 4

Discussions about Coding and Scripting
User avatar
Letylove49
Masterful
Posts: 529
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

[solved] need help : Type mismatch in paremeter 4

Post by Letylove49 »

Error: D:\UT coding\UnrealTournament\Nexgen112AuthenticBFv3\Classes\NexgenController.uc(1147) : Error, Call to 'broadcastMsg': type mismatch in parameter 4

Code: Select all

broadcastMsg(lng.playerJoinMsg, client.playerName $ ", Team '" $ client.myTeamName $ "'", client.title,  client.player.playerReplicationInfo);
BrodcastMsg function :

Code: Select all

***************************************************************************************************
 *
 *  $DESCRIPTION  Broadcasts the given message to all connected clients.
 *  $PARAM        msg   Message that should send to all the clients.
 *  $PARAM        str1  Message specific content.
 *  $PARAM        str2  Message specific content.
 *  $PARAM        str3  Message specific content.
 *  $PARAM        str4  Message specific content.
 *  $PARAM        pri   Replication info of the player related to this message.
 *
 **************************************************************************************************/
function broadcastMsg(string msg, optional string str1, optional string str2, optional string str3,
                      optional string str4, optional PlayerReplicationInfo pri) {
	local NexgenClient client;

	
	// Format message.
	msg = class'NexgenUtil'.static.format(msg, str1, str2, str3, str4);
	
	// Log message.
	nscLog(class'NexgenUtil'.static.removeMessageColorTag(msg), LT_Event);
	
	// Send message to all clients.
	for (client = clientList; client != none; client = client.nextClient) {
		client.showMsg(msg, pri);
	}
}


Type Mismatch = int, string ect.. ? what i have done wrong ? anyone can help me ?
Last edited by Letylove49 on Fri Apr 25, 2025 10:47 am, edited 1 time in total.
Image
Image
Letylove49 aka Alicia
User avatar
f7r
Experienced
Posts: 144
Joined: Mon Oct 19, 2020 6:53 pm

Re: need help : Type mismatch in paremeter 4

Post by f7r »

How does it work that your fourth parameter instead of the sixth is a PRI?

Try this

Code: Select all

broadcastMsg(lng.playerJoinMsg, client.playerName $ ", Team '" $ client.myTeamName $ "'", client.title, "", "", client.player.playerReplicationInfo);
User avatar
Barbie
Godlike
Posts: 3330
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: need help : Type mismatch in paremeter 4

Post by Barbie »

Looks like you mixed up

Code: Select all

class'Actor'.BroadcastMessage( coerce string Msg, optional bool bBeep, optional name Type )
and

Code: Select all

class'NexgenController'.broadcastMsg(string msg, optional string str1, optional string str2, optional string str3, optional string str4, optional PlayerReplicationInfo pri)
"If Origin not in center it be not in center." --Buggie
User avatar
Letylove49
Masterful
Posts: 529
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: need help : Type mismatch in paremeter 4

Post by Letylove49 »

ok thanks that solve the first issue now i got the same error here ( without the team name) ,

Code: Select all

 broadcastMsg(lng.playerJoinMsg, client.playerName, client.title,"'" , client.player.playerReplicationInfo);
Image
Image
Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 3330
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: need help : Type mismatch in paremeter 4

Post by Barbie »

Letylove49 wrote: Tue Jan 14, 2025 8:23 pm ok thanks that solve the first issue now i got the same error here ( without the team name) ,

Code: Select all

 broadcastMsg(
	lng.playerJoinMsg,
	client.playerName,
	client.title,
	"'" ,
	client.player.playerReplicationInfo
);
Looks like you missed parameter "str4":

Code: Select all

class'NexgenController'.broadcastMsg(
	string msg,
	optional string str1, //
	optional string str2,
	optional string str3,
	optional string str4,
	optional PlayerReplicationInfo pri
)
Just leave it empty if nott needed:

Code: Select all

 broadcastMsg(
	lng.playerJoinMsg,
	client.playerName,
	client.title,
	"'" ,
	,
	client.player.playerReplicationInfo
);
"If Origin not in center it be not in center." --Buggie