[Include] Random Functions V1
#1

Random Functions V1


Introduction

Hello, this is a set of 11 random functions. And by random, I mean REALLY random - even more random than the things Logitech90 posts. I was bored today, and I thought "I haven't released something on the SA:MP forums in like... 5 months", so I thought I'd strike again. These functions are really not advanced, but still, I thought I'd release them.

The Functions
  • RotationToPoint(int playerid,double x, double y)

    Description: Gets the required rotation of a player towards a point.
    • int playerid - The PlayerID of the player whose rotation you want to get
    • double x - The X (horizontal) location on the map of the point
    • double y - The Y (vertical) location on the map of the point
    Returns: The rotation as a Double/Float


  • RotationToPlayer(int playerid,int playerid2)

    Description: Gets the required rotation of a player towards another player.
    • int playerid - The PlayerID of the player whose rotation you want to get
    • int playerid2 - The PlayerID of the player whose co-ordinates you want to get the rotation to
    Returns: The rotation as a Double/Float


  • RotationToVehicle(int playerid,int vehid)

    Description: Gets the required rotation of a player towards a vehicle.
    • int playerid - The PlayerID of the player whose rotation you want to get
    • int vehid- The ID of the vehicle whose co-ordinates you want to get the rotation to
    Returns: The rotation as a Double/Float


  • strrev(const string[],int len)

    Description: Reverses the specified string
    • const string[]- The string that will be reversed
    • int len - The lenght of the string that will be reversed. Specifying a lower value may trim the string
    Returns: The reversed string as a string/char array


  • substr(const string[],int index,int len)

    Description: Returns the portion of a string, specified by the index and len parameters.
    • const string[]- The string that will be reversed
    • int index - The starting index of the portion in the string
    • int len - The lenght of the portion
    Returns: The substring as a string/char array


  • FormatInt(int number, char delimiter)

    Description: Formats a number using the specified delimiter
    • int number - The number which will be formatted Note: The number should not exceed 9 characters
    • char delimiter - The ascii character that will be used in the formatting
    Returns: The formatted number as a string/char array


  • fRandom(double max)

    Description: Generates a random double number/float between 0 and a value
    • double/float max - The highest possible number
    Returns: The random number as a double/float


  • fRandomEx(double min,double max)

    Description: Generates a random double number/float between two values
    • double/float min - The lowest possible number
    • double/float max - The highest possible number
    Returns: The random number as a double/float


  • RandomEx(int min,int max)

    Description: Generates a random double number/float between two values
    • int min - The lowest possible number
    • int max - The highest possible number
    Returns: The random number as an int


  • IsPlayerSwimming(int playerid)

    Description: Checks if a player is currently swimming
    • int playerid - The ID of the player whose state you want to check
    Returns: Weather a player is swimming as a boolean


  • IsPlayerFalling(int playerid)

    Description: Checks if a player is currently falling
    • int playerid - The ID of the player whose state you want to check
    Returns: Weather a player is falling falling as a boolean


Installation

The installation is simple - Just download the file and put it in your "ServerFolder/pawno/include". Then, in your scripts, use #include <hfunc>

Downloads

Pastebin.com
Uploading.com

Mirrors are welcome
Reply


Messages In This Thread
Random Functions V1 - by KingHual - 02.07.2012, 16:21
Re: Random Functions V1 - by Niko_boy - 02.07.2012, 16:28
Re: Random Functions V1 - by Eirikm - 04.07.2012, 13:08
Re: Random Functions V1 - by TheArcher - 04.07.2012, 13:35
Re: Random Functions V1 - by Lordzy - 04.07.2012, 13:49
Re: Random Functions V1 - by KingHual - 28.09.2012, 18:26

Forum Jump:


Users browsing this thread: 1 Guest(s)