Need help
#1

So . I want system like if this goes to 0% , then u will die.
So i need textdraws system and that lives will go.
Reply
#2

what have you scripted of it so far?
Reply
#3

i Haven't script anything yet .
Reply
#4

First make your script before you put on the interior begins!
Reply
#5

Quote:
Originally Posted by admine
Посмотреть сообщение
First make your script before you put on the interior begins!
I didn't understand . I need to make this script . I don't have this yet.
Reply
#6

*Big Big Bump*
Reply
#7

Alright, I've whipped something up but it's untested so if it doesn't work, let me know...

STEP 1: Add this at the top of your script, under #include <a_samp>

pawn Код:
forward deathtime(); // this is the function which'll check if the player is at 100%
STEP 2: Add these under the forward deathtime(); we just placed.

pawn Код:
new Text:PlayerPercent[MAX_PLAYERS];
new deathtimer;
STEP 3: Add the following stock functions at the bottom of your script.

pawn Код:
stock SetPlayerPercent(playerid, percent)
{
    if(IsPlayerConnected(playerid))
    {
        new string[128];
        format(string,sizeof(string),"%d%%",percent);
        TextDrawSetString(PlayerPercent[playerid], string);
        SetPVarInt(playerid,"Percent",percent);
    }
}

stock CreatePercent()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        PlayerPercent[i] = TextDrawCreate(330.000000, 415.000000, "0%%");
        TextDrawAlignment(PlayerPercent[i], 2);
        TextDrawBackgroundColor(PlayerPercent[i], 255);
        TextDrawFont(PlayerPercent[i], 2);
        TextDrawLetterSize(PlayerPercent[i], 0.259999, 1.200000);
        TextDrawColor(PlayerPercent[i], -1);
        TextDrawSetOutline(PlayerPercent[i], 1);
        TextDrawSetProportional(PlayerPercent[i], 1);
        SetPVarInt(i,"Percent",0);
    }
}

stock HidePercent(playerid)
{
    TextDrawHideForPlayer(playerid,PlayerPercent[playerid]);
}

stock ShowPercent(playerid)
{
    TextDrawShowForPlayer(playerid,PlayerPercent[playerid]);
}
STEP 4: Add the following under OnGameModeInit.

pawn Код:
CreatePercent();
    deathtimer = SetTimer("deathtime",1000,1);
STEP 5: Add the following under OnGameModeExit.

pawn Код:
KillTimer(deathtimer);
STEP 6: We now have to set the players Percent and show the percent textdraw. Add these under OnPlayerSpawn.

pawn Код:
ShowPercent(playerid);
    SetPlayerPercent(playerid,GetPVarInt(playerid,"Percent"));
STEP 7: Add these under OnPlayerDisconnect.

pawn Код:
HidePercent(playerid);
STEP 8 (FINAL): Add this at the bottom of the script BUT above the stock functions.

pawn Код:
public deathtime()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(GetPVarInt(playerid,"Percent") == 100)
        {
            SetPlayerHealth(i,0);
            SetPlayerPercent(playerid,0);
            SetPVarInt(i,"Percent",0);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)