06.03.2011, 08:27
So ALOT of people go and look for FS's to add to a server. But in my opinion if you want a server, learn to script?
Which is how i wound up making this, for people to use or edit. Also if you do decide to use any of these i dont require credits, just leave a comment telling me what you think.
So first i'm gonna start with the most basic /kill command.
Go and open pawno then go down to
And now the first function we are going to use is
Then we are gonna start making the command.
Hit Compile? No.
Can you see what i did wrong?
I put the "return" before the function(and yes i have seen some people do this).
So now we need to edit it to come out like the following:
Now we can hit compile
And with no errors this time.
Congrats you have made you first command.
Now we can move on to something else, which will be sending messages.
There are a few types
A.)SendClientMessage(playerid, color, "message");
This can be used like the following:
B.)SendClientMessageToAll(color, "message");
This will send a message to the whole server, so like:
C.)SendPlayerMessageToAll(color, "message");
This is the last function i will go over , and it sends something someone types to all players:
Also you might wana add this at the top:
And if anyone has some tips for me, please give.
As its 4:30am i am tired, so i might sleep will add some more tutorials tomorrow, including more cmds and functions.
Good luck guys!
Which is how i wound up making this, for people to use or edit. Also if you do decide to use any of these i dont require credits, just leave a comment telling me what you think.
So first i'm gonna start with the most basic /kill command.
Go and open pawno then go down to
Code:
public OnPlayerCommandText(playerid, cmdtext[])
Code:
SetPlayerHealth(playerid, health);
Code:
if (strcmp("/kill", cmdtext, true, 10) == 0) { return 1; SetPlayerHealth(playerid, 0); }
Can you see what i did wrong?
I put the "return" before the function(and yes i have seen some people do this).
So now we need to edit it to come out like the following:
Code:
if (strcmp("/kill", cmdtext, true, 10) == 0) { SetPlayerHealth(playerid, 0); return 1; }
And with no errors this time.
Congrats you have made you first command.
Now we can move on to something else, which will be sending messages.
There are a few types
A.)SendClientMessage(playerid, color, "message");
This can be used like the following:
Code:
SendClientMessage(playerid, RED, "Banana's!");
This will send a message to the whole server, so like:
Code:
SendClientMessageToAll(RED, "Banana's x 2");
This is the last function i will go over , and it sends something someone types to all players:
Code:
SendPlayerMessageToAll(RED, "Hi!");
Code:
#define RED 0xFF0000AA
As its 4:30am i am tired, so i might sleep will add some more tutorials tomorrow, including more cmds and functions.
Good luck guys!