/setskin
#1

it only gives errors...

Can someone create me a simple /setskin command? it doesn't matter who's able to use it.
Reply
#2

But admins preffered
Using pAdmin
Reply
#3

Show the command and the errors.
Reply
#4

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Show the command and the errors.
Can't give a answer on that since it was some times ago and i just deleted it again.
So actually i have nothing atm.
Reply
#5

pawn Код:
COMMAND:myskin(playerid,params[])
{
    if ( sscanf( params, "d", params[ 0 ] ) ) return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /myskin <skin>");

    if ( !IsValidSkin( params[ 0 ] ) ) return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Invalid skin ID.");
       
    SetPlayerSkin(playerid, params[ 0 ]);
    Account[playerid][Skin] = params [ 0 ];

    new String[180];
    format( String, sizeof String, "{FFFFFF}You set your Skin to "COL_LIGHTBLUE"%d{FFFFFF} and it has been saved into your account succesfully!", params[ 0 ] );
    SendClientMessage( playerid, -1, String );
    return 1;
}
Reply
#6

thanks.
Reply
#7

Quote:
Originally Posted by -Rebel Son-
Посмотреть сообщение
pawn Код:
COMMAND:myskin(playerid,params[])
{
    if ( sscanf( params, "d", params[ 0 ] ) ) return SendClientMessage( playerid, -1, ""COL_LIGHTBLUE"Usage:{FFFFFF} /myskin <skin>");

    if ( !IsValidSkin( params[ 0 ] ) ) return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} Invalid skin ID.");
       
    SetPlayerSkin(playerid, params[ 0 ]);
    Account[playerid][Skin] = params [ 0 ];

    new String[180];
    format( String, sizeof String, "{FFFFFF}You set your Skin to "COL_LIGHTBLUE"%d{FFFFFF} and it has been saved into your account succesfully!", params[ 0 ] );
    SendClientMessage( playerid, -1, String );
    return 1;
}
Sorry forgot to mention its strcmp..
Reply
#8

anyone? in strcmp?
Reply
#9

Untested
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/setskin", true) == 0) {
        if(IsPlayerConnected(playerid)) {
            // Change !IsPlayerAdmin(playerid) --> Rcon Administrator to your Admin Variable.
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You cannot use this command!");
            /*
            if(Admin_Variable[playerid][Admin_enum] < your_level) return SendClientMessage(playerid, -1, "You cannot use this command!");
            */

            new
                tmp[256],
                tmp2[256],
                id = strval(tmp),
                skin = strval(tmp2);
            tmp = strtok(cmdtext, idx);
            tmp2 = strtok(cmdtext, idx);
            if(!strlen(tmp)) {
                SendClientMessage(playerid, -1, "Usage: /setskin [ID] [Skin ID]");
                return 1;
            }
            if(!strlen(tmp2)) {
                SendClientMessage(playerid, -1, "Usage: /setskin [ID] [Skin ID]");
                return 1;
            }
            SetPlayerSkin(id, skin);
        }
        return 1;
    }
    // Rest Of Commands
    return 0;
}
In case, you haven't stock of strtok, add this at the bottom of your script.
pawn Код:
// Written by DracoBlue.
stock strtok(const string[], &index,seperator=' ')
{
    new length = strlen(string);
    new offset = index;
    new result[MAX_STRING];
    while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1))) {
        result[index - offset] = string[index];
        index++;
    }

    result[index - offset] = EOS;
    if ((index < length) && (string[index] == seperator)) {
        index++;
    }
    return result;
}
Reply
#10

I just whipped this command up for you. Its pretty simple. a_samp and zCMD come with a "SetPlayerSkin" variable.. so here.


Код:
CMD:setskin(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new
		  targetid,
		  skinid;

		if (!sscanf(params, "ii", targetid, skinid))
		{
		  if (targetid != INVALID_PLAYER_ID)
		  {
		    new
		      message[40];
		    SetPlayerSkin(targetid, skinid);
		    format(message, sizeof(message), "Your skin ID was set to '%d' by an Admin!", skinid);
		    SendClientMessage(targetid, COLOR_ORANGE, message);
		  }
		  else SendClientMessage(playerid, COLOR_GREY, "That player is not connected!");
		}
		else SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /setskin [playerid]");
	}
	else SendClientMessage(playerid, COLOR_GREY, "You are not a level 1+ Admin!");
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)