How to make 1shot for sniper if you buy it
#1

How to take a one shot for sniper but i want to make a scope for buying and if you buy scope your sniper will take a one shot.

But this scope one shot is for only player that buy a scope and this is a script


pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34)
    {
        // One shot to kill with sniper rifle
        if(PlayerInfo[issuerid][pScope] >= 1)
        {
            SetPlayerHealth(playerid, 0.0);
        }
        else
        {
            SetPlayerHealth(playerid, 0, 30);
        }

    }
    return 1;
}
Reply
#2

pawn Код:
CMD:buy(playerid, params[])
{
    if(PlayerInfo[issuerid][pScope] >= 1)
        return SendClientMessage(playerid, 0xFF0000FF,"You've already got a scope.");
       
    if(GetPlayerMoney(playerid) < 50000) //change this.
        return SendClientMessage(playerid, 0xFF0000FF,"A scope is worth 50000$! You can't pay it!");

    PlayerInfo[issuerid][pScope] = 1;
    GivePlayerMoney(playerid, -50000); //and this
   
    SendClientMessage(playerid,0x00AA00FF, "You have bought a scope for 50000$!");
    return 1;
}
Assuming you've got zcmd it'll work, otherwise convert it. You need to make a command that let's the player buy the scope.

Buying is just the fancy name for setting the variable (pScope) to 1 and then removing the money needed.
Reply
#3

Quote:
Originally Posted by Lloyde
Посмотреть сообщение
How to take a one shot for sniper but i want to make a scope for buying and if you buy scope your sniper will take a one shot.

But this scope one shot is for only player that buy a scope and this is a script


pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34)
    {
        // One shot to kill with sniper rifle
        if(PlayerInfo[issuerid][pScope] >= 1)
        {
            SetPlayerHealth(playerid, 0.0);
        }
        else
        {
            SetPlayerHealth(playerid, 0, 30);
        }

    }
    return 1;
}
Also on your second SetPlayerHealth you have a parameter to much.
My guess is that you want to set his health to 30, so remove the '0,' from there
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)