How to change your skin with just one command! -
JnLGaming - 26.08.2013
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.
Re: How to change your skin with just one command! -
CrazyChoco - 26.08.2013
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?
Re: How to change your skin with just one command! -
doreto - 26.08.2013
/skin is not 10 characters long
Re: How to change your skin with just one command! -
JnLGaming - 26.08.2013
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.
Re: How to change your skin with just one command! -
Alexis1999 - 26.08.2013
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.
Re: How to change your skin with just one command! -
JnLGaming - 26.08.2013
I was bored and thought someone might find it handy, which I'm sure someone will.
Re: How to change your skin with just one command! -
JimmyCh - 26.08.2013
Hmm, well I suggest that you should update your tutorial to something like, /skin ID, isn't that hard to accomplish this with sscanf.
Re: How to change your skin with just one command! -
ThePhenix - 26.08.2013
Quote:
Originally Posted by JnLGaming
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.
Re: How to change your skin with just one command! -
T0pAz - 27.08.2013
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>
Re: How to change your skin with just one command! -
Finn707 - 27.08.2013
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.