Small Smaller Smallest help!
#1

Hi hi,

I am trying to make a text like when a player kills other, it shows in main chat like

[KILL]Player killed Player2 and earched $%d.

This is message:
Код:
format(msg, sizeof(msg), "[KILL]%d has killed %s and has earned $%d!", playerid,PlayerName2(playerid),ammount);
		SendClientMessageToAll(C_YELLOW,msg);
Everything works except the killername, it says like

[KILL]<playedid not name> killed <killed playername(works) and earned <ammount(works)
Reply
#2

Your first %d, should be a %s, and the reference for it should be PlayerName2(killerid) instead of playerid.

PHP код:
format(msgsizeof(msg), "[KILL]%s has killed %s and has earned $%d!"PlayerName2(killerid),PlayerName2(playerid),ammount); 
Assuming this is under OnPlayerDeath.

%d is Decimal.
%f is float.
%s is string.
Reply
#3

Thanks, you deserve a rep.
Reply
#4

One last thing, how can i make the same message like "[KILL]" PlayerX killed Player Y and earned (ammount) - <weapon used here>
Reply
#5

Hello!

PHP код:
format(msgsizeof(msg), "[KILL]%s has killed %s and has earned $%d! (Weapon: %i)"PlayerName2(killerid),PlayerName2(playerid),ammount,GetPlayerWeapon(killerid)); 
You can do it like this. Maybe you have to change this message in a whole sentence, but it's an example.
Reply
#6

PHP код:
new gunname[32], msg[64], fName[MAX_PLAYER_NAME], sName[MAX_PLAYER_NAME];
GetWeaponName(reason,gunname,sizeof(gunname));
GetPlayerName(playerid,fName,MAX_PLAYER_NAME);
GetPlayerName(killerid,sName,MAX_PLAYER_NAME);
format(msgsizeof(msg), "[Kill]%s killed Player %s and earned $500 -[ %s ]"sNamefName,gunname);
SendClientMessageToAll(C_YELLOW,msg); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)