01.09.2015, 20:07
i release this script to change skin via TextDraw's its simple but useful for DM / FreeRoam ... type: /skin

if u liked! +re[

pawn Код:
/*
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
= Versiуn: nSkin v0.1 by NullBot =
= Creado: 09/01/2015 =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
#include <a_samp>
new Text:Textdraw0[MAX_PLAYERS];
new Text:Textdraw1[MAX_PLAYERS];
new Text:Textdraw2[MAX_PLAYERS];
new Text:Textdraw3[MAX_PLAYERS];
new Text:Textdraw4[MAX_PLAYERS];
#define MAX_SKINS 311
public OnFilterScriptInit()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++ )
{
Textdraw0[playerid] = TextDrawCreate(258.000000, 183.000000, "SkinID");
TextDrawBackgroundColor(Textdraw0[playerid], 255);
TextDrawFont(Textdraw0[playerid], 5);
TextDrawLetterSize(Textdraw0[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw0[playerid], -1);
TextDrawSetOutline(Textdraw0[playerid], 0);
TextDrawSetProportional(Textdraw0[playerid], 1);
TextDrawSetShadow(Textdraw0[playerid], 1);
TextDrawUseBox(Textdraw0[playerid], 0);
TextDrawBoxColor(Textdraw0[playerid], 255);
TextDrawTextSize(Textdraw0[playerid], 128.000000, 211.000000);
TextDrawSetPreviewModel(Textdraw0[playerid], 167);
TextDrawSetPreviewRot(Textdraw0[playerid], -16.000000, 0.000000, 5.000000, 1.000000);
TextDrawSetSelectable(Textdraw0[playerid], 0);
Textdraw1[playerid] = TextDrawCreate(346.000000, 183.000000, "Next");
TextDrawBackgroundColor(Textdraw1[playerid], 255);
TextDrawFont(Textdraw1[playerid], 5);
TextDrawLetterSize(Textdraw1[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw1[playerid], -1);
TextDrawSetOutline(Textdraw1[playerid], 0);
TextDrawSetProportional(Textdraw1[playerid], 0);
TextDrawSetShadow(Textdraw1[playerid], 1);
TextDrawUseBox(Textdraw1[playerid], 1);
TextDrawBoxColor(Textdraw1[playerid], 255);
TextDrawTextSize(Textdraw1[playerid], 128.000000, 211.000000);
TextDrawSetPreviewModel(Textdraw1[playerid], 1318);
TextDrawSetPreviewRot(Textdraw1[playerid], -16.000000, 90.000000, -85.000000, 2.000000);
TextDrawSetSelectable(Textdraw1[playerid], 1);
Textdraw2[playerid] = TextDrawCreate(171.000000, 183.000000, "Previous");
TextDrawBackgroundColor(Textdraw2[playerid], 255);
TextDrawFont(Textdraw2[playerid], 5);
TextDrawLetterSize(Textdraw2[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw2[playerid], -1);
TextDrawSetOutline(Textdraw2[playerid], 0);
TextDrawSetProportional(Textdraw2[playerid], 0);
TextDrawSetShadow(Textdraw2[playerid], 1);
TextDrawUseBox(Textdraw2[playerid], 1);
TextDrawBoxColor(Textdraw2[playerid], 255);
TextDrawTextSize(Textdraw2[playerid], 128.000000, 211.000000);
TextDrawSetPreviewModel(Textdraw2[playerid], 1318);
TextDrawSetPreviewRot(Textdraw2[playerid], -16.000000, 270.000000, -85.000000, 2.000000);
TextDrawSetSelectable(Textdraw2[playerid], 1);
Textdraw3[playerid] = TextDrawCreate(290.000000, 390.000000, "Save");
TextDrawBackgroundColor(Textdraw3[playerid], 255);
TextDrawFont(Textdraw3[playerid], 3);
TextDrawLetterSize(Textdraw3[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw3[playerid], -65281);
TextDrawSetOutline(Textdraw3[playerid], 0);
TextDrawSetProportional(Textdraw3[playerid], 1);
TextDrawSetShadow(Textdraw3[playerid], 1);
TextDrawSetSelectable(Textdraw3[playerid], 1);
Textdraw4[playerid] = TextDrawCreate(417.000000, 178.000000, "Close");
TextDrawBackgroundColor(Textdraw4[playerid], 255);
TextDrawFont(Textdraw4[playerid], 3);
TextDrawLetterSize(Textdraw4[playerid], 0.500000, 1.000000);
TextDrawColor(Textdraw4[playerid], -16776961);
TextDrawSetOutline(Textdraw4[playerid], 0);
TextDrawSetProportional(Textdraw4[playerid], 1);
TextDrawSetShadow(Textdraw4[playerid], 1);
TextDrawSetSelectable(Textdraw4[playerid], 1);
}
print("\n--------------------------------------");
print(" [FS]nSkin loaded !");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" [FS]nSkin unloaded !");
print("--------------------------------------\n");
return 1;
}
public OnPlayerConnect(playerid)
{
SetPVarInt(playerid,"Current_skin",0);
SetPVarInt(playerid,"Active",-1);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/skin", cmdtext, true))
{
SetPVarInt(playerid,"Activo",GetPVarInt(playerid,"Active")-1);
CloseSkinTD(playerid);
SetPVarInt(playerid,"Current_skin",GetPlayerSkin(playerid));
TextDrawSetPreviewModel(Textdraw0[playerid], GetPlayerSkin(playerid));
SelectTextDraw(playerid, 0xFF00FFFF);
OpenSkinTD(playerid);
return 1;
}
return 0;
}
stock OpenSkinTD(playerid)
{
TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
TextDrawSetSelectable(Textdraw1[playerid], 1);
TextDrawShowForPlayer(playerid, Textdraw2[playerid]);
TextDrawSetSelectable(Textdraw2[playerid], 1);
TextDrawShowForPlayer(playerid, Textdraw3[playerid]);
TextDrawSetSelectable(Textdraw1[playerid], 1);
TextDrawShowForPlayer(playerid, Textdraw4[playerid]);
TextDrawSetSelectable(Textdraw1[playerid], 1);
return 1;
}
stock CloseSkinTD(playerid)
{
TextDrawHideForPlayer(playerid, Textdraw0[playerid]);
TextDrawHideForPlayer(playerid, Textdraw1[playerid]);
TextDrawHideForPlayer(playerid, Textdraw2[playerid]);
TextDrawHideForPlayer(playerid, Textdraw3[playerid]);
TextDrawHideForPlayer(playerid, Textdraw4[playerid]);
return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == Textdraw1[playerid])
{
new Skin_ID = GetPVarInt(playerid,"Current_skin");
Skin_ID++;
if(Skin_ID > MAX_SKINS) Skin_ID = 0;
SetPVarInt(playerid,"Current_skin",Skin_ID);
TextDrawSetPreviewModel(Textdraw0[playerid], Skin_ID);
SelectTextDraw(playerid, 0x00FF00FF);
CloseSkinTD(playerid);
OpenSkinTD(playerid);
PlayerPlaySound(playerid,4203,0,0,0);
SetPVarInt(playerid,"Active",GetPVarInt(playerid,"Active")-1);
return 1;
}
if(clickedid == Textdraw2[playerid])
{
new Skin_ID = GetPVarInt(playerid,"Current_skin");
Skin_ID--;
if(Skin_ID < 0) Skin_ID = MAX_SKINS;
SetPVarInt(playerid,"Current_skin",Skin_ID);
TextDrawSetPreviewModel(Textdraw0[playerid], Skin_ID);
SelectTextDraw(playerid, 0x00FF00FF);
CloseSkinTD(playerid);
OpenSkinTD(playerid);
PlayerPlaySound(playerid,4202,0,0,0);
SetPVarInt(playerid,"Active",GetPVarInt(playerid,"Active")-1);
return 1;
}
if(clickedid == Textdraw3[playerid])
{
new Skin_ID = GetPVarInt(playerid,"Current_skin");
SetPlayerSkin(playerid,Skin_ID);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,true);
CancelSelectTextDraw(playerid);
CloseSkinTD(playerid);
PlayerPlaySound(playerid,1058,0,0,0);
SetPVarInt(playerid,"Active",-1);
return 1;
}
if(clickedid == Textdraw4[playerid])//cerrar
{
CloseSkinTD(playerid);
PlayerPlaySound(playerid,1058,0,0,0);
CancelSelectTextDraw(playerid);
SetPVarInt(playerid,"Active",-1);
return 1;
}
if(GetPVarInt(playerid,"Activo") <= -2)
{
SetPVarInt(playerid,"Active",-1);
PlayerPlaySound(playerid,1058,0,0,0);
CancelSelectTextDraw(playerid);
CloseSkinTD(playerid);
}
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
