Trying to learn pawn... question about this piece of script
#1

Ok, so first let me show u the script that I copied from a site

public OnPlayerDisconnect(playerid, reason)
{
new pName[MAX_PLAYER_NAME], string[56];
GetPlayerName(playerid, pName, sizeof(pName));
switch(reason)
{
case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pName);
case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pName);
case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pName);
}
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}

Ok, so I am just going to tell you what I am guessing, please tell me if I am wrong or right.

1. the line "public OnPlayerDisconnect(playerid, reason)" is basically saying that whatever is written after this happens happens when a player disconnects
2. the line "new pName[MAX_PLAYER_NAME], string[56];" sets pName so that from here on whenever u use pName (don't know how to use it though) it replaces pName with the players name
3. the line "GetPlayerName(playerid, pName, sizeof(pName)); " is somehow linked to the line right before it...
4. the line "switch(reason)" no idea
5. the case 0, 1 and 2 is used so that later on, should A happen, go to case 0, should B happen, go to case 1
6 sendclientmessagetoall pretty easy to guess, just sends a message to every one
7. can someone please explain the "string" at the end of "SendClientMessageToAll(0xAAAAAAAA, string);"


Thanks so much for ur help, im trying to learn pawno and from past experience with languages it's best to teach ur self
Reply


Messages In This Thread
Trying to learn pawn... question about this piece of script - by ThePS3Guy - 08.08.2009, 04:52
Re: Trying to learn pawn... question about this piece of script - by ruarai - 08.08.2009, 06:22

Forum Jump:


Users browsing this thread: 1 Guest(s)