08.06.2012, 04:12
(
Последний раз редактировалось Deanol1099; 11.06.2012 в 02:55.
)
Welcome everyone to my first ever tutorial! I've decided to start to post on the SA-MP forums and share my scripting knowledge, instead of just browsing without an account.
My first post/tutorial will be about the /afk and the /back command! This is good for all servers, and will hopefully help you with it. This guide will hopefully help out all those new scripters - despite me still being relatively new to PAWN still.
Anyways, to the tutorial!
You're going to want to have Zcmd - which you can find here. This'll help us with command processing, without the default SA-MP command processor.
At the top of the script, you're gonna have to add this line:
What this will do is make sure you've added the zcmd include you downloaded from the first step.
Next, you're going to want to add some colour defines to make your frisk text pretty! At the top of the script, under the includes, type in this:
Next we're going to write the command. Hopefully by now you'll now how to write the basic command layout with Zcmd. If not, here we go!
Don't think I'll really explain these. If you don't know how to make those, go look at the ZCMD page.
Under that command, we're going to want to add a variable. This'll send them too a different virtual world then what the default people are in. (Default is 0.)
Next we're going to want to assign them a colour in the tab list. Let's go with red, since we already have it in our defines.
Alright, so we've set their virtual world and our custom colour in the tab list. Next we'll make them so they have over 10k health and armour, just so no one can DM them by chance.
We're almost done! We're going to want to have them frozen so they can't escape and do stuff.
Lastly, we'll send them a message after all the variables are completed.
At the bottom of the command, we'll want to add the proper indentation and the return.
Congrats! You finished making /afk! Now, we'll want to add a /back so they can de-activate all this stuff.
It's pretty easy, in fact, its the exact same thing as how we made the /afk command except for a few different variables.
We're going to want to send them back to VW 0.
Then set their name back to white.
Then unfreeze them.
Then we'll want to set their health and armour back to 100.
Lastly, we'll want to send them a message to let them know they're back from being AFK.
Congratulations! You made our /afk and /back command!
I may be making some more tuts after this - just depends on how busy I am and the feedback I get from this one.
I hoped you enjoyed, and no, I'm not gonna be one of those kids who 'omg!!!!! plz rep me lOl!!!11!!1"
My first post/tutorial will be about the /afk and the /back command! This is good for all servers, and will hopefully help you with it. This guide will hopefully help out all those new scripters - despite me still being relatively new to PAWN still.

Anyways, to the tutorial!
You're going to want to have Zcmd - which you can find here. This'll help us with command processing, without the default SA-MP command processor.
At the top of the script, you're gonna have to add this line:
pawn Код:
#include <zcmd>
Next, you're going to want to add some colour defines to make your frisk text pretty! At the top of the script, under the includes, type in this:
pawn Код:
#define WHITE 0xFFFFFFFF
#define RED 0xE60000FF
pawn Код:
command(afk, playerid, params[])
{
Under that command, we're going to want to add a variable. This'll send them too a different virtual world then what the default people are in. (Default is 0.)
pawn Код:
SetPlayerVirtualWorld(playerid, 500);
pawn Код:
SetPlayerColor(playerid, RED);
pawn Код:
SetPlayerHealth(playerid, 10000);
SetPlayerArmour(playerid, 10000);
pawn Код:
TogglePlayerControllable(playerid, 0);
pawn Код:
SendClientMessage(playerid, WHITE, "You have been set as AFK!");
pawn Код:
{
return 1;
It's pretty easy, in fact, its the exact same thing as how we made the /afk command except for a few different variables.
pawn Код:
command(back, playerid, params[])
{
pawn Код:
SetPlayerVirtualWorld(playerid, 0);
pawn Код:
SetPlayerColor(playerid, WHITE);
pawn Код:
TogglePlayerControllable(playerid, 1);
pawn Код:
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
pawn Код:
SendClientMessage(playerid, WHITE, "Welcome back! You are no longer set as being AFK.");
I may be making some more tuts after this - just depends on how busy I am and the feedback I get from this one.
I hoped you enjoyed, and no, I'm not gonna be one of those kids who 'omg!!!!! plz rep me lOl!!!11!!1"