#1

Hello,

Today i made a mine for my script It works fine
But i want this which i am not able to make :-

When a player uses mine if any player dies the player gets score so if 3 players dies the user gets 3 scores and if no one dies then 0 score
can anyone help me at this?

Reply
#2

Use SetPlayerScore.

Edit: I saw your previous thread on same topic. If you don't get any reply, wait for the answer on same thread instead of making a new one.
Reply
#3

This took a while longer than I thought it would have... this should work:

pawn Код:
new mine[MAX_PLAYERS];
new Float:MinePos[MAX_PLAYERS][3];

public OnPlayerConnect(playerid)
{
    mine[playerid] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(MineTimer(playerid));
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/placemine", true) == 0)
    {
        if(mine[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You have already placed a mine, use /removemine to remove it.");
        new Float:Pos[3];
        GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
        MinePos[playerid][0] = Pos[0];
        MinePos[playerid][1] = Pos[1];
        MinePos[playerid][2] = Pos[2];
        mine[playerid] = 1;
        SendClientMessage(playerid, 0xFFFF00FF, "You have planted a mine at your current position.");
        SetTimerEx("MineTimer", 500, true, "i", playerid);
        return 1;
    }

    if(strcmp(cmdtext, "/removemine", true) == 0)
    {
        if(mine[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You have not placed a mine, use /placemine to place one.");
        if(!IsPlayerInRangeOfPoint(playerid, 5.0, MinePos[playerid][0], MinePos[playerid][1], MinePos[playerid][2])) return SendClientMessage(playerid, 0xFF0000FF, "You are not in range of your mine, use /mine to find it.");
        mine[playerid] = 0;
        SendClientMessage(playerid, 0xFFFF00FF, "You have removed your mine. Use /placemine to place another.");
        KillTimer(MineTimer(playerid));
        return 1;
    }

    if(strcmp(cmdtext, "/mine", true) == 0)
    {
        if(mine[playerid] == 0) return SendClientMessage(playerid, 0xFF0000FF, "You have not placed a mine, use /placemine to place one.");
        SetPlayerCheckpoint(playerid, MinePos[playerid][0], MinePos[playerid][1], MinePos[playerid][2] - 0.3, 5.0);
        SendClientMessage(playerid, 0xFFFF00FF, "Your mine has been marked on your map.");
        return 1;
    }
    return 0;
}

public OnPlayerEnterCheckpoint(playerid)
{
    DisablePlayerCheckpoint(playerid);
    return 1;
}

forward MineTimer(playerid);
public MineTimer(playerid)
{
    new Count = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(i != playerid)
            {
                if(IsPlayerInRangeOfPoint(i, 2.0, MinePos[playerid][0], MinePos[playerid][1], MinePos[playerid][2]))
                {
                    if(GetPlayerState != PLAYER_STATE_WASTED)
                    {
                        if(Count == 0)
                        {
                            CreateExplosion(MinePos[playerid][0], MinePos[playerid][1], MinePos[playerid][2], 0, 5.0);
                        }
                        SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
                        SetPlayerHealth(i, 0);
                        Count++;
                        new string[80];
                        format(string,sizeof(string),"Player %s Was Killed By %s's Mine.", GetName(i), GetName(playerid));
                        SendClientMessageToAll(0x00FF00FF, string);
                        SendClientMessage(playerid, 0xFFFF00FF, "You have earned 1 score for achieving a mine kill.");
                    }
                }
            }
        }
    }
    return 1;
}

stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}
Reply
#4

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
This took a while longer than I thought it would have... this should work:
I think he said

Quote:
Originally Posted by Dark Killer
Посмотреть сообщение
... i made a mine for my script It works fine
Reply
#5

Oh well... shit happens.
Reply
#6

No mr.anonymous this topic have something else and that had something else

Thnx benzo you helped me

Today i made a mine for my script It works fine
But i want this which i am not able to make :-

i said this ^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)