pawn Код:
// Top
#include a_samp
public OnPlayerConnect(playerid) // This callback is called when the player connect
{
SendClientMessage(playerid, 0xFF0000AA, "Welcome :)"); // Send a message to player
new PlayerName[MAX_PLAYER_NAME], StringMsg[128];
GetPlayerName(playerid, PlayerName, sizeof PlayerName); // Get the player name and store in a variable
format(StringMsg, sizeof StringMsg, "Your name: %s | Your playerid: %d", PlayerName, playerid); // Format the StringMsg
SendClientMessage(playerid, 0x00FF00AA, StringMsg); // Send a message to player
if(strcmp(PlayerName, "Adel", true) == 0) // if the PlayerName is "Adel"
{
SendClientMessage(playerid, 0xFF0000AA, "Welcome Adel!"); // Send a message to player
}
if(strfind(PlayerName, "Ad", true) != -1) // if the PlayerName contains the text "Ad"
{
SendClientMessage(playerid, 0xFF0000AA, "Your name contains ''Ad''"); // Send a message to player
}
return true;
}
/*
SendClientMessage(playerid, color in hex (0xRRGGBBAA), text);
new array[array size];
GetPlayerName(playerid, array, sizeof array);
format(array, sizeof array, text, params); // %s to string | %d to number | %f to float
strcmp(array, text, ignore case sensitive) // Compare a text
strfind(array, text, ignore case sensitive) // Find a text
*/
/* This is a comment */
// This is a comment