Small Smaller Smallest help! -
perfectboy - 07.11.2015
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)
Re: Small Smaller Smallest help! -
Sew_Sumi - 07.11.2015
Your first %d, should be a %s, and the reference for it should be PlayerName2(killerid) instead of playerid.
PHP код:
format(msg, sizeof(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.
Re: Small Smaller Smallest help! -
perfectboy - 07.11.2015
Thanks, you deserve a rep.
Re: Small Smaller Smallest help! -
perfectboy - 07.11.2015
One last thing, how can i make the same message like "[KILL]" PlayerX killed Player Y and earned (ammount) - <weapon used here>
Re: Small Smaller Smallest help! -
Mencent - 07.11.2015
Hello!
PHP код:
format(msg, sizeof(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.
Re: Small Smaller Smallest help! -
Sh4d0w2 - 07.11.2015
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(msg, sizeof(msg), "[Kill]%s killed Player %s and earned $500 -[ %s ]", sName, fName,gunname);
SendClientMessageToAll(C_YELLOW,msg);