Need Help Plz
#1

hello there i have a register code but its giveing me these errors

Код:
C:\Users\lizzy\Desktop\awsome\gamemodes\c&r.pwn(278) : error 001: expected token: "]", but found "-identifier-"
C:\Users\lizzy\Desktop\awsome\gamemodes\c&r.pwn(278) : warning 215: expression has no effect
C:\Users\lizzy\Desktop\awsome\gamemodes\c&r.pwn(278) : error 001: expected token: ";", but found "]"
C:\Users\lizzy\Desktop\awsome\gamemodes\c&r.pwn(278) : error 029: invalid expression, assumed zero
C:\Users\lizzy\Desktop\awsome\gamemodes\c&r.pwn(278) : fatal error 107: too many error messages on one line
Here is the code ...
Код:
dcmd_register(playerid, params[])
{
  new password[100];
  format(password, sizeof(password), "%s", params);
 /*line 278*/ format(gPlayerInfo[playerid][PLAYER_PASS], sizeof(gPlayerInfo[playerid][PLAYER_PASS]), "%s", password);
	if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)
	{
  SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You Are Alredy Registered On This Sever");
	}
	else
	{
  gPlayerInfo[playerid][PLAYER_LOGGED] = 1;
  gPlayerInfo[playerid][PLAYER_REGGED] = 1;
	gPlayerInfo[playerid][PLAYER_PASS] == password;
	SendClientMessage(playerid, COLOUR_ORANGE, "You Are Now Registerd");
	OnPlayerRegister(playerid);
	}
	return 1;
}
Reply
#2

pawn Код:
//enum ?? { PLAYER_PASS[?] };
format(gPlayerInfo[playerid][PLAYER_PASS], ?, "%s", password);


enum blabla { PLAYER_PASS[128] };
new
   gPlayerInfo[MAX_PLAYERS][blabla];
format(gPlayerInfo[playerid][PLAYER_PASS], 128, "%s", password);

Reply
#3

That dident help at all so if someone could help that would be great
Reply
#4

Change
Код:
gPlayerInfo[playerid][PLAYER_PASS] == password;
To this:

Код:
strmid(gPlayerInfo[playerid][PLAYER_PASS],password, 0, strlen(password), 255);
Reply
#5

ok that worked but how would i go with adding that to my login command here is the code...
Код:
dcmd_login(playerid, params[])
{
  if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)
	{ 
  if(gPlayerInfo[playerid][PLAYER_LOGGED] == 0)
  {
	if(password2 == gPlayerInfo[playerid][PLAYER_PASS])
	{
	  gPlayerInfo[playerid][PLAYER_LOGGED] = 1;
	  SendClientMessage(playerid, COLOUR_LIGHTBLUE, "You have successfully logged in to your account.");
	  OnPlayerLogin(playerid);
	}
	else
	{
	  SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: Incorrect password.");
  }
	}
	else
	{
   SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You Are Alredy logged in.");
	}
	}
  else
  {
  SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: You must register first to do that! Use /register [password] to register and login.");
  }
}
Reply
#6

still need some help here thx for ur time
Reply
#7

Add this at the end of your code: http://pawn.pastebin.com/f263f249e

And:

pawn Код:
dcmd_login(playerid, params[])
{
  if(gPlayerInfo[playerid][PLAYER_REGGED] == 1)
  {
    if(gPlayerInfo[playerid][PLAYER_LOGGED] == 0)
    {
      new
        Password[81];

      if(sscanf(params, "s", Password)) return SendClientMessage(playerid, COLOR, "USAGE: /login [password]");
      else if(strmp(Password, gPlayerInfo[playerid][PLAYER_PASS], false) != 0) return SendClientMessage(playerid, COLOR, "ERROR: Incorrent password!");
      else
      {
        gPlayerInfo[playerid][PLAYER_LOGGED] = 1;
        SendClientMessage(playerid, COLOUR, "You have successfully logged into your account!");
        OnPlayerLogin(playerid);        
      }    
    }
    else SendClientMessage(playerid, COLOR, "ERROR: You are already logged in!");
  }
  else SendClientMessage(playerid, COLOR, "ERROR: You must register first to do that! Use /register [password] to register and login.");
  return 1;
}
Remember to load/save the password into the variable gPlayerInfo[playerid][PLAYER_PASS] when registering and connecting to the server.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)