Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
// // Admin player skin changer using previews. For SA-MP 0.3x and above. // - Kye 2012 // #include <a_samp> #include "../include/gl_common.inc" #define TOTAL_ITEMS 300 #define SELECTION_ITEMS 21 #define ITEMS_PER_LINE 7 #define HEADER_TEXT "Skins" #define NEXT_TEXT "Next" #define PREV_TEXT "Prev" #define DIALOG_BASE_X 75.0 #define DIALOG_BASE_Y 130.0 #define DIALOG_WIDTH 550.0 #define DIALOG_HEIGHT 180.0 #define SPRITE_DIM_X 60.0 #define SPRITE_DIM_Y 70.0 new gTotalItems = TOTAL_ITEMS; new PlayerText:gCurrentPageTextDrawId[MAX_PLAYERS]; new PlayerText:gHeaderTextDrawId[MAX_PLAYERS]; new PlayerText:gBackgroundTextDrawId[MAX_PLAYERS]; new PlayerText:gNextButtonTextDrawId[MAX_PLAYERS]; new PlayerText:gPrevButtonTextDrawId[MAX_PLAYERS]; new PlayerText:gSelectionItems[MAX_PLAYERS][SELECTION_ITEMS]; new gSelectionItemsTag[MAX_PLAYERS][SELECTION_ITEMS]; new gItemAt[MAX_PLAYERS]; new gItemList[TOTAL_ITEMS] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49, 50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96, 97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131, 132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166, 167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201, 202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236, 237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271, 272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299 }; //------------------------------------------------ public OnFilterScriptInit() { print("\n--Admin Player Skin Changer Loaded\n"); return 1; } //------------------------------------------------ GetNumberOfPages() { if((gTotalItems >= SELECTION_ITEMS) && (gTotalItems % SELECTION_ITEMS) == 0) { return (gTotalItems / SELECTION_ITEMS); } else return (gTotalItems / SELECTION_ITEMS) + 1; } //------------------------------------------------ PlayerText:CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos) { new PlayerText:txtInit; txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0"); PlayerTextDrawUseBox(playerid, txtInit, 0); PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1); PlayerTextDrawFont(playerid, txtInit, 1); PlayerTextDrawSetShadow(playerid, txtInit, 0); PlayerTextDrawSetOutline(playerid, txtInit, 1); PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF); PlayerTextDrawShow(playerid, txtInit); return txtInit; } //------------------------------------------------ // Creates a button textdraw and returns the textdraw ID. PlayerText:CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[]) { new PlayerText:txtInit; txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text); PlayerTextDrawUseBox(playerid, txtInit, 1); PlayerTextDrawBoxColor(playerid, txtInit, 0x000000FF); PlayerTextDrawBackgroundColor(playerid, txtInit, 0x000000FF); PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1); PlayerTextDrawFont(playerid, txtInit, 1); PlayerTextDrawSetShadow(playerid, txtInit, 0); // no shadow PlayerTextDrawSetOutline(playerid, txtInit, 0); PlayerTextDrawColor(playerid, txtInit, 0x4A5A6BFF); PlayerTextDrawSetSelectable(playerid, txtInit, 1); PlayerTextDrawAlignment(playerid, txtInit, 2); PlayerTextDrawTextSize(playerid, txtInit, Height, Width); // The width and height are reversed for centering.. something the game does <g> PlayerTextDrawShow(playerid, txtInit); return txtInit; } //------------------------------------------------ PlayerText:CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[]) { new PlayerText:txtInit; txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text); PlayerTextDrawUseBox(playerid, txtInit, 0); PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0); PlayerTextDrawFont(playerid, txtInit, 0); PlayerTextDrawSetShadow(playerid, txtInit, 0); PlayerTextDrawSetOutline(playerid, txtInit, 1); PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF); PlayerTextDrawShow(playerid, txtInit); return txtInit; } //------------------------------------------------ PlayerText:CreatePlayerBackgroundTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height) { new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos, "_"); // ReEdited by AirKite (for universal localization) PlayerTextDrawUseBox(playerid, txtBackground, 1); PlayerTextDrawBoxColor(playerid, txtBackground, 0x4A5A6BBB); PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 30.0); // ReEdited by AirKite (for universal localization) PlayerTextDrawFont(playerid, txtBackground, 0); PlayerTextDrawSetShadow(playerid, txtBackground, 0); PlayerTextDrawSetOutline(playerid, txtBackground, 0); PlayerTextDrawColor(playerid, txtBackground,0x000000FF); PlayerTextDrawTextSize(playerid, txtBackground, Width, Height); PlayerTextDrawBackgroundColor(playerid, txtBackground, 0x4A5A6BBB); PlayerTextDrawShow(playerid, txtBackground); return txtBackground; } //------------------------------------------------ // Creates a model preview sprite PlayerText:CreateModelPreviewTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:width, Float:height) { new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, ""); // it has to be set with SetText later PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW); PlayerTextDrawColor(playerid, txtPlayerSprite, 0xFFFFFFFF); PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, 0x88888899); PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height); // Text size is the Width:Height PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex); PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1); PlayerTextDrawShow(playerid,txtPlayerSprite); return txtPlayerSprite; } //------------------------------------------------ DestroyPlayerModelPreviews(playerid) { new x=0; while(x != SELECTION_ITEMS) { if(gSelectionItems[playerid][x] != PlayerText:INVALID_TEXT_DRAW) { PlayerTextDrawDestroy(playerid, gSelectionItems[playerid][x]); gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW; } x++; } } //------------------------------------------------ ShowPlayerModelPreviews(playerid) { new x=0; new Float:BaseX = DIALOG_BASE_X; new Float:BaseY = DIALOG_BASE_Y - (SPRITE_DIM_Y * 0.33); // down a bit new linetracker = 0; new itemat = GetPVarInt(playerid, "skinc_page") * SELECTION_ITEMS; // Destroy any previous ones created DestroyPlayerModelPreviews(playerid); while(x != SELECTION_ITEMS && itemat < gTotalItems) { if(linetracker == 0) { BaseX = DIALOG_BASE_X + 25.0; // in a bit from the box BaseY += SPRITE_DIM_Y + 1.0; // move on the Y for the next line } gSelectionItems[playerid][x] = CreateModelPreviewTextDraw(playerid, gItemList[itemat], BaseX, BaseY, SPRITE_DIM_X, SPRITE_DIM_Y); gSelectionItemsTag[playerid][x] = gItemList[itemat]; BaseX += SPRITE_DIM_X + 1.0; // move on the X for the next sprite linetracker++; if(linetracker == ITEMS_PER_LINE) linetracker = 0; itemat++; x++; } } //------------------------------------------------ UpdatePageTextDraw(playerid) { new PageText[64+1]; format(PageText, 64, "%d/%d", GetPVarInt(playerid,"skinc_page") + 1, GetNumberOfPages()); PlayerTextDrawSetString(playerid, gCurrentPageTextDrawId[playerid], PageText); } //------------------------------------------------ CreateSelectionMenu(playerid) { gBackgroundTextDrawId[playerid] = CreatePlayerBackgroundTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y + 20.0, DIALOG_WIDTH, DIALOG_HEIGHT); gHeaderTextDrawId[playerid] = CreatePlayerHeaderTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y, HEADER_TEXT); gCurrentPageTextDrawId[playerid] = CreateCurrentPageTextDraw(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y + 15.0); gNextButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, NEXT_TEXT); gPrevButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 90.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, PREV_TEXT); ShowPlayerModelPreviews(playerid); UpdatePageTextDraw(playerid); } //------------------------------------------------ DestroySelectionMenu(playerid) { DestroyPlayerModelPreviews(playerid); PlayerTextDrawDestroy(playerid, gHeaderTextDrawId[playerid]); PlayerTextDrawDestroy(playerid, gBackgroundTextDrawId[playerid]); PlayerTextDrawDestroy(playerid, gCurrentPageTextDrawId[playerid]); PlayerTextDrawDestroy(playerid, gNextButtonTextDrawId[playerid]); PlayerTextDrawDestroy(playerid, gPrevButtonTextDrawId[playerid]); gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; } //------------------------------------------------ HandlePlayerItemSelection(playerid, selecteditem) { // In this case we change the player's skin if(gSelectionItemsTag[playerid][selecteditem] >= 0 && gSelectionItemsTag[playerid][selecteditem] < 300) { SetPlayerSkin(playerid, gSelectionItemsTag[playerid][selecteditem]); return; } } //------------------------------------------------ public OnPlayerConnect(playerid) { // Init all of the textdraw related globals gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW; for(new x=0; x < SELECTION_ITEMS; x++) { gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW; } gItemAt[playerid] = 0; return 1; // Allow other scripts to keep processing OnPlayerConnect } //------------------------------------------- // Even though only Player* textdraws are used in this script, // OnPlayerClickTextDraw is still required to handle ESC public OnPlayerClickTextDraw(playerid, Text:clickedid) { if(GetPVarInt(playerid, "skinc_active") == 0) return 0; // Handle: They cancelled (with ESC) if(clickedid == Text:INVALID_TEXT_DRAW) { DestroySelectionMenu(playerid); SetPVarInt(playerid, "skinc_active", 0); PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); return 1; } return 0; } //------------------------------------------------ public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) { if(GetPVarInt(playerid, "skinc_active") == 0) return 0; new curpage = GetPVarInt(playerid, "skinc_page"); // Handle: next button if(playertextid == gNextButtonTextDrawId[playerid]) { if(curpage < (GetNumberOfPages() - 1)) { SetPVarInt(playerid, "skinc_page", curpage + 1); ShowPlayerModelPreviews(playerid); UpdatePageTextDraw(playerid); PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); } else { PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); } return 1; } // Handle: previous button if(playertextid == gPrevButtonTextDrawId[playerid]) { if(curpage > 0) { SetPVarInt(playerid, "skinc_page", curpage - 1); ShowPlayerModelPreviews(playerid); UpdatePageTextDraw(playerid); PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0); } else { PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); } return 1; } // Search in the array of textdraws used for the items new x=0; while(x != SELECTION_ITEMS) { if(playertextid == gSelectionItems[playerid][x]) { HandlePlayerItemSelection(playerid, x); PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); DestroySelectionMenu(playerid); CancelSelectTextDraw(playerid); SetPVarInt(playerid, "skinc_active", 0); return 1; } x++; } return 0; } //------------------------------------------------ public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256+1]; new idx; if(!IsPlayerAdmin(playerid)) return 0; cmd = strtok(cmdtext, idx); if(strcmp("/skinchange", cmd, true) == 0) { // If there was a previously created selection menu, destroy it DestroySelectionMenu(playerid); SetPVarInt(playerid, "skinc_active", 1); //SetPVarInt(playerid, "skinc_page", 0); // will reset the page back to the first CreateSelectionMenu(playerid); SelectTextDraw(playerid, 0xACCBF1FF); return 1; } return 0; } //------------------------------------------------
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
December smells like money
CSS | 12 min ago | 0.28 KB
✅ Changelly.com Exploit
25 min ago | 0.28 KB
Trading method
CSS | 38 min ago | 0.28 KB
Google Docs - Exploit
52 min ago | 0.28 KB
Untitled
C | 9 hours ago | 0.88 KB
acg
1 day ago | 0.05 KB
AI METHODS
2 days ago | 0.29 KB
Untitled
2 days ago | 0.29 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!