Jump to content

Ninja

Membru
  • Posts

    19
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Ninja

  1. PS: It's "Useful Functions", not "Usefull functions".

    GivePlayerHealth(playerid, Float:health)

    playerid - playerid, who we are giving health to

    Float:health - amount of health we're giving

    stock GivePlayerHealth(playerid, Float:health)

    {

        new Float:pHealth;

        GetPlayerHealth(playerid, pHealth);

        SetPlayerHealth(playerid, pHealth + health);

    }

    SetPlayerMoney(playerid, money)

    playerid - playerid, who's money we're setting

    money - amount of money what we're setting player's money to

    stock SetPlayerMoney(playerid, money)

    {

        ResetPlayerMoney(playerid);

        GivePlayerMoney(playerid, money);

    }

    PlayerToPoint(Float:radi, playerid, X, Y, Z) (NOTE: not by me)

    Float:radi - radius

    playerid - player that we're checking

    Float:x, Float:y, Float:z - The position we're checking player's length from

    stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)

    {

        new Float:oldposx, Float:oldposy, Float:oldposz;

        new Float:tempposx, Float:tempposy, Float:tempposz;

        GetPlayerPos(playerid, oldposx, oldposy, oldposz);

        tempposx = (oldposx -x);

        tempposy = (oldposy -y);

        tempposz = (oldposz -z);

        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))

        {

            return 1;

        }

        return 0;

    }

    StopMusic(playerid)

    playerid - player that we're stopping the music for

    stock StopMusic(playerid)

    {

    PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0);

    }

    IsStringAName(string[]) (NOTE: Not by me)

    string[] - String we're checking for name

    stock IsStringAName(string[])

    {

        for(new i = 0; i <= MAX_PLAYERS; i++)

        {

            if(IsPlayerConnected(i) == 1)

    {

        new testname[MAX_PLAYER_NAME];

                GetPlayerName(i, testname, sizeof(testname));

        if(strcmp(testname, string, true, strlen(string)) == 0)

        {

                    return 1;

                }

            }

        }

        return 0;

    }

    GetPlayerID(string[]) (NOTE: not by me)

    string[] - the string, which contains a player name, which ID we're getting

    stock GetPlayerID(string[])

    {

        for(new i = 0; i <= MAX_PLAYERS; i++)

        {

            if(IsPlayerConnected(i) == 1)

    {

                new testname[MAX_PLAYER_NAME];

        GetPlayerName(i, testname, sizeof(testname));

        if(strcmp(testname, string, true, strlen(string)) == 0)

        {

            return i;

        }

    }

        }

        return INVALID_PLAYER_ID;

    }

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.