SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 16/04/2018, 06:46 PM   #1
Lokii
Big Clucker
 
Join Date: Sep 2017
Posts: 69
Reputation: 40
Default SkinEx (CHANGES LIKE IN GTA V)


SkinEx



Info



This will change you'r skin and add smoke effect like in gta v!

Function

Code:
just like a_samp

SetPlayerSkin(playerid, skinid);
Video

Click


Pics







Link

Pastebin

Update v1.1

Code:
Not much changes just reduced amx size
v1 - 6kb
v1.1 - 4kb
Pastebin

Update v1.2 (credits to pottus)

Code:
Made the effects better!
Pastebin




Credits

SA-MP Team - for samp
Lokii - for SkinEx
Incognito - for streamer

Last edited by Lokii; 18/04/2018 at 10:55 AM.
Lokii is offline   Reply With Quote
Old 16/04/2018, 06:50 PM   #2
ProScripter
Little Clucker
 
ProScripter's Avatar
 
Join Date: Apr 2018
Location: India
Posts: 18
Reputation: 0
Default Re: SkinEx (CHANGES LIKE IN GTA V)

1st>>>>
This is easy and simple + good job
ProScripter is offline   Reply With Quote
Old 16/04/2018, 07:03 PM   #3
KaizH
Banned
 
Join Date: Apr 2018
Location: Somewhere in the world.
Posts: 7
Reputation: 0
Default Re: SkinEx (CHANGES LIKE IN GTA V)

I could say it's something simple, but, something is something.
KaizH is offline   Reply With Quote
Old 16/04/2018, 07:44 PM   #4
peiN56
Little Clucker
 
Join Date: Mar 2018
Location: /root/
Posts: 1
Reputation: 0
Default Re: SkinEx (CHANGES LIKE IN GTA V)

Good job, small but interesting
peiN56 is offline   Reply With Quote
Old 17/04/2018, 06:52 AM   #5
PT
Godfather
 
PT's Avatar
 
Join Date: Nov 2012
Location: Portugal
Posts: 7,147
Reputation: 774
Default Re: SkinEx (CHANGES LIKE IN GTA V)

Simple but interesting
__________________
"Quem caiu e se levantou honrado era e honrado ficou..."


http://steamcommunity.com/id/pt_player/
PT is offline   Reply With Quote
Old 17/04/2018, 10:31 AM   #6
Lokii
Big Clucker
 
Join Date: Sep 2017
Posts: 69
Reputation: 40
Default Re: SkinEx (CHANGES LIKE IN GTA V)

Thanks all

EDIT:

Update v1.1

Code:
Not much changes just reduced amx size
v1 - 6kb
v1.1 - 4kb
Pastebin
Lokii is offline   Reply With Quote
Old 17/04/2018, 06:16 PM   #7
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,352
Reputation: 1195
Default Re: SkinEx (CHANGES LIKE IN GTA V)

I like it but don't like it, the sync between the skin change / effects makes it look like shit. The user is aware of the new skin before any effects making the feel anti-climatic. The concept is excellent but the skin change is too fast and needs to be delayed slightly to sync better with the effects. There is also a major issue with object creation/deletion!

Code:
//Made by lokii.
#include <streamer> //credits to incognito.

#define         SKIN_CHANGE_DELAY           600



/*
native SetPlayerSkin(playerid, skinid);
*/

static p_skin_obj[MAX_PLAYERS] = { -1, ... };
static p_skin_obj2[MAX_PLAYERS] = { -1, ... } ;

static DISTimer[MAX_PLAYERS];
static SkinTimer[MAX_PLAYERS];

forward DIS(playerid);
public DIS(playerid)
{
    TogglePlayerControllable(playerid, 1);
    DestroyDynamicObject(p_skin_obj[playerid]);
    return DestroyDynamicObject(p_skin_obj2[playerid]);
}

forward DelaySkinChange(playerid, skinid);
public DelaySkinChange(playerid, skinid)
{
	SetPlayerSkin(playerid, skinid);
	return 1;
}


static ResetSkinChange(playerid)
{
	// This NEEDS to be done like this otherwise you will continually destory objects
	if(p_skin_obj[playerid] > -1)
	{
	    DestroyDynamicObject(p_skin_obj[playerid]);
	    DestroyDynamicObject(p_skin_obj2[playerid]);
	    p_skin_obj[playerid] = -1;
	    p_skin_obj2[playerid] = -1;
	}

	KillTimer(DISTimer[playerid]);
	KillTimer(SkinTimer[playerid]);
}

public OnPlayerDisconnect(playerid, reason)
{
	ResetSkinChange(playerid);
	
    #if defined SE_OnPlayerDisconnect
        SE_OnPlayerDisconnect(playerid, reason);
    #endif
    return 1;
}
#if defined _ALS_OnPlayerDisconnect
    #undef OnPlayerDisconnect
#else
    #define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect SE_OnPlayerDisconnect
#if defined SE_OnPlayerDisconnect
    forward SE_OnPlayerDisconnect(playerid, reason);
#endif

