Need Help Plz - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need Help Plz (
/showthread.php?tid=125317)
Need Help Plz -
sggassasin - 03.02.2010
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;
}
Re: Need Help Plz -
smeti - 03.02.2010
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);
Re: Need Help Plz -
sggassasin - 04.02.2010
That dident help at all so if someone could help that would be great
Re: Need Help Plz -
Eazy_Efolife - 04.02.2010
Change
Код:
gPlayerInfo[playerid][PLAYER_PASS] == password;
To this:
Код:
strmid(gPlayerInfo[playerid][PLAYER_PASS],password, 0, strlen(password), 255);
Re: Need Help Plz -
sggassasin - 04.02.2010
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.");
}
}
Re: Need Help Plz -
sggassasin - 05.02.2010
still need some help here thx for ur time
Re: Need Help Plz -
Miguel - 05.02.2010
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.