Skin Changer help
#1

Hello everybody

I want to have an skin changin command on my server, but i don't know how to place the input in the command to the "SetPlayerSkin(playerid, ...)"
can one of you help

Thanks in advace
Reply
#2

Код:
dcmd_setskin(playerid,params[]) {
      new string[128];
      new pName[MAX_PLAYER_NAME];
      GetPlayerName(playerid,pName,sizeof(pName));
	  new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	  if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setskin [playerid] [skin id]");
		new player1 = strval(tmp), skin = strval(tmp2), string[128];
		if(!IsValidSkin(skin)) return SendClientMessage(playerid, red, "ERROR: Invaild Skin ID");
    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
		format(string, sizeof(string), "You have set \"%s's\" skin to '%d", pName(player1), skin); SendClientMessage(playerid,blue,string);
		if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your skin to '%d'", pName(playerid), skin); SendClientMessage(player1,blue,string); }
  		return SetPlayerSkin(player1, skin);
	  } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	}
Reply
#3

put this at the top

Код:
// Skins
#define MIN_SKIN_ID		0
#define MAX_SKIN_ID		299
IsInvalidSkin(skinid)
{  
	#define	MAX_BAD_SKINS  14

	new badSkins[MAX_BAD_SKINS] = {
		3, 4, 5, 6, 8, 42, 65, 74, 86,
		119, 149, 208, 273, 289
	};

	for (new i = 0; i < MAX_BAD_SKINS; i++) {
	  if (skinid == badSkins[i]) return true;
	}

	return false;
}
OnPlayerCommandText
Код:
if(strcmp(cmd, "/skin", true) == 0) { 
        new skins, stringy[128];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_GREEN, "Usage: /skin [SKIN-ID]");
            return 1;
        }
		skins = strval(tmp);
        if (IsInvalidSkin(skins))
        {
           SendClientMessage(playerid, COLOR_GREEN, "Bad Skin ID");
            return 1;
        }
        format(stringy, sizeof(stringy), "Your skin was set to ID: %d", skins);
	   	SendClientMessage(playerid, COLOR_GREEN, stringy);
        SetPlayerSkin(playerid,skins); 
        return 1;
}
hope it helps
Reply
#4

Thanks all of you

i hope it works

Btw thanks for your quick reaction
Reply
#5

np
Reply
#6

urw
Reply
#7

i get these errors now

C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(825) : error 017: undefined symbol "tmp"
C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(825) : error 017: undefined symbol "idx"
C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(826) : error 017: undefined symbol "tmp"
C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(827) : error 017: undefined symbol "COLOR_GREEN"
C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(830) : error 017: undefined symbol "tmp"
C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(833) : error 017: undefined symbol "COLOR_GREEN"
C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(837) : error 017: undefined symbol "COLOR_GREEN"
C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(842) : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


7 Errors.

what are the problems?

btw i used the one from beaver
Reply
#8

show ur code plz or just use mines
Reply
#9

just under your OnPlayerCommandText

put
Код:
new cmd[256],idx;
cmd = strtok(cmdtext, idx);
new tmp[256];
and at the top of your script

Код:
#define COLOR_GREEN 0x0AFF0AAA
as for this error: C:\Users\Sander\Desktop\sa-mp scripting\r7\gamemodes\grandlarc.pwn(842) : warning 209: function "OnPlayerCommandText" should return a value

seems like you missed out a return 1; or make sure OnPlayerCommandText has return 0; at the end.
Reply
#10

Quote:
Originally Posted by !Vampire!
show ur code plz or just use mines
he wont be able to use yours if he doesnt have dcmd
Reply


Forum Jump:


Users browsing this thread: