17.01.2010, 23:11
i'm looking for a filterscript or a code that will send a message to players that are logged in that a player logged in.
Ex. *[Player's name] has just logged in*
Ex. *[Player's name] has just logged in*
#define FILTERSCRIPT #include <a_samp> #if defined FILTERSCRIPT public OnFilterScriptInit() { return 1; } public OnFilterScriptExit() { return 1; } #else main() { } #endif public OnPlayerConnect(playerid) { new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(string, sizeof(string), "%s has joined the server", pname); SendClientMessageToAll(0x0689ffff, string); return 1; } public OnPlayerDisconnect(playerid, reason) { new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME]; 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/banned)", pname); } SendClientMessageToAll(0x0689ffff, string); return 1; }
public OnPlayerConnect(playerid) //Keeps saying error 029: invalid expression, assumed zero { new plname[MAX_PLAYER_NAME]; GetPlayerName(playerid, plname, sizeof(plname)); format(string, sizeof(string), "%s has joined the server", plname); SendClientMessageToAll(0xAAAAAAAA, string); return 1; } public OnPlayerDisconnect(playerid) //Keeps saying error 029: invalid expression, assumed zero { new plname[MAX_PLAYER_NAME]; GetPlayerName(playerid, plname, sizeof(plname)); { format(string, sizeof(string), "%s has left the server. (Leaving)", plname); } SendClientMessageToAll(0xAAAAAAAA, string); return 1;
if (strcmp(cmd, "/login", true) ==0 || strcmp(cmd, "/l", true) ==0) { if(IsPlayerConnected(playerid)) { new tmppass[64]; if(gPlayerLogged[playerid] == 1) { SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: (/l)ogin [password]"); return 1; } strmid(tmppass, tmp, 0, strlen(cmdtext), 255); //Encrypt(tmppass); OnPlayerLogin(playerid,tmppass); } return 1; } //-----------Register--------------- if (strcmp(cmd, "/register", true) ==0 ) { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid] == 1) { SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in."); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "users/%s.ini", sendername); new File: hFile = fopen(string, io_read); if (hFile) { SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one."); fclose(hFile); return 1; } new tmppass[64]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /register [password]"); return 1; } strmid(tmppass, tmp, 0, strlen(cmdtext), 255); //Encrypt(tmppass); OnPlayerRegister(playerid,tmppass); } return 1; }