[Include] CreateWater.inc | Create Custom Waters and Swim in them!!
#1

CreateWater.inc | v2.0
NEW UPDATE

Fully controllable custom oxygen bar has been added.
Added new functions.
Fixed under water swim move.
Optimized swim/move styles.
Changed function IsPlayerInWaterEx to IsPlayerInCustomWater.
Added a simple example script in github.
----------------------------------------------------------------------------

Start and Informations
So Hi ! , maybe you know I posted it on Screenshot and Videos section and as I said , I'm releasing it now.
About 4years ago that I started scripting in SAMP , I wanted to make pool but I couldn't make it anywhere I wanted
I had to make it on water and make objects to make it like a pool.

I searched a lot to see if anyone made this possible before or not , the only results was MultiTheftAuto's function :
Код:
createWater(blah blah blah)
So a week ago that I was working on my project , water waves annoyed me so much , I thought why not making it server sided!?

And I started making zones with NO COLL objects and set their material as water texture.
then scripted a server sided swiming (and big thanks to SAMP Devs , vectors update (camera rate) updates slowly like +500ms , but it works , no other way (as I know) , and also you can keep holding KEY_AIM , so it sends on foot package faster ) .

NVM , let's go xD

Changelog:
Код:
v2.0 :
Fully controllable custom oxygen bar has been added.
Added new functions.
Fixed under water swim move.
Optimized swim/move styles.
Changed function IsPlayerInWaterEx to IsPlayerInCustomWater.
Added a simple example script in github.

v1.1 :
Added 4 types of water you can create with CreateWater

v1.0 (can be used without any bugs , fixed jumping issue)
Fixed jumping issue with addin invisible object.
Added 2 new parameter to CreateWater as world and interior.

v0.2 :
Added new function , DestroyWater(waterid);
Removed YSI(y_hook)
New optimizations (removing some loops and using extraid)
Unlimited water objects ! (create big waters as much as you want !)

v0.1 :
Released.
Video:

New version video including oxygen bar feature:
******* Video


Old Versions :
Click
Click On Meh -_-

PS : the music is lit I already know . LOL xD

Functions:

PHP код:

CreateWater
(minx miny maxx maxy depth world=-interior=-type=WATER_TYPE_NORMAL);
// Creates Water
// parameters : minx/y and maxx/y just works like making zones , z for water Z cord. and depth for its depth/height , world and interior for Virtual world and interiors , type for 4 water types
DestroyWater(waterid);
// returns 0 if ID is not available , returns 1 if it can destory water
IsPlayerInCustomWater(playerid);
// return 1 if player is in water and return 0 if not
IsPlayerUnderCustomWater(playerid);
// return 1 if player is under water and return 0 if not
GetPlayerWaterID(playerid);
// returns player's water ID which is swiming in it
GetWaterDepth(waterid);
// returns water's depth
GetPlayerSwimStyle(playerid);
// returns player's swiming style (only works with custom waters)
GetPlayerCustomOxygen(playerid);
// returns current oxygen value of player as a float variable
SetPlayerCustomOxygen(playeridFloat:ox_value);
// sets player's oxygen value
ShowCustomOxygenBarForPlayer(playerid);
// shows player's custom oxygen bar
HideCustomOxygenBarForPlayer(playerid);
// hides player's custom oxygen bar 
Callbacks:

PHP код:
public OnPlayerEnterWater(playerid waterid)
public 
OnPlayerLeaveWater(playerid waterid)
// they'll be called when player enters/leaves water 
Water Types:
PHP код:
enum
{
    
WATER_TYPE_LIGHT,
    
WATER_TYPE_NORMAL,
    
WATER_TYPE_DARK,
    
WATER_TYPE_CLOUDY

Swim Styles:
PHP код:
enum
{
    
SWIM_STYLE_IDLE_ON_WATER,
    
SWIM_STYLE_MOVE_ON_WATER,
    
SWIM_STYLE_DIVE_UNDER_WATER,
    
SWIM_STYLE_MOVE_UNDER_WATER,
    
SWIM_STYLE_COMING_UP,
    
SWIM_STYLE_MOVE_FAST_ON_WATER,
    
SWIM_STYLE_INVALID

Things you need:

Streamer - Plugin Thread > https://sampforum.blast.hk/showthread.php?tid=102865

Download:

Github link


Credits:

Incognito - for Streamer Plugin

Bugs and Ideas:
feel free to share you ideas and report bugs here !
Reply


Messages In This Thread
CreateWater.inc | Create Custom Waters and Swim in them! - by iAmir - 20.12.2017, 08:53
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by Gforcez - 20.12.2017, 09:25
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by biker122 - 20.12.2017, 09:39
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by Kaperstone - 20.12.2017, 09:47
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by iAmir - 20.12.2017, 09:58
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by pyrodojo25 - 20.12.2017, 10:01
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by Crayder - 20.12.2017, 10:47
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by DRIFT_HUNTER - 20.12.2017, 15:04
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by iAmir - 20.12.2017, 15:27
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by RogueDrifter - 20.12.2017, 23:33
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by iAmir - 21.12.2017, 04:59
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by PeanutButter - 21.12.2017, 13:40
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by iAmir - 21.12.2017, 16:25
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by amirab - 22.12.2017, 21:49
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by Kwarde - 23.12.2017, 00:14
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by iAmir - 23.12.2017, 11:35
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by Ramin - 23.12.2017, 12:30
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by SyS - 23.12.2017, 12:32
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by Matz - 23.12.2017, 13:00
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by Arithmetic - 23.12.2017, 13:09
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by iAmir - 23.12.2017, 17:01
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by IlanZ - 23.12.2017, 17:16
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by iAmir - 23.12.2017, 20:42
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by Daniielk - 24.12.2017, 02:45
Re: CreateWater.inc | Create Custom Waters and Swim in them!! - by iAmir - 25.12.2017, 01:24

Forum Jump:


Users browsing this thread: 2 Guest(s)