SA-MP Forums Archive
Small Smaller Smallest help! - 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: Small Smaller Smallest help! (/showthread.php?tid=593575)



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(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.


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(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.


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(msgsizeof(msg), "[Kill]%s killed Player %s and earned $500 -[ %s ]"sNamefName,gunname);
SendClientMessageToAll(C_YELLOW,msg);