General > Help & Resources

How to code SA-MP Pawn [Tutorial]

<< < (5/5)

[RToS]Đ3luX_Mik3x[sR]:
Next tutorial is about public OnPlayerConnect and public OnPlayerDisconnect.

1.
--- Code: ---public OnPlayerConnect(playerid)
{
new player[100];
GetPlayerName(playerid,player, 24);
format(player, 100, "%s has joined the server.",player);// Player Name
SendClientMessageToAll(0xA52A2AAA, player);// Color

SendClientMessage(playerid,0xA52A2AAA,"Welcome to blabla..... ");// SCM

GameTextForPlayer(playerid,"Welcome to Adrenaline~r~X ~w~server.",5000,5);//GT

ShowPlayerDialog(playerid, dialogid, dialogstyle, "welcoming title", "Welcome\nBlablan\nBlabla", "button1", "button2");//  \n = next line

return 1;
}

--- End code ---


Game Text: http://wiki.sa-mp.com/wiki/GameTextStyle



2.
--- Code: ---public OnPlayerDisconnect(playerid, reason)
{
new player[100];//name
GetPlayerName(playerid, player, 30);
switch (reason) {
case 0: format(hrac, 100, "%s has  left the  server.",player);// Reason 1
case 1: format(hrac, 100, "%s has  left the  server.(Timeout)",player);// Reason 2
case 2: format(hrac, 100, "%s has  left the  server (Kick/Ban)",player);// Reason 3
}
SendClientMessageToAll(0xA52A2AAA, player);//color

return 1;
}
--- End code ---

This function are easy :) 

[MAF]Rac3r:
Bump:  Max, here's a nice tutorial to get started.

[MAF]Cromiell:
lol Max coding, heh good luck. Even I can do a lot of nice stuffs in website source I have no clue about PAWN. I mean I know how it works but I don't know how to script stuffs there. I'm "learning" since 1 year. :L By the time I would have had already known a lot but I am just too lazy.

[MAF]Karlis:
if max really knows basics of C++ like he says this should be easy.

EDIT: nice and short documentation, helped me to get started: http://thedarkjoker94.cer33.com/?p=1017

Navigation

[0] Message Index

[*] Previous page

Go to full version