Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Pun1sh3r

#1
Hello everyone,

today I present you after long time my updated Version of my old Deathlist working with Textdraws and Sprites in the past.

How does the Deathlist looks?

Names are always showed in the Deathlist with the Players Color

You can remove the connect & disconnect Messages in Chat and add it to the Deathlist!
How?

Add this to your onScriptLoad() callback:
SetJoinMessages(false); //This function will toggle the join messages on or off.
Add this to your onPlayerJoin(player) callback:
SendDeathMessageToAll(71, player.Name, player.Colour);

Add this to your onPlayerPart(player, reason) callback:
SendDeathMessageToAll(72, player.Name, player.Colour);

Now you can add Kill Messages to the Deathlist and disable it in Chat!
How to disable the Kill Messages in Chat?

Add this to your onScriptLoad() callback:
SetDeathMessages(false); //This function will toggle death messages on or off.
Add this to your onPlayerDeath(player, reason)  callback:
SendDeathMessageToAll(reason, player.Name, player.Colour);

Add this to your onPlayerKill(killer, player, reason, bodypart) callback:
SendDeathMessageToAll(reason, killer.Name, killer.Colour, player.Name, player.Colour);

DeathWindow function:
function SendDeathMessageToPlayer(player, reason, leftName, rgb, rightName = null, rgb2 = null)
{
    if (rightName)
{
SendDataToClient(player, 0x01, reason, leftName, rgb.r, rgb.g, rgb.b, rightName, rgb2.r, rgb2.g, rgb2.b);
}
    else
{
SendDataToClient(player, 0x01, reason, leftName, rgb.r, rgb.g, rgb.b);
}
return 1;
}

function SendDeathMessageToAll(reason, leftName, rgb, rightName = null, rgb2 = null)
{
    for (local plr, i = 0; i < GetMaxPlayers(); i++)
{
        plr = FindPlayer(i);
        if (plr)
{
if (rightName)
{
SendDataToClient(plr, 0x01, reason, leftName, rgb.r, rgb.g, rgb.b, rightName, rgb2.r, rgb2.g, rgb2.b);
}
else
{
SendDataToClient(plr, 0x01, reason, leftName, rgb.r, rgb.g, rgb.b);
}
}
}
return 1;
}

ClientSide Script is added in the Packages.
Download the full Package with Images, Server Side & Client Side Script

Feel free to download it now.

Please do not add any other Download links, this will be always Online I added as it is hosted on my Webserver.


#2
[Bug] CreateCheckpoint for player with Server Version 33

Description
Update the Server Version from 30 to 33 (Newest) and then testing Race Minigame on my localhost and Linux root,
if a Player disconnects then the Player is still connected with Ping -1 and cannot be kicked

Reproducible
Always

What you were doing when the bug happened
Testing if everything is working on Server Version 33, never happend in Server Version 30

What you think caused the bug
CreateCheckpoint for a player

Here is a example blank Script with /test command, both connected Players need to type /test and then disconnect, both Players will stay connected with Ping -1.
https://pastebin.com/3rfQxGxg
#3
Bugs and Crashes / [Bug] CreateMarker
Dec 30, 2020, 12:59 AM
Description
Create a Marker with Marker ID 0 and with a RED or any other Color and it wont always have the correct set Color.

Reproducible
Sometimes

What you were doing when the bug happened
Testing

What you think caused the bug
I guess the Color is mixed up? If you set RED Color RGB(255,0,0) then it will sometimes have Pink Color, if you set RGB(242, 125, 253) it will have sometimes White Color

Example Code:
local Marker1 = -1;
local Count = 0;
if(cmd == "marker")
{
if(Count == 0)
{
if(Marker1 != -1)
{
DestroyMarker(Marker1);
Marker1 = -1;
}
Marker1 = CreateMarker(player.UniqueWorld, Vector(496.481, -84.883, 10.0304), 4, RGB(242, 125, 253), 0);
ClientMessage("0: Marker Created!", player, 255, 255, 255);
Count = 1;
}
else if(Count == 1)
{
if(Marker1 != -1)
{
DestroyMarker(Marker1);
Marker1 = -1;
}
Marker1 = CreateMarker(player.UniqueWorld, Vector(480.481, -70.883, 10.0304), 4, RGB(242, 125, 253), 0);
ClientMessage("1: Marker Created!", player, 255, 255, 255);
Count = 0;
}
return 1;
}
#4
 I tried to create a GUI Text which should be Center but it does nothing? Also tried the rest which is written in the Wiki Page

QuoteFooterText = GUILabel( );
            FooterText.Pos = VectorScreen( sX/7, sY-(sY/28) );
       FooterText.TextAlignment = GUI_ALIGN_CENTER;
            FooterText.FontSize = 20;
            FooterText.TextColour = Colour( 255, 255, 255 );
            FooterText.FontFlags = GUI_FFLAG_BOLD;
            FooterText.Text = FooterString;

QuoteProperty TextAlignment

Type: int

Sets the alignment of text. Available constants are:

