[FilterScript] nSkin v2.0 w/ Blocked Skin (BUG ESC FIXED)
#1

Bug Fixed! when player press ESC !

type: /skin


you can block skins, change the Skin id below
BlockedSkins[] = {167,299,303};

sorry for ma bad english!


if the skin not blocked , so you can save


pawn Код:
/*
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    =                Versiуn: nSkin v0.2  by NullBot                       =   
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
   
    Enjoy! :)
*/


#include <a_samp>
#define MAX_SKINES 311 // max of skin
new BlockedSkins[] = {167,299,303}; // change the skin to block
//  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//         PlayerText Variables
new PlayerText:TextdrawSkin[MAX_PLAYERS]; //var of Sksin Model
new PlayerText:TextdrawNext[MAX_PLAYERS];// var Model Next
new PlayerText:TextdrawPrevious[MAX_PLAYERS]; // var model previous
new PlayerText:TextdrawSave[MAX_PLAYERS];// var text save
new PlayerText:TextdrawClose[MAX_PLAYERS];// var text close
//  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

public OnFilterScriptInit()
{    
    print("\n--------------------------------------");
    print(" [FS]nSkin v0.2 Loaded!");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    print("\n--------------------------------------");
    print(" [FS]nSkin v0.2 Unloaded!");
    print("--------------------------------------\n");
    return 1;
}



