SA-MP Forums Archive
OnPlayerConnect (login/register) - 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: OnPlayerConnect (login/register) (/showthread.php?tid=90245)



OnPlayerConnect (login/register) - Antonio [G-RP] - 07.08.2009

I have an issue with my Script here...

CODE:

pawn Код:
public OnPlayerConnect
{
new playrname[MAX_PLAYER_NAME];
new connect[128];
GetPlayerName(playerid, playrname, sizeof(playrname));
format(connect, sizeof(connect), "%s.cer", playrname);
if(fexist(connect)) //line 108
{
gPlayerAccount[playerid] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "You are registered, please login with /login password");
}
return 1; //line 113
}
else //line 115
{
gPlayerAccount[playerid] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "You are new here or not registered, please register with /register password");
}
return 1; //line 120
}
ERRORS:

Код:
C:\Users\Lachlan\Desktop\Random Pawno\AntonioRP.pwn(108) : error 010: invalid function or declaration
C:\Users\Lachlan\Desktop\Random Pawno\AntonioRP.pwn(113) : error 010: invalid function or declaration
C:\Users\Lachlan\Desktop\Random Pawno\AntonioRP.pwn(115) : error 010: invalid function or declaration
C:\Users\Lachlan\Desktop\Random Pawno\AntonioRP.pwn(120) : error 010: invalid function or declaration
Thanks in Advance


Re: OnPlayerConnect (login/register) - [GM]The_Don - 07.08.2009

Код:
public OnPlayerConnect(playerid)
{
new playrname[MAX_PLAYER_NAME];
new connect[128];
GetPlayerName(playerid, playrname, sizeof(playrname));
format(connect, sizeof(connect), "%s.cer", playrname);
if(fexist(connect)) //line 108
{
gPlayerAccount[playerid] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "You are registered, please login with /login password");
}
return 1; //line 113
}
else //line 115
{
gPlayerAccount[playerid] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "You are new here or not registered, please register with /register password");
}
return 1; //line 120
}
try this ... you forgot the "(playerid)" after OnPlayerConnect.
The Function dont know, what playerid means, so its for him an invalid declaration


Re: OnPlayerConnect (login/register) - Antonio [G-RP] - 07.08.2009

Oh lol, sorry mate, I just copied the code and wrote that myself.

Basicly... same errors. Help please?


Re: OnPlayerConnect (login/register) - [GM]The_Don - 07.08.2009

Hmm ... why do you return 1; Twice? Oo


Re: OnPlayerConnect (login/register) - Antonio [G-RP] - 07.08.2009

LOLZ, Thanks mate. Credits going to you!