SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 02/01/2009, 11:37 PM   #1
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 18,175
Reputation: 2541
Default Linux/CentOS YSF 0.2 released

YSF 0.2 - Linux/CentOS 0.2x support included!

Introduction

You've been asking for it for months, and it's FINALLY done! This new version of YSF, so fundamental I created a whole new topic for it, supports Windows 0.2.2, 0.2.2r2 and 0.2x AND Linux 0.2x. I will not be doing support for older Linux versions so don't even ask, if you can't be bothered to upgrade to the latest version that's your own lookout.

The .so also apparently supports CentOS.

Download

Straight to the point:

HERE

Use
  • Windows

Make sure "YSF.dll" is in your "plugins" directory. If you don't have a "plugins" directory make one in your root server directory. Then add:

Code:
plugins YSF
To "server.cfg".
  • Linux

Make sure "YSF.so" is in your "plugins" directory. If you don't have a "plugins" directory make one in your root server directory. Then add:

Code:
plugins YSF.so
To "server.cfg".
  • PAWN

To use the YSF functions in your scripts make sure "YSF.inc" is in "pawno/include". Then add:

pawn Code:
#include <YSF>

To the script you wish to use the functions in. See "Examples" for further usage information.

Fixes

List of bugs and whether or not they're fixed yet in YSF (or can be fixed). Credits to BeckzyBoi for the original bugs list.


Bug
Status
Notes


a_objects.inc
  • SetPlayerObjectRot
F



a_players.inc
  • SpawnPlayer
W
What I thought would solve it didn't, need to find something else to try.
  • GetPlayerInterior
-
  • SetPlayerAmmo
-
  • GetPlayerAmmo
-
  • SetPlayerTeam
-
  • GetPlayerTeam
-
  • GetPlayerColor
F
  • SetPlayerDisabledWeapons
R
Was removed, although may be simpleish to implement
  • RemovePlayerFromVehicle
?
May be doable by faking the data sent to other players to say that player got out, instead of was forced out
  • TogglePlayerControllable
-
Doable
  • SetPlayerCheckpoint
X
  • SetPlayerRaceCheckpoint
X
  • SetPlayerWorldBounds
X
  • AllowPlayerTeleport
F
Fixed, along with AllowAdminTeleport, was a simple logic mix-up.
  • IsPlayerInCheckpoint
F
  • IsPlayerInRaceCheckpoint
F
  • TogglePlayerSpectating
?
Irritating but more a client problem.
  • SPECTATE_MODE_FIXED
?
This should put you in spectate mode in a fixed location. Easily faked with SetPlayerCamera.


a_samp.inc
  • AddStaticPickup
-
Should be easy enough to "fix".
  • CreatePickup
W
Discussion.
  • GetWeaponName
-
Random.
  • AllowAdminTeleport
F
See AllowPlayerTeleport.
  • SetDeathDropAmount
R
  • DisableInteriorEnterExits
X
  • CreateMenu
X
  • GetPlayerMenu
-
  • TextDrawColor/TextDrawBackgroundColor
-
Just hide and reshow them.
  • OnPlayerDeath
?
  • OnVehicleDeath
N
Future expansion.
  • OnPlayerEnterVehicle
?
  • OnRconCommand
F



a_vehicles.inc
  • SetVehiclePos
?
Doubt it can be solved.
  • GetVehicleZAngle
?
  • SetVehicleParamsForPlayer
X
I've warned people about this before, it's to do with the map icon limit.
  • GetVehicleTrailer
-
  • SetVehicleVirtualWorld
-



string.inc
  • strcmp
?
strcmp returns the lexographic difference between two strings, the fact that this value can be used to see if two strings are the same is not it's main function. I don't know what the lexographic difference between a string a nothing is, requires looking up to see if this is really a bug or just a function working differently to how people expect. Basically: use dcmd!
  • strval
F



Misc
  • unloadfs
F
  • SQLite
F




Key
FFixed
YYet to be released (fixed in my dev version)
NNot a bug (IMHO)
RRemoved
XCan't be done server side
-Not looked into
?Don't know
WWIP


Once everything is green or red YSF is basically finished.

Features

