31.03.2011, 16:09
here is my on player connect
only ghave 1 question, why server dont port me on server, why stop after login ?
Код:
public OnPlayerConnect(playerid) { /*if(strcmp(GetPlayerCountryName(playerid), "Anonymous Proxy", true) == 0) { SendClientMessage(playerid, WHITE, "You're not allowed to play here, connecting via a proxy."); Kick(playerid); // This check is completely redundant in most cases. } else {*/ if(! IsPlayerNPC(playerid)) { new string[128], Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); format(string, sizeof(string), "Accounts/%s.ini", Name); Reset(playerid); SetPlayerColor(playerid, GREY); TotalConnections++; PlayersOn++; if(PlayersOn > MaxVisitors) { MaxVisitors = PlayersOn; UpdateAnalysis(); } // Website textdraw commented out as there's no website specified for the release. Simply uncomment the code which defines the textdraw at the top // and remove these 2 comments and uncomment the line below. ...Oh, and the part where the variable 'Textdraw1' is declared. //TextDrawShowForPlayer(playerid, Textdraw1); if(fexist(string)) { ShowPlayerDialog(playerid, 3894, DIALOG_STYLE_INPUT, "Authentication", "Welcome to LecevicA Roleplay\n\nYou have an account, please enter your password to authenticate.", "Login", "Help"); SendClientMessage(playerid, WHITE, "This name is registered. If you're the account owner, please login with your account credentials to proceed."); } else { new playernamesplit[3][MAX_PLAYER_NAME]; split(Name, playernamesplit, '_'); if (!strlen(playernamesplit[0]) || !strlen(playernamesplit[1])) { new NameStr[MAX_PLAYER_NAME]; format(NameStr, sizeof(NameStr), "NONRPNAME%d", playerid); SetPlayerName(playerid, NameStr); printf("[system] %s has been forced to the name change menu.", Name); //TogglePlayerControllable(playerid, false); ShowPlayerDialog(playerid, 594, DIALOG_STYLE_INPUT, "Roleplay Name", "Please select a new, valid roleplaying name.", "Change", "Cancel"); SendClientMessage(playerid, WHITE, "Your name is not valid, please pick a new one. Refrain from using tags, please and include 1 underscore."); } else { ShowPlayerDialog(playerid, 3895, DIALOG_STYLE_INPUT, "Registration", "Please enter your password to register your new account.", "Register", "Cancel"); SendClientMessage(playerid, WHITE, "This username is not registered. If you register, you'll automatically be logged in!"); } } SetPlayerColor(playerid, WHITE); } else { Reset(playerid); printf("[system] NPC %s has connected to the server.", GetName(playerid)); NPCs++; } return 1; }