01.11.2017, 13:06
Quote:
You need to save the old skin in the player database
Here is an example. Don't forget to edit it. PHP код:
|
If you'd like to use true/false instead of 0/1, you need to tag the variable with bool:, for instance (boolkinChanged)
Also, the entire equipped variable is obsolete, you can simply use the OldSkin[playerid] variable for this (check if it's set, if not set it, you get the point).
Also, you should probably then reset the OldSkin[playerid] when the player disconnects or connects.
I created a small quick command so you can change to a skin you want, I haven't tested it though:
If you'd like to add this, you need to add SetPVarInt(playerid, "old_skin", -1); to OnPlayerConnect or disconnect,
if not it will not work properly (this is because CJ has skin 0).
Код:
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; }