[Tutorial] How to change your skin with just one command!
#1

I know this is basic scripting, but I'm sure it will help someone who's just starting out.



Ok, first things first, open Pawno and find "OnPlayerCommandText".
Code:
public OnPlayerCommandText(playerid, cmdtext[])
Once you've found that, it should look like this:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

Ok, now we've done that you're going to need to know the ID of the skin you're wanting to use - Link to a list of all the skins availabe in sa-mp: https://sampwiki.blast.hk/wiki/Skins:All

Once you've found the skin ID you're wanting to use, make note of it and continue below.

Look carefully:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)//Where it says "/mycommand", I suggest changing that to "/skin", this is the command you're going to type in-game to make your skin change.
	{
		// Do something here //This is where the scripting function will be going, here you need to write SetPlayerSkin(playerid, SKIN ID HERE);
		return 1;
	}
	return 0;
}
Finished example:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/skin", cmdtext, true, 10) == 0)
	{
		SetPlayerSkin(playerid, 264);//This will change your skin to 264, which is the clown skin.
		return 1;
	}
	return 0;
}
Hopefully that helped some people, thanks for viewing.
Reply
#2

You didn't eplain that much. Anyway I would like to know what does this mean:
pawn Code:
if (strcmp("/skin", cmdtext, true, 10) == 0)
What is the: cmdtext, true, 10) == 0) ?
Mind explaining?
Reply
#3

/skin is not 10 characters long
Reply
#4

This a tutorial on how to change your skin, not what everything does with-in a script. I'm no expert myself.

The 10 is the amount of characters, yeah - not charecters. You can change that number to five or anything above and the command will work just fine to my knowledge.

I think this tutorial shows what the title says just fine, thanks for taking the time to read and reply though.
Reply
#5

Honestly I dont find a point of this tutorial. You've made a whole tutorial for such a basic thing which requires no effort to learn from the wiki.
Reply
#6

I was bored and thought someone might find it handy, which I'm sure someone will.
Reply
#7

Hmm, well I suggest that you should update your tutorial to something like, /skin ID, isn't that hard to accomplish this with sscanf.
Reply
#8

Quote:
Originally Posted by JnLGaming
View Post
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/skin", cmdtext, true, 10) == 0)
	{
		SetPlayerSkin(playerid, 264);//This will change your skin to 264, which is the clown skin.
		return 1;
	}
	return 0;
}
The lenght of /skin is not 10. You should change it.
Reply
#9

This tutorial could have been good. Very Basic. But why not show people how to actually change to any skin. Instead of having a set skin. Example: /skin <skin id>
Reply
#10

Nice tutorial. You could improve it by explaining it a little more and also showing people how to chose whatever skin they want in a parameter.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)