Mike's Cops and Robbers

Off Topic => PAWN Scripting => Topic started by: Life on March 11, 2023, 09:05:22 am

Title: Simple /setskin command
Post by: Life 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;
}
Title: Re: Simple /setskin command
Post by: Goldenman 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
Title: Re: Simple /setskin command
Post by: Life on March 12, 2023, 11:20:37 am
Yea i know but why not add more colors
Title: Re: Simple /setskin command
Post by: Mido 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!");