SA-MP Forums Archive
vskin help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: vskin help (/showthread.php?tid=320319)



vskin help - Champ - 22.02.2012

i have made a vskin script but when vip spawn the skin will restore with its normal skin. help !! how i make that if a vip choose his skin. the skin not restore


Re: vskin help - AstonDA-G - 22.02.2012

https://sampwiki.blast.hk/wiki/SetSpawnInfo
You can change the skin, and more, that a player will spawn with. Put this line(with your skin id, spawn etc) with your SetPlayerSkin function

Hope I helped


Re: vskin help - Champ - 24.02.2012

i need this command for vip and when player die he will spawn with his vipskin again please check and make for me.

pawn Код:
dcmd_skin( playerid, params[ ] )
{

    new
        skin;

    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 );
    return 1;
}
pawn Код:
if(PlayerInfo[playerid][vip] >= 1){



Re: vskin help - Champ - 24.02.2012

reply


Re: vskin help - AstonDA-G - 01.03.2012

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:
pawn Код:
SetPVarInt(playerid, "Skin", -1);
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:
pawn Код:
if(GetPVarInt(playerid,"Skin") != -1) SetPlayerSkin(playerid, GetPVarInt(playerid, "Skin"));
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.

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;
}
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
pawn Код:
if(PlayerInfo[playerid][Skin] != -1) SetPlayerSkin......
-Aston