01.11.2017, 09:59
How to make /equipment and that when I go again /equipment to give me back the old skin?
#define Skin 30 //This is the skin you want the player to change to when he enters the command
new OldSkin[MAX_PLAYERS];
new Equipped[MAX_PLAYERS] = false;
CMD:equipment(playerid, params[]) {
if(Equipped[playerid] == true) {
SendClientMessage(playerid, 0x005500AA, "You have returned to your old clothes");
SetPlayerSkin(playerid, OldSkin[playerid]);
Equipped[playerid] = false;
}
else {
Equipped[playerid] = true;
OldSkin[playerid] = GetPlayerSkin(playerid);
SendClientMessage(playerid, 0x005500AA, "You have changed your clothes");
SetPlayerSkin(playerid, Skin);
}
return 1;
}
You need to save the old skin in the player database
Here is an example. Don't forget to edit it. PHP код:
|
CMD:equipment(playerid, params[]) { new oldSkin = GetPVarInt(playerid, "old_skin"); if (oldSkin < 0) { new skin; if (sscanf(params, "d", skin)) { return SendClientMessage(playerid, -1, "Usage: {595252}/equipment (skin)"); } else { if (skin == 65 || skin == 74 || skin < 0 || skin >= 312) { return SendClientMessage(playerid, -1, "The skin you specified is invalid!"); } SetPVarInt(playerid, "old_skin", GetPlayerSkin(playerid)); SetPlayerSkin(playerid, skin); } } else { SetPlayerSkin(playerid, oldSkin); DeletePVar(playerid, "old_skin"); } return 1; }