Off Topic > PAWN Scripting

Simple /setskin command

(1/1)

Life:
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;
}

Goldenman:
not all of the colour definitions are needed
pretty much the red  and green one as i see

Life:
Yea i know but why not add more colors

Mido:
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!");

Navigation

[0] Message Index

Go to full version