public OnPlayerConnect(playerid)
{
        SetPVarInt(playerid,"Current_skin",0);// set skin 0 default
    SetPVarInt(playerid,"Active",-1); // var to determinate when player press ESC
    TextdrawSkin[playerid] = CreatePlayerTextDraw(playerid,258.000000, 183.000000, "SkinModel");
    PlayerTextDrawBackgroundColor(playerid,TextdrawSkin[playerid], 255);
    PlayerTextDrawFont(playerid,TextdrawSkin[playerid], 5);
    PlayerTextDrawLetterSize(playerid,TextdrawSkin[playerid], 0.500000, 1.000000);
    PlayerTextDrawColor(playerid,TextdrawSkin[playerid], -1);
    PlayerTextDrawSetOutline(playerid,TextdrawSkin[playerid], 0);
    PlayerTextDrawSetProportional(playerid,TextdrawSkin[playerid], 1);
    PlayerTextDrawSetShadow(playerid,TextdrawSkin[playerid], 1);
    PlayerTextDrawUseBox(playerid,TextdrawSkin[playerid], 0);
    PlayerTextDrawBoxColor(playerid,TextdrawSkin[playerid], 255);
    PlayerTextDrawTextSize(playerid,TextdrawSkin[playerid], 128.000000, 211.000000);
    PlayerTextDrawSetPreviewModel(playerid,TextdrawSkin[playerid], 167);
    PlayerTextDrawSetPreviewRot(playerid,TextdrawSkin[playerid], -16.000000, 0.000000, 5.000000, 1.000000);
    PlayerTextDrawSetSelectable(playerid,TextdrawSkin[playerid], 0);
   
   
    TextdrawNext[playerid] = CreatePlayerTextDraw(playerid,346.000000, 183.000000, "Next");
    PlayerTextDrawBackgroundColor(playerid,TextdrawNext[playerid], 255);
    PlayerTextDrawFont(playerid,TextdrawNext[playerid], 5);
    PlayerTextDrawLetterSize(playerid,TextdrawNext[playerid], 0.500000, 1.000000);
    PlayerTextDrawColor(playerid,TextdrawNext[playerid], -1);
    PlayerTextDrawSetOutline(playerid,TextdrawNext[playerid], 0);
        PlayerTextDrawSetProportional(playerid,TextdrawNext[playerid], 0);
        PlayerTextDrawSetShadow(playerid,TextdrawNext[playerid], 1);
    PlayerTextDrawUseBox(playerid,TextdrawNext[playerid], 1);
    PlayerTextDrawBoxColor(playerid,TextdrawNext[playerid], 255);
        PlayerTextDrawTextSize(playerid,TextdrawNext[playerid], 128.000000, 211.000000);
        PlayerTextDrawSetPreviewModel(playerid,TextdrawNext[playerid], 1318);
        PlayerTextDrawSetPreviewRot(playerid,TextdrawNext[playerid], -16.000000, 90.000000, -85.000000, 2.000000);
    PlayerTextDrawSetSelectable(playerid,TextdrawNext[playerid], 1);
       
       
    TextdrawPrevious[playerid] = CreatePlayerTextDraw(playerid,171.000000, 183.000000, "Previous");
    PlayerTextDrawBackgroundColor(playerid,TextdrawPrevious[playerid], 255);
    PlayerTextDrawFont(playerid,TextdrawPrevious[playerid], 5);
    PlayerTextDrawLetterSize(playerid,TextdrawPrevious[playerid], 0.500000, 1.000000);
    PlayerTextDrawColor(playerid,TextdrawPrevious[playerid], -1);
    PlayerTextDrawSetOutline(playerid,TextdrawPrevious[playerid], 0);
    PlayerTextDrawSetProportional(playerid,TextdrawPrevious[playerid], 0);
    PlayerTextDrawSetShadow(playerid,TextdrawPrevious[playerid], 1);
    PlayerTextDrawUseBox(playerid,TextdrawPrevious[playerid], 1);
    PlayerTextDrawBoxColor(playerid,TextdrawPrevious[playerid], 255);
    PlayerTextDrawTextSize(playerid,TextdrawPrevious[playerid], 128.000000, 211.000000);
    PlayerTextDrawSetPreviewModel(playerid,TextdrawPrevious[playerid], 1318);
    PlayerTextDrawSetPreviewRot(playerid,TextdrawPrevious[playerid], -16.000000, 270.000000, -85.000000, 2.000000);
    PlayerTextDrawSetSelectable(playerid,TextdrawPrevious[playerid], 1);
   
   
   
    TextdrawSave[playerid] = CreatePlayerTextDraw(playerid,290.000000, 390.000000, "Save");
    PlayerTextDrawBackgroundColor(playerid,TextdrawSave[playerid], 255);
        PlayerTextDrawFont(playerid,TextdrawSave[playerid], 3);
    PlayerTextDrawLetterSize(playerid,TextdrawSave[playerid], 0.500000, 1.000000);
    PlayerTextDrawColor(playerid,TextdrawSave[playerid], -65281);
    PlayerTextDrawSetOutline(playerid,TextdrawSave[playerid], 0);
    PlayerTextDrawSetProportional(playerid,TextdrawSave[playerid], 1);
    PlayerTextDrawSetShadow(playerid,TextdrawSave[playerid], 1);
    PlayerTextDrawSetSelectable(playerid,TextdrawSave[playerid], 1);
   
   
    TextdrawClose[playerid] = CreatePlayerTextDraw(playerid,417.000000, 178.000000, "Close");
    PlayerTextDrawBackgroundColor(playerid,TextdrawClose[playerid], 255);
    PlayerTextDrawFont(playerid,TextdrawClose[playerid], 3);
    PlayerTextDrawLetterSize(playerid,TextdrawClose[playerid], 0.500000, 1.000000);
    PlayerTextDrawColor(playerid,TextdrawClose[playerid], -16776961);
        PlayerTextDrawSetOutline(playerid,TextdrawClose[playerid], 0);
    PlayerTextDrawSetProportional(playerid,TextdrawClose[playerid], 1);
    PlayerTextDrawSetShadow(playerid,TextdrawClose[playerid], 1);
    PlayerTextDrawSetSelectable(playerid,TextdrawClose[playerid], 1);  
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/skin", cmdtext, true))//command /skin to change the skin via text draw
    {  
                CloseSkinTD(playerid);         
        SetPVarInt(playerid,"Active",1);           
            SetPVarInt(playerid,"Current_skin",GetPlayerSkin(playerid));
        PlayerTextDrawSetPreviewModel(playerid,TextdrawSkin[playerid],GetPVarInt(playerid,"Current_skin"));            
                OpenSkinTD(playerid);      
        return 1;
    }
    return 0;
}