GUI_ALIGN_LEFT
GUI_ALIGN_RIGHT
GUI_ALIGN_TOP
GUI_ALIGN_BOTTOM
GUI_ALIGN_CENTERV
GUI_ALIGN_CENTERH
GUI_ALIGN_CENTER

Anything wrong with my Code?
#5
Hello all!

I want to Import 3 Objects from SA:MP because I need them to make with those Objects some Race Checkpoints.
I have Exported the .dff files and one .txd files (No collision files as the Object should have no Collision)

So here is what I get:
Objects are loaded and if I create them I just see the Object but not fully, it's like with an Alpha of 50 but I set the Alpha to 255.
What I'm doing wrong? Here are the <files>

Screen:


Look at the Picture, zoom it to see the Object

Thanks and I hope someone can help me
#6
Hello all,

I want to Improve my Deathlist and make it colored and I want to convert the Player Color to HEX Code for Textdraws.
How exactly I can do this? I was trying to make it possible but failed cause one time the server said "Expected int and got string"


Would be nice if anyone of you can help me out with this Problem, thanks!
#7
Hello all!

I present you here my new Deathlist I made when I was bored and thought it would be nice to share it to you guys.

Images with Weapons are from the Wikipedia site from wiki.vc-mp.org and the other Images are made by Pwnzor (Yes I got the premission from him to share his Pictures.)


Put this code at the first few lines in your Script
//Deathlist Settings

MaxLines <- 5;             //Max Lines it shows in Deathlist
LineGap <- 30;            //How much space between the Names
PosX <- -245;              //PosX for first part      (Do not change unless you know what you are doing)
PosY <- 504;               //PosY for first part       (Do not change unless you know what you are doing)
PosX2 <- -190;           //PosX for second part  (Do not change unless you know what you are doing)
PosY3 <- 502;            //PosY for second part   (Do not change unless you know what you are doing)

Put this code under onScriptLoad public
//Death Window Vars
TextLengh <- array(MaxLines);
TextInfo <- array(MaxLines);
TextInfo2 <- array(MaxLines);
SpriteInfo <- array(MaxLines);

Put this code somewhere you want if onPlayerDeath and onPlayerKill is not already used, if you have it already then just add the DeathWindow part in your public.

function onPlayerDeath( player, reason )
{
DeathWindow(player.Name, reason, " "); //" " must be with space to prevent any bugs
return 1;
}

function onPlayerKill( player, killer, reason, bodypart )
{
DeathWindow(killer.Name, reason, player.Name);
return 1;
}

This is the main function to make the Deathlist working
function DeathWindow(leftName, reason, rightName)
{
image <- "" + reason + ".png";
if (TextInfo[0])
{
TextInfo[0].Delete();
}
if(SpriteInfo[0])
{
SpriteInfo[0].Delete();
}
if (TextInfo2[0])
{
TextInfo2[0].Delete();
}
for (local i=0; i<MaxLines-1; i++)
{
if(TextLengh[i+1])
{
TextLengh[i] = TextLengh[i+1];
}
if (TextInfo[i+1])
{
TextInfo[i] = TextInfo[i+1];
TextInfo[i].SetPosForAll(PosX-TextLengh[i], PosY-(i)*LineGap);
}

if(SpriteInfo[i+1])
{
SpriteInfo[i] = SpriteInfo[i+1];
SpriteInfo[i].SetPosForAll(-230, PosY3-(i)*LineGap);
}

if(TextInfo2[i+1])
{
TextInfo2[i] = TextInfo2[i+1];
TextInfo2[i].SetPosForAll(PosX2, PosY-(i)*LineGap);
}
}

MinusPosX <- 0;

if(leftName.len() == 1)
{
MinusPosX <- 8;
}
else
{
MinusPosX <- leftName.len()*8;
}

TextLengh[MaxLines-1] = MinusPosX;
TextInfo[MaxLines-1] = CreateTextdraw(leftName, PosX-MinusPosX, PosY-(MaxLines-1)*LineGap, 0xFFB0B0B0);
TextInfo[MaxLines-1].ShowForAll();
SpriteInfo[MaxLines-1] = CreateSprite(image, -230, PosY3-(MaxLines-1)*LineGap, 0, 0, 0, 200);
SpriteInfo[MaxLines-1].ShowForAll();
TextInfo2[MaxLines-1] = CreateTextdraw(rightName, PosX2, PosY-(MaxLines-1)*LineGap, 0xFFB0B0B0);
TextInfo2[MaxLines-1].ShowForAll();
return 1;
}


Additional you can add Connect and Disconnect messages to the Deathlist to reduce the Spam in Chat with Connect and Disconnect messages.

function onPlayerJoin(player)
{
DeathWindow(" ", "71", player.Name);
return 1;
}

function onPlayerPart( player, reason )
{
DeathWindow(" ", "72", player.Name);
return 1;
}

Downloads:
Images
Deathlist with Icons and script for the lazy peoples :)

Note: Please do not add any other download links, thanks!

Credits:
Pun1sh3r (Creator)
Pwnzor (For the Images he made such as Connect/Disconnect/Death/Explode and so on...)
ysc3839 - for the basic code at DeathWindow