Killerid,playerid,reason self made textdraw
#1

hi,
id like to avoid this function: SendDeathMessage(killerid, playerid, reason);
and use a slefmade textdraw instead.
Ive created the texdraw.
It shall work like the normal kills/deaths list in SAMP, as soon as a player gets killed it shall show the victim and the killer. Also the weapon the player has been killed with and the distance from what the player has been shot shall be displayed.

For the distance ive already got a code that is working:
pawn Код:
stock Float:GetDistanceBetweenPoints(Float:X, Float:Y, Float:Z, Float:PointX, Float:PointY, Float:PointZ) return floatsqroot(floatadd(floatadd(floatpower(floatsub(X, PointX), 2.0), floatpower(floatsub(Y, PointY), 2.0)), floatpower(floatsub(Z, PointZ), 2.0)));

stock Float:GetDistanceBetweenPlayers(playerid, otherplayerid)
{
new Float:X[2], Float:Y[2], Float:Z[2];
GetPlayerPos(playerid, X[0], Y[0], Z[0]);
GetPlayerPos(otherplayerid, X[1], Y[1], Z[1]);
return GetDistanceBetweenPoints(X[0], Y[0], Z[0], X[1], Y[1], Z[1]);
}

     new
     PlayerNick[MAX_PLAYER_NAME],
     KillerNick[MAX_PLAYER_NAME],
     String[128];
     GetPlayerName(playerid, PlayerNick, MAX_PLAYER_NAME);
     GetPlayerName(killerid, KillerNick, MAX_PLAYER_NAME);
     format(String,sizeof(String),"==> %s killed %s (%s)(Dist : %.2f Ft)",KillerNick,PlayerNick,WeaponNames[reason],GetDistanceBetweenPlayers(playerid,killerid));
     SendClientMessageToAll(0xAA3333AA,String);
But i want to associate this with my texdraw (i dont want that this gets displayed trought a ClientMessage)
i tried it like this, but its not working
pawn Код:
//OnPlayerDeath

     new
     PlayerNick[MAX_PLAYER_NAME],
     KillerNick[MAX_PLAYER_NAME],
     String[128];
     GetPlayerName(playerid, PlayerNick, MAX_PLAYER_NAME);
     GetPlayerName(killerid, KillerNick, MAX_PLAYER_NAME);
     deaths[playerid]++;
     if(killerid!=INVALID_PLAYER_ID)
     {
        kills[killerid]++;
     }
     new ktdnwr[100];
     format(ktdnwr,sizeof(ktdnwr),"%d killed %d",KillerNick,PlayerNick);
     TextDrawSetString(krn1,ktdnwr);//krn1 is the first textdraw (killerid and playerid)
     new ktdnwr2[100];
     format(ktdnwr2,sizeof(ktdnwr2),"Weapon: %d Distance: %d",WeaponNames[reason],GetDistanceBetweenPlayers(playerid,killerid));
     TextDrawSetString(krw1,ktdnwr2);//krw1 is the second textdraw (weapon and distance)
     TextDrawShowForAll(krn1);
     TextDrawShowForAll(krw1);
Textdraws are created like this:
pawn Код:
krn1 = TextDrawCreate(453.000000, 272.000000, "BlackWolf120 killed Chickennugezzzdd");
TextDrawBackgroundColor(krn1, 255);
TextDrawFont(krn1, 3);
TextDrawLetterSize(krn1, 0.269999, 0.899999);
TextDrawColor(krn1, -1);
TextDrawSetOutline(krn1, 1);
TextDrawSetProportional(krn1, 1);
TextDrawUseBox(krn1, 1);
TextDrawBoxColor(krn1, 1684326500);
TextDrawTextSize(krn1, 692.000000, -1.000000);

krw1 = TextDrawCreate(453.000000, 286.000000, "Weapon: Minigunddd Distance: 400ftgg");
TextDrawBackgroundColor(krw1, 255);
TextDrawFont(krw1, 3);
TextDrawLetterSize(krw1, 0.269999, 0.899999);
TextDrawColor(krw1, -1);
TextDrawSetOutline(krw1, 1);
TextDrawSetProportional(krw1, 1);
TextDrawUseBox(krw1, 1);
TextDrawBoxColor(krw1, 1684326500);
TextDrawTextSize(krw1, 692.000000, -1.000000);
I hope someone can help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)