stock SetPlayerSkinEx(playerid, skinid)
{
	// Destory any created objects first
	ResetSkinChange(playerid);
    new Float:e_skin_x, Float:e_skin_y, Float:e_skin_z;
    GetPlayerPos(playerid, e_skin_x, e_skin_y, e_skin_z);
    TogglePlayerControllable(playerid, 0);
    p_skin_obj[playerid] = CreateDynamicObject(18671, e_skin_x, e_skin_y, e_skin_z-2.5, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0, STREAMER_OBJECT_DD, -1, 0);
    p_skin_obj2[playerid] = CreateDynamicObject(18728, e_skin_x, e_skin_y, e_skin_z-1.5, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0, STREAMER_OBJECT_DD, -1, 0);
    DISTimer[playerid] = SetTimerEx("DIS", 1000, false, "i", playerid);
    SkinTimer[playerid] = SetTimetEx("DelaySkinChange", false, "iii", SKIN_CHANGE_DELAY, playerid, skinid);
    Streamer_Update(playerid);
    return 1;
}

#if defined _ALS_SetPlayerSkin
    #undef SetPlayerSkin
#else
    #define _ALS_SetPlayerSkin
#endif
#define SetPlayerSkin SetPlayerSkinEx


//EOF.

Last edited by Pottus; 17/04/2018 at 09:44 PM.
Pottus is offline   Reply With Quote
Old 18/04/2018, 10:55 AM   #8
Lokii
Big Clucker
 
Join Date: Sep 2017
Posts: 69
Reputation: 40
Default Re: SkinEx (CHANGES LIKE IN GTA V)

Quote:
Originally Posted by Pottus View Post
I like it but don't like it, the sync between the skin change / effects makes it look like shit. The user is aware of the new skin before any effects making the feel anti-climatic. The concept is excellent but the skin change is too fast and needs to be delayed slightly to sync better with the effects. There is also a major issue with object creation/deletion!

Code:
//Made by lokii.
#include <streamer> //credits to incognito.

#define         SKIN_CHANGE_DELAY           600



/*
native SetPlayerSkin(playerid, skinid);
*/

static p_skin_obj[MAX_PLAYERS] = { -1, ... };
static p_skin_obj2[MAX_PLAYERS] = { -1, ... } ;

static DISTimer[MAX_PLAYERS];
static SkinTimer[MAX_PLAYERS];

forward DIS(playerid);
public DIS(playerid)
{
    TogglePlayerControllable(playerid, 1);
    DestroyDynamicObject(p_skin_obj[playerid]);
    return DestroyDynamicObject(p_skin_obj2[playerid]);
}

forward DelaySkinChange(playerid, skinid);
public DelaySkinChange(playerid, skinid)
{
	SetPlayerSkin(playerid, skinid);
	return 1;
}


static ResetSkinChange(playerid)
{
	// This NEEDS to be done like this otherwise you will continually destory objects
	if(p_skin_obj[playerid] > -1)
	{
	    DestroyDynamicObject(p_skin_obj[playerid]);
	    DestroyDynamicObject(p_skin_obj2[playerid]);
	    p_skin_obj[playerid] = -1;
	    p_skin_obj2[playerid] = -1;
	}

	KillTimer(DISTimer[playerid]);
	KillTimer(SkinTimer[playerid]);
}

public OnPlayerDisconnect(playerid, reason)
{
	ResetSkinChange(playerid);
	
    #if defined SE_OnPlayerDisconnect
        SE_OnPlayerDisconnect(playerid, reason);
    #endif
    return 1;
}
#if defined _ALS_OnPlayerDisconnect
    #undef OnPlayerDisconnect
#else
    #define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect SE_OnPlayerDisconnect
#if defined SE_OnPlayerDisconnect
    forward SE_OnPlayerDisconnect(playerid, reason);
#endif

stock SetPlayerSkinEx(playerid, skinid)
{
	// Destory any created objects first
	ResetSkinChange(playerid);
    new Float:e_skin_x, Float:e_skin_y, Float:e_skin_z;
    GetPlayerPos(playerid, e_skin_x, e_skin_y, e_skin_z);
    TogglePlayerControllable(playerid, 0);
    p_skin_obj[playerid] = CreateDynamicObject(18671, e_skin_x, e_skin_y, e_skin_z-2.5, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0, STREAMER_OBJECT_DD, -1, 0);
    p_skin_obj2[playerid] = CreateDynamicObject(18728, e_skin_x, e_skin_y, e_skin_z-1.5, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 100.0, STREAMER_OBJECT_DD, -1, 0);
    DISTimer[playerid] = SetTimerEx("DIS", 1000, false, "i", playerid);
    SkinTimer[playerid] = SetTimetEx("DelaySkinChange", false, "iii", SKIN_CHANGE_DELAY, playerid, skinid);
    Streamer_Update(playerid);
    return 1;
}

#if defined _ALS_SetPlayerSkin
    #undef SetPlayerSkin
#else
    #define _ALS_SetPlayerSkin
#endif
#define SetPlayerSkin SetPlayerSkinEx


//EOF.

yea thanks for that i changed the delay to 1000 tho you could still see the skin changing at 600


Update v1.2 (credits to pottus)

Code:
Made the effects better!
Pastebin
Lokii 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



All times are GMT. The time now is 01:02 PM.


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