List of features which aren't bug fixes or new functions.
  • Improved plugin architecture.
  • Extracted nickname check function, define your own allowed characters.

Functions

List of new PAWN functions.
  • pawn Code:
    SetPlayerGravity(playerid, gravity);
    Set a single player's gravity (beware desyncs).
  • pawn Code:
    AddServerRule(name[], value[]);
    Add server information to the server browser.
  • pawn Code:
    SetServerRule(name[], value[]);
    Modify server information in the server browser.
  • pawn Code:
    SetPlayerSkinForPlayer(skinplayer, forplayer, skin);
    Set the skin a player sees another player with.
  • pawn Code:
    GetPlayerSkinForPlayer(skinplayer, forplayer);
    Get the skin one player sees another player using.
  • pawn Code:
    ffind(const pattern[], filename[], len, &idx);
    Find files matching a pattern.
  • pawn Code:
    frename(const oldname[], const newname[]);
    Rename a file.
  • pawn Code:
    dfind(const pattern[], filename[], len, &idx);
    Fine directories matching a pattern.
  • pawn Code:
    dcreate(const name[]);
    Create a directory.
  • pawn Code:
    drename(const oldname[], const newname[]);
    Rename a directory*.

* This function used to be identical to frename, it's now not, make sure you're using the correct one (they still interchangeable on Windows).

Examples
  • SetPlayerSkinForPlayer

pawn Code:
new
    gLastKiller[MAX_PLAYERS] = {INVALID_PLAYER_ID, ...};

public OnPlayerDisconnect(playerid, reason)
{
    gLastKiller[playerid] = INVALID_PLAYER_ID;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    // Set your last killer to the clown skin for revenge kills
    if (killerid != INVALID_PLAYER_ID)
    {
        new
            last = gLastKiller[playerid];
        if (last != killerid)
        {
            if (last != INVALID_PLAYER_ID)
            {
                SetPlayerSkinForPlayer(last, playerid, GetPlayerSkin(last));
            }
            gLastKiller[playerid] = killerid;
            SetPlayerSkinForPlayer(killerid, playerid, 264);
        }
    }
}
  • ffind

pawn Code:
// Find all the vehicle files in Los Santos
main()
{
    new
        i,
        buf[64];
    i = 0;
    // Find all files matching the given wildcard string
    while (ffind("vehiclelists/ls_*.txt", buf, sizeof (buf), i))
    {
        printf("%d) %s", i - 1, buf);
    }
}
  • dfind

pawn Code:
// List everything in scriptfiles
main()
{
    // Start the search in scriptfiles
    ListDir("", 0);
}

ListDir(dir[], indent)
{
    new
        i,
        buf[128],
        search[128],
        ind[16],
        x = indent;
    // Create a string with the indents in
    ind[x] = '\0';
    while (x)
    {
        ind[--x] = '\t';
    }
    // Generate the search string
    format(search, sizeof (search), "%s/*", dir);
    i = 0;
    // Loop through all matching folders
    while (dfind(search, buf, sizeof (buf), i))
    {
        // Display the current directory
        printf("%s%s", ind, buf);
        // Enumerate child directories
        if (buf[0] != '.')
        {
            // Call this function recursively to check other dirs
            format(buf, sizeof (buf), "%s/%s", dir, buf);
            ListDir(buf, indent + 1);
        }
    }
    // Reset count - VERY important
    i = 0;
    // Loop through all matching files
    while (ffind(search, buf, sizeof (buf), i))
    {
        // List all files
        printf("%s%s", ind, buf);
    }
}
  • AddServerRule

pawn Code:
AddServerRule("YSF", "Present");


  • SetServerRule

pawn Code:
SetServerRule("worldtime", "The morning");

Further examples

More code elsewhere taking advantage of YSF's features:

Sets the world time to an hour/minute combination and uses SetServerRule to update the time viewed in the server browser.

Building
  • Windows

To build a new Windows version open YPI.sln in Visual Studio and "build" project "YSF".
  • Linux

To build a new version in Linux open a terminal on the "YPI" directory and type:

Code:
make YSF
Y_Less is offline   Reply With Quote
Old 02/01/2009, 11:40 PM   #2
d0
Beta Tester
 
