24.09.2010, 13:18
(
Last edited by Injector; 24/09/2010 at 01:20 PM.
Reason: Shut up
)
Hello there. Here's a tutorial on how to script "/skin [ID]" command.
Well. We'll explain that right now. Firstly, open Pawno, Go on File -> New , Or press CTRL + N .
Cool? Now, before we script that command, We have to include a file which we have in "include" folder...
We'll have to include a file called "gl_common", We should have it already in the "include" folder... But, if you don't have it, Here's:
http://www.mediafire.com/?y20pclpl1e8y7oc
Okey, fine.
*NOTE: This is not for /skin command only. You can create any command you want as long as It has a lot of symbols. As /kick [ID], /ban [ID], etc...
Now, on the pawno codes. You see: "#include <a_samp>"
1. Go under it, type:
2. We need to define the colours so... Search for "#endif"
Type under it:
3. Now, don't move. Type under those colours:
4. Now, It's time to type the command /skin ..
Search for "OnPlayerCommandText" and You'll see "{" mark...
Change: /mycommand to /skin
Okey... Here, we need to put a "tmp"...
For knowledge, "tmp" means the [ID] which the player is going to type.
So... Type under "{" mark the following:
// Don't play with [256] number. Just type what I'm telling you.
Okey. Now type under that code again:
Okey. I would rather telling you the full code, Explaining it to you at the end of the subject...
On:
"tmp = strtok ( cmdtext, idx );" // We are scripting that "tmp" is used for the ID.
"if ( !strlen ( tmp ) )" // This is for the USAGE message. If someone typed /skin with the ID, It'll show up.
"SendClientMessage(playerid, COLOR_RED, "USAGE: /skin [ID]");" // As I said before. This is used for the USAGE message.
"SetPlayerSkin(playerid, strval(tmp));" // It's obviously changing the skin. But, On "strval(tmp))" That's the ID which the player is going to type, Which we called it "tmp".
*WARNING: Be sure that you end up with "return 1;"
Full Code:
Any questions I'm ready to answer
Well. We'll explain that right now. Firstly, open Pawno, Go on File -> New , Or press CTRL + N .
Cool? Now, before we script that command, We have to include a file which we have in "include" folder...
We'll have to include a file called "gl_common", We should have it already in the "include" folder... But, if you don't have it, Here's:
http://www.mediafire.com/?y20pclpl1e8y7oc
Okey, fine.
*NOTE: This is not for /skin command only. You can create any command you want as long as It has a lot of symbols. As /kick [ID], /ban [ID], etc...
Now, on the pawno codes. You see: "#include <a_samp>"
1. Go under it, type:
Code:
#include "../include/gl_common.inc"
Type under it:
Code:
#define COLOR_RED 0xAA3333AA #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_RED 0xAA3333AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_ORANGE 0xFF9900AA #define COLOR_SPAWN 0xFF8C55FF #define COLOR_LIGHTBLUE 0x6DC5F3FF #define COLOR_ADMIN 0xFF0000FF #define COLOR_SAY 0x2986CEFF #define COLOR_SYSGREY 0xC6BEBDFF #define COLOR_BLACK 0x000000FF #define COLOR_JOIN 0x74E80099 #define COLOR_WARN 0xBE615099 #define COLOR_RACE 0x00BBBB99 #define COLOR_KRED 0xFF0000FF
Code:
new idx;
Search for "OnPlayerCommandText" and You'll see "{" mark...
Change: /mycommand to /skin
Okey... Here, we need to put a "tmp"...
For knowledge, "tmp" means the [ID] which the player is going to type.
So... Type under "{" mark the following:
Code:
new tmp[256];
Okey. Now type under that code again:
Code:
tmp = strtok ( cmdtext, idx );
if ( !strlen ( tmp ) )
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /skin [ID]");
return 1;
}
SetPlayerSkin(playerid, strval(tmp));
On:
"tmp = strtok ( cmdtext, idx );" // We are scripting that "tmp" is used for the ID.
"if ( !strlen ( tmp ) )" // This is for the USAGE message. If someone typed /skin with the ID, It'll show up.
"SendClientMessage(playerid, COLOR_RED, "USAGE: /skin [ID]");" // As I said before. This is used for the USAGE message.
"SetPlayerSkin(playerid, strval(tmp));" // It's obviously changing the skin. But, On "strval(tmp))" That's the ID which the player is going to type, Which we called it "tmp".
*WARNING: Be sure that you end up with "return 1;"
Full Code:
Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include "../include/gl_common.inc"
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
#define COLOR_RED 0xAA3333AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_SPAWN 0xFF8C55FF
#define COLOR_LIGHTBLUE 0x6DC5F3FF
#define COLOR_ADMIN 0xFF0000FF
#define COLOR_SAY 0x2986CEFF
#define COLOR_SYSGREY 0xC6BEBDFF
#define COLOR_BLACK 0x000000FF
#define COLOR_JOIN 0x74E80099
#define COLOR_WARN 0xBE615099
#define COLOR_RACE 0x00BBBB99
#define COLOR_KRED 0xFF0000FF
new idx;
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/skin", cmdtext, true, 10) == 0)
{
new tmp[256];
tmp = strtok ( cmdtext, idx );
if ( !strlen ( tmp ) )
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /skin [ID]");
return 1;
}
SetPlayerSkin(playerid, strval(tmp));
// Do something here
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
Any questions I'm ready to answer



