01.03.2012, 20:05
Sorry for delay D:
I think the easiest way is to set another pInfo or PVarInt with the player's skin id, then when he respawns, set his skin again to whatever the value is. I will code it with PVarInt:
So we will set it to -1 when the player connects, because this isnt a real skin id.
put on OnPlayerConnect:
ok now we need to reset the player's skin if it's not the default one. If it's at -1, we won't change the skin at all. put at OnPlayerSpawn:
This will check if the players PVar is -1, and if it isn't, then set his skin to whatever it is set to.
Now we can add the cmd, and you want it for VIP only.
Sorry if it's badly explained, i've never been good at explaining stuff, but I hope i helped you somehow.
PS. If you want to use PlayerInfo, just change the PVarInt bits, so something like
-Aston
I think the easiest way is to set another pInfo or PVarInt with the player's skin id, then when he respawns, set his skin again to whatever the value is. I will code it with PVarInt:
So we will set it to -1 when the player connects, because this isnt a real skin id.
put on OnPlayerConnect:
pawn Код:
SetPVarInt(playerid, "Skin", -1);
pawn Код:
if(GetPVarInt(playerid,"Skin") != -1) SetPlayerSkin(playerid, GetPVarInt(playerid, "Skin"));
Now we can add the cmd, and you want it for VIP only.
pawn Код:
dcmd_skin( playerid, params[ ] )
{
new skin;
if(PlayerInfo[playerid][vip] >= 1) { //if the player is VIP, continue
if( sscanf( params, "i", skin ) ) return SendClientMessage( playerid, -1, "Usage: /skin <ID>" );
if( skin > 299 || skin < 1 ) return SendClientMessage( playerid, -1, "Invalid ID. Available Skin IDs are 1 to 299!" );
new string[ 128 ];
format( string, sizeof( string ), "You have changed your skin to %d", skin);
SendClientMessage( playerid, -1, string );
SetPlayerSkin(playerid, skin);
SetPVarInt(playerid, "Skin", skin); //we also set the PVar to the skin id that he entered, so it will reset next time the player spawns.
}
else SendClientMessage(playerid, YOUR COLOUR, "You are not a VIP. You cannot use this command.");
return 1;
}
PS. If you want to use PlayerInfo, just change the PVarInt bits, so something like
pawn Код:
if(PlayerInfo[playerid][Skin] != -1) SetPlayerSkin......