d0's Avatar
 
Join Date: Oct 2007
Location: Germany
Posts: 825
Reputation: 122
Default Re: ==> LINUX <== YSF 0.2 released

nice
i love it on linux
__________________
d0 is offline   Reply With Quote
Old 02/01/2009, 11:40 PM   #3
sebihunter
Gangsta
 
Join Date: Nov 2006
Posts: 583
Reputation: 3
Default Re: ==> LINUX <== YSF 0.2 released

finally!
Thanks
sebihunter is offline   Reply With Quote
Old 02/01/2009, 11:42 PM   #4
boylett
Gangsta
 
Join Date: Jul 2006
Posts: 662
Reputation: 0
Default Re: ==> LINUX <== YSF 0.2 released

Linux+YSF = ftw

EDIT: works on CentOS no problems.
boylett is offline   Reply With Quote
Old 02/01/2009, 11:47 PM   #5
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 18,175
Reputation: 2541
Default Re: ==> LINUX <== YSF 0.2 released

I forgot to mention YSI isn't ported yet, a lot of the base is the same but there's more work for the other streamer bits (more information on what's going on there later).
Y_Less is offline   Reply With Quote
Old 02/01/2009, 11:51 PM   #6
Ytong
Big Clucker
 
Join Date: Feb 2007
Posts: 130
Reputation: 0
Default Re: ==> LINUX <== YSF 0.2 released

Omg this is like a SA-MP 0.2.7 server-release
thx very much Y_Less
What's your next project? Making GTA IV playable on single core CPU's ? :>

*Tjong arranges a new power order*
  • <insert Y_Less here>
  • Chuck Norris
  • God

Ytong is offline   Reply With Quote
Old 02/01/2009, 11:56 PM   #7
Kowalski
Big Clucker
 
Join Date: Mar 2007
Posts: 101
Reputation: 1
Default Re: ==> LINUX <== YSF 0.2 released

Yahooooo! This is awesome! Thank you Y_Less!

Ковалски
Kowalski is offline   Reply With Quote
Old 03/01/2009, 12:26 AM   #8
MasterOfQuebec
Big Clucker
 
Join Date: Jan 2007
Posts: 83
Reputation: 0
Default Re: ==> LINUX <== YSF 0.2 released

Thanks you for this plugin.
MasterOfQuebec is offline   Reply With Quote
Old 03/01/2009, 12:37 AM   #9
brains
Little Clucker
 
Join Date: Aug 2006
Posts: 45
Reputation: 0
Default Re: LINUX/CentOS YSF 0.2 released

first off thanks a lot for porting this.

the compiler seems to crash because of these two new natives in the include,
pawn Code:
native SetPlayerSkinForPlayer(skinplayer, forplayer, skin);
native GetPlayerSkinForPlayer(skinplayer, forplayer);
commenting them out solves the problem.
brains is offline   Reply With Quote
Old 03/01/2009, 12:38 AM   #10
boylett
Gangsta
 
Join Date: Jul 2006
Posts: 662
Reputation: 0
Default Re: LINUX/CentOS YSF 0.2 released

Quote:
Originally Posted by brains
first off thanks a lot for porting this.

the compiler seems to crash because of these two new natives in the include,
pawn Code:
native SetPlayerSkinForPlayer(skinplayer, forplayer, skin);
native GetPlayerSkinForPlayer(skinplayer, forplayer);
commenting them out solves the problem.
No reason for these to crash, it works for me so must be something in your mode
boylett is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Restart for Linux Red Hat / CentOS? Javi_Cogollero Server Support 1 31/03/2010 10:54 AM
announce wont work/ or something Linux CentoS 5 XeoN_13 Help Archive 8 07/11/2009 11:54 PM
PAWN 3.2.664 Compiler for Linux (CentOS 5) ev0lution Help Archive 1 20/10/2009 08:57 AM
[HELP] CentOS plugin StrickenKid Plugin Development 1 08/07/2009 03:54 PM
How to Compile a plugin to .so on CentOS 4.7 !? Castle Server Support 3 03/04/2009 11:24 PM


All times are GMT. The time now is 03:16 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.