Hello There, Guest! Login or Register


LVP Class Documentation
#1
Since a few weeks a new class has been included in the global PHP configuration. This means that everyone hosted on the *.sa-mp.nl websites has access to it, and therefore can use it's features. You do not need to include anything to your current scripts either! Since a number of these features can be usefull for you and/or other people, a little documentation was pretty much required, so here it is.

Class: LVP
The LVP class provides an easy interface between your scripts and information related to the Las Venturas Playground server. All information is properly cached and gets updated automatically -- stuff you do not have to worry about. A number of functions have been created to get information, available for you are the following.
  • GetBanInfo (nickname/IP)

    This function gives you direct information about a ban happening on Las Venturas Playground. This function accepts one parameter, which can have two possible value's. The first option is that you can give a direct nickname, e.g. GetBanInfo(Peter). This simply returns all the bans that have occured on the nickname Peter. The second option is that you give in an IP Address. The IP can contain wildcards, but require the unique IP to be banned. This function only works for IP's that are currently in Las Venturas Playground's banlist.

    Quote:$LVP = new LVP();
    print_r( $LVP->GetBanInfo( 'Peter' ) );
    .
  • GetFunctionList ( )

    This function is quite simple, it returns an array with all currently-available functions in the LVP class. It is possible that this documentation gets a bit outdated due to newly added functions, the GetFunctionList always shows the complete list. Offcourse - there are more functions in the class, but you don't have to know them. Some functions are used internally or for other purposes.
    .
  • GetPropertyTable ( )

    This function returns a multi-demensional array displaying all properties that currently are created on Las Venturas Playground. At the moment of speaking, the array contains 134 keys which all got information (names, prices, owners etc) about a specific property. You can use this to create maps, information about your personal property, or whatever you think you might need it for. Every property got the following info in the array related with it;
    • [li]The property's database ID (ID)
    • The current name (Name)
    • A vector (X,Y,Z) containing the position (Position)
    • The current price (Price)
    • The earnings of this property (Earnings)
    • Interior ID it is located in (Interior)
    • A flag associated with the prop. (Flag)
    • Timestamp someone bought it (Bought)
    • User ID/Name from the current owner (Owner[])

    In order to display information from the very first property on LVP, Property number 0 (which currently is the 4 Dragons Casino), you can use the following bit of PHP code to show up-to-date information about it.

    Quote:$LVP = new LVP( );
    $aProperties = $LVP->GetPropertyTable( );
    print_r( $aProperties[ 0 ] );
    . [/li]
  • GetServerRankings ( )

    This function returns the list of 30 largest SA-MP Servers on Game-Monitor. Every server includes the current players, max. players, server name, address etcetera. The 10 largest servers (with game-rank 1 till 10) have the average player count included, other servers have not. This information gets updated once every minute, and generally is used to generate graphs.
    .
  • GetUserData ( Nickname )

    The GetUserData method can be used to get information about a specific player. This does not work on all players, just players that have been in-game after Thuesday September 4th around 17:00 GMT, so it should include the regular players on LVP. It returns you pretty much everything known about the player, ofcourse, with exclusion of his/her password. You can use it for whatever you want, however, abusing this function can get you your account deleted from the server.

    Quote:$LVP = new LVP();
    $aData = $LVP->GetUserData( 'Peter' );
    echo 'Peter has killed ' . $aData[ 'kills' ] . ' people on LVP!';
    .

New functions will be added on a regular basis, and ofcourse - I'm open to suggestions for more functions. You can use this topic for suggestions, comments and bug-reports about the PHP class. I am however asking you to respect me not listing other functions in the class, just don't use methods to get the entire function list.

Thank you, and good luck creating cool stuff.

Peter
Reply


Messages In This Thread
LVP Class Documentation - by Peter - 09-04-2007, 04:54 PM
Re: Documentation: LVP Class - by Rippance - 09-04-2007, 04:59 PM
Re: Documentation: LVP Class - by tomozj - 09-04-2007, 05:11 PM
Re: Documentation: LVP Class - by Badeend - 09-04-2007, 06:44 PM
Re: Documentation: LVP Class - by MrBondt - 09-04-2007, 06:45 PM
Re: Documentation: LVP Class - by Peter - 09-04-2007, 07:13 PM
Re: Documentation: LVP Class - by Chillosophy - 09-05-2007, 10:11 PM
Re: Documentation: LVP Class - by Chillosophy - 09-09-2007, 07:41 PM
Re: Documentation: LVP Class - by tomozj - 09-09-2007, 07:52 PM
Re: LVP Class Documentation - by tomozj - 09-27-2007, 10:32 PM