20.09.2013, 23:07
algo asi?
pawn Код:
public OnPlayerConnect(playerid)
{
new Query[256],name[MAX_PLAYER_NAME],ip[32],DBResult: Result;
GetPlayerIp(playerid, ip, sizeof(ip));
GetPlayerName(playerid,name,sizeof(name));
format(Query,sizeof(Query),"SELECT * FROM `USERS` WHERE `IP` = '%s' AND `NAME` = '%s LIMIT 1'", DB_Escape(ip), DB_Escape(name));
Result = db_query(Database, Query);
if(db_num_rows(Result) >= 1)
{
new Field[ 20 ];
db_get_field_assoc(Result, "SCORE", Field, 30);
SetPlayerScore(playerid, strval(Field));
db_get_field_assoc(Result, "CASH", Field, 30);
GivePlayerMoney(playerid, strval(Field));
db_get_field_assoc(Result, "ADMINLEVEL", Field, 30);
Bit16_Set(g_AdminLevel, playerid, strval(Field));
Bit1_Set(g_PlayerLogged, playerid, true);
SendClientMessage(playerid, -1, "You have "COL_GREEN"successfully{FFFFFF} logged in! ");
}
else
{
format(Query, sizeof(Query), "{FFFFFF}Welcome "COL_BLUE"%s(%d){FFFFFF} to the server, you're "COL_RED"not{FFFFFF} registered\n\nPlease log in by inputting your password.", name, playerid);
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "{FFFFFF}Register System", Query, "Register", "Leave");
}
db_free_result(Result);
return 1;
}