Urgent Question
#1

I have an important question, how do I do that you can hit a particular object, for example if you beat it 20 times last player that beat him gets the money?
Thanks to helpers.
Reply
#2

Up!!
Reply
#3

Create a stock for detecting if a player hitted the specific objectid and use a global variable Hitwinner.
Something like
pawn Код:
public OnPlayerShootObject(playerid, objectid)//just a example
{
    Hitwinner = playerid;
    return 1;
}
and then give the reward to Hitwinner, GivePlayerMoney(Hitwinner, 1000);
Reply
#4

Quote:
Originally Posted by IamPRO
Посмотреть сообщение
Create a stock for detecting if a player hitted the specific objectid and use a global variable Hitwinner.
Something like
pawn Код:
public OnPlayerShootObject(playerid, objectid)//just a example
{
    Hitwinner = playerid;
    return 1;
}
and then give the reward to Hitwinner, GivePlayerMoney(Hitwinner, 1000);
No Use the public: OnPlayerWeaponShot ?
Reply
#5

Use something like:

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new Hits, Hitwinner;
    if(hittype == BULLET_HIT_TYPE_OBJECT)
    {
        if(hitid == Objectid)//if he hitted the objectid, don't put the id here, use something like new Objectid; and use Objectid = CreateDynamic........ while creating object.
        {
            Hits++
            Hitwinner = playerid;
            If(Hits == 20)
            {
                GivePlayerMoney(Hitwinner, 1000);
                Hits=0;
            }
        }
    }
   
    return 1;
}
untested code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)