SA-MP Forums Archive
Skin command - 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: Skin command (/showthread.php?tid=581626)



Skin command - iMouiz - 14.07.2015

This is a skin changing command works as /skin <id>

PHP код:
CMD:skin(playerid,params[])
{
    new 
skinid;
    if(
PlayerInfo[playerid][Freeze] == 1) return GameTextForPlayer(playerid"~g~you cant use commands while being ~n~~g~frozen",4500,3);
    if(
PlayerInfo[playerid][Jail] == 1) return GameTextForPlayer(playerid,"~g~Player is not in freeroam",2500,3);
    if(
indm[playerid] >= 1) return GameTextForPlayer(playerid,"~g~You are not in freeroam",2500,3);
    if(
PlayerInfo[playerid][Jail] == 1) return GameTextForPlayer(playerid,"~g~Player is not in freeroam",2500,3);
    if(
sscanf(params"d"skinid)) GameTextForPlayer(playerid,"~g~/skin <skinid>",4500,3);
    else if(
skinid || skinid 311) return 0;
    else
    {
        
SetPlayerSkin(playeridskinid);
    }
    return 
1;

But i want to make it also like if a player does not type the skin id so it automatically ForceClassSelection


Re: Skin command - X337 - 14.07.2015

PHP код:
CMD:skin(playerid,params[]) 

    new 
skinid
    if(
PlayerInfo[playerid][Freeze] == 1) return GameTextForPlayer(playerid"~g~you cant use commands while being ~n~~g~frozen",4500,3); 
    if(
PlayerInfo[playerid][Jail] == 1) return GameTextForPlayer(playerid,"~g~Player is not in freeroam",2500,3); 
    if(
indm[playerid] >= 1) return GameTextForPlayer(playerid,"~g~You are not in freeroam",2500,3); 
    if(
PlayerInfo[playerid][Jail] == 1) return GameTextForPlayer(playerid,"~g~Player is not in freeroam",2500,3); 
    if(
sscanf(params"d"skinid)) ForceClassSelection(playerid); // forced him to class selection
    
else if(skinid || skinid 311ForceClassSelection(playerid); // forced him to class selection if the skin id smaller than 0 or greater than 311
    
else 
    { 
        
SetPlayerSkin(playeridskinid); 
    } 
    return 
1




Re: Skin command - iTakelot - 14.07.2015

use ForceClassSelection

wiki

Код:
command(skin, playerid, params[])
{
    new skinid;
    if(PlayerInfo[playerid][Freeze] == 1) return GameTextForPlayer(playerid, "~g~you cant use commands while being ~n~~g~frozen",4500,3);
    if(PlayerInfo[playerid][Jail] == 1) return GameTextForPlayer(playerid,"~g~Player is not in freeroam",2500,3);
    if(indm[playerid] >= 1) return GameTextForPlayer(playerid,"~g~You are not in freeroam",2500,3);
    if(PlayerInfo[playerid][Jail] == 1) return GameTextForPlayer(playerid,"~g~Player is not in freeroam",2500,3);
    if(sscanf(params, "d", skinid)) ForceClassSelection(playerid);
    else if(skinid < 0 || skinid > 311) return 0;
    else
    {
        SetPlayerSkin(playerid, skinid);
        ForceClassSelection(playerid);
    }
    return 1;
}