Author Topic: Simple /setskin command  (Read 3627 times)

0 Members and 1 Guest are viewing this topic.

Offline Life

  • Banned
  • *
  • Posts: 25
  • Country: fo
  • Respect: +2/-0
  • Gender: Male
  • Best Firefighter, Worker Of The Month
    • View Profile
  • MCNR name: [L]ife
  • Discord name: [L]ife#2488
Simple /setskin command
« on: March 11, 2023, 09:05:22 am »
Hello today i will be giving you a simple /setskin command that anyone can use.

#include <a_samp>
#include <zcmd>
#include <sscanf2>

#define COLOR_WHITE 0xFFFFFF
#define COLOR_BLACK 0x000000
#define COLOR_RED 0xFF0000
#define COLOR_GREEN 0x00FF00
#define COLOR_BLUE 0x0000FF
#define COLOR_YELLOW 0xFFFF00
#define COLOR_ORANGE 0xFFA500
#define COLOR_PURPLE 0x800080

CMD:setskin(playerid, params[])
{
    new skinid = strval(params);
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "Error: You are not connected to the server.");
    if(skinid < 0 || skinid > 311) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid skin ID.");
   
    SetPlayerSkin(playerid, skinid);
    SendClientMessage(playerid, COLOR_GREEN, "Success: Your skin has been changed!");
    return 1;
}

Offline Goldenman

  • Banned
  • *
  • Posts: 713
  • Country: ir
  • Respect: +13/-32
  • Gender: Male
    • View Profile
  • MCNR name: Goldenman
  • Discord name: goldenboyi
Re: Simple /setskin command
« Reply #1 on: March 11, 2023, 03:34:43 pm »
not all of the colour definitions are needed
pretty much the red  and green one as i see

Offline Life

  • Banned
  • *
  • Posts: 25
  • Country: fo
  • Respect: +2/-0
  • Gender: Male
  • Best Firefighter, Worker Of The Month
    • View Profile
  • MCNR name: [L]ife
  • Discord name: [L]ife#2488
Re: Simple /setskin command
« Reply #2 on: March 12, 2023, 11:20:37 am »
Yea i know but why not add more colors

Offline Mido

  • *
  • Posts: 537
  • Country: ma
  • Respect: +9/-22
  • Gender: Male
    • View Profile
  • MCNR name: Mido
  • Discord name: justmido
Re: Simple /setskin command
« Reply #3 on: June 02, 2023, 07:32:45 pm »
You can add another variable "id" and add this;

example//
new id, skin;
if(sscanf(params, "ui", id, skin)) return SendClientMessage(playerid, -1, "usage: /skin <Name/PlayerID> <SkinID>.");

And maybe this to prevent anyone from using this
if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not admin!");