Question

Спойлер

public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, player_info[playerid][NAME], MAX_PLAYER_NAME);
    static const fmt_query[] = "SELECT 'id' FROM 'users' WHERE 'name' = '$s'";
    new query[sizeof(fmt_query)+(-2+MAX_PLAYER_NAME)];
    format(query, sizeof(query), fmt_query, player_info[playerid][NAME]);
    mysql_tquery(dbHandle, query, "CheckRegistration", "1", playerid);
    return 1;
}

forward CheckRegistration(playerid);
public CheckRegistration(playerid)
{
    new rows;
    cache_get_row_count(rows);
    if(rows) ShowLogin(playerid);
    else ShowRegistration(playerid);
}

stock ShowLogin(playerid)
{
    SendClientMessage(playerid, COLOR_LIME, "игрок зарегестривован");
}

stock ShowRegistration(playerid)
{
    SendClientMessage(playerid, COLOR_RED, "игрок не зарегестрирован");
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

 

вот скрипн он не работает

Share this post


Link to post

1 answer to this question

  • 0

@Кирилл2509, попробуйте заменить следующим:

Спойлер

public OnPlayerConnect(playerid)
{
	GetPlayerName(playerid, player_info[playerid][NAME], MAX_PLAYER_NAME);
	static const fmt_query[] = "SELECT 'id' FROM 'users' WHERE 'name' = '$s'";
	new query[sizeof(fmt_query)+(-2+MAX_PLAYER_NAME)];
	format(query, sizeof(query), fmt_query, player_info[playerid][NAME]);
	mysql_tquery(dbHandle, query, "CheckRegistration", "i", playerid);
	return 1;
}

forward CheckRegistration(playerid);
public CheckRegistration(playerid)
{
	new rows;
	cache_get_row_count(rows);
	if(rows) ShowLogin(playerid);
	else ShowRegistration(playerid);
	
	return 1;
}

stock ShowLogin(playerid)
{
	SendClientMessage(playerid, COLOR_LIME, "игрок зарегестривован");
}

stock ShowRegistration(playerid)
{
	SendClientMessage(playerid, COLOR_RED, "игрок не зарегестрирован");
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

 

 

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • NirmanaYT
      By NirmanaYT
      Здравствуйте! Хотел бы попросить помощи! Как добавить текст допустим ,
      Чтоб ну примерно каждые 30 минут в чате отображался определённый текст который я задам!
       
      Всем игрокам