stock OpenSkinTD(playerid)// show the texts draw
{
   
    SelectTextDraw(playerid, 0x00FF00FF);  
        PlayerTextDrawShow(playerid, TextdrawSkin[playerid]);
   
    PlayerTextDrawShow(playerid, TextdrawNext[playerid]);
    PlayerTextDrawSetSelectable(playerid,TextdrawNext[playerid], 1);
   
    PlayerTextDrawShow(playerid, TextdrawPrevious[playerid]);
    PlayerTextDrawSetSelectable(playerid,TextdrawPrevious[playerid], 1);
   
    PlayerTextDrawShow(playerid, TextdrawSave[playerid]);
    PlayerTextDrawSetSelectable(playerid,TextdrawNext[playerid], 1);
   
    PlayerTextDrawShow(playerid, TextdrawClose[playerid]);
    PlayerTextDrawSetSelectable(playerid,TextdrawNext[playerid], 1);       
   
   
   
   
}

stock CloseSkinTD(playerid)//close all texts draw
{
   
    PlayerTextDrawHide(playerid, TextdrawSkin[playerid]);
    PlayerTextDrawHide(playerid, TextdrawNext[playerid]);
    PlayerTextDrawHide(playerid, TextdrawPrevious[playerid]);
    PlayerTextDrawHide(playerid, TextdrawSave[playerid]);
    PlayerTextDrawHide(playerid, TextdrawClose[playerid])
   
}

public OnPlayerClickTextDraw(playerid, Text:clickedid)
{

    if(_:clickedid == INVALID_TEXT_DRAW && GetPVarInt(playerid,"Active"))
    {
        CloseSkinTD(playerid);
        PlayerPlaySound(playerid,1058,0,0,0);
                CancelSelectTextDraw(playerid);
        SetPVarInt(playerid,"Active",0);
    }
    return 1;
}


public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{  
           
    if(playertextid == TextdrawNext[playerid] )
    {
            new Skin_ID = GetPVarInt(playerid,"Current_skin");
        Skin_ID++;
        if(Skin_ID > MAX_SKINES) Skin_ID = 0;  
                SetPVarInt(playerid,"Current_skin",Skin_ID);       
        PlayerTextDrawSetPreviewModel(playerid,TextdrawSkin[playerid],Skin_ID);    
        CloseSkinTD(playerid);
        OpenSkinTD(playerid);        
        PlayerPlaySound(playerid,4203,0,0,0);      
        return 1;
    }
    if(playertextid == TextdrawPrevious[playerid])
    {
       
            new Skin_ID = GetPVarInt(playerid,"Current_skin");
        Skin_ID--;
        if(Skin_ID < 0) Skin_ID = MAX_SKINES;  
                SetPVarInt(playerid,"Current_skin",Skin_ID);       
        PlayerTextDrawSetPreviewModel(playerid,TextdrawSkin[playerid], Skin_ID);        
        CloseSkinTD(playerid);
        OpenSkinTD(playerid);          
        PlayerPlaySound(playerid,4202,0,0,0);      
        return 1;  
               
       
    }    
    if(playertextid == TextdrawSave[playerid])
    {
        new Skin_ID = GetPVarInt(playerid,"Current_skin");     
       
       
        for(new w = 0, m = sizeof BlockedSkins; w < m; w++)
        {
            if(Skin_ID == BlockedSkins[w])
             {
                SendClientMessage(playerid, 0xDD0000FF, "* Bloqued Skin *");
                CloseSkinTD(playerid);
                OpenSkinTD(playerid);        
                PlayerPlaySound(playerid,4203,0,0,0);
                return 1;
             }
        }
           
                SetPlayerSkin(playerid,Skin_ID);
        SetCameraBehindPlayer(playerid);
        TogglePlayerControllable(playerid,true);
                CancelSelectTextDraw(playerid);    
        CloseSkinTD(playerid);     
        PlayerPlaySound(playerid,1058,0,0,0);      
                return 1;      
       
       
    }
    if(playertextid == TextdrawClose[playerid])//Close
    {
        CloseSkinTD(playerid);
        PlayerPlaySound(playerid,1058,0,0,0);
                CancelSelectTextDraw(playerid);            
        return 1;
       
    }
   
    CallLocalFunction("OnPlayerClickTextDraw", "ii", playerid,INVALID_TEXT_DRAW);
    return 1;
}



public OnPlayerUpdate(playerid)
{  
    return 1;
}
Reply
#2

You don't need player textdraws for any static textdraws just use one regular textdraw for next/prev/save/close
Reply
#3

That background textdraw color is ugly, make it trasparent.

Код:
0xFFFFFF50
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)