SA-MP Forums Archive
1error command problem - 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: 1error command problem (/showthread.php?tid=230411)



1error command problem - Lethaal - 23.02.2011

ok so i have this cmd

Код:
public OnPlayerCommandText(playerid, cmdtext[],params[])
{

  if (strcmp("/register", cmdtext, true, 10) == 0)
	{
 	if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"{F81414}Your Already Registered!");
    if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"{F81414}Your Registered But Not Logged In Type /login [password]");
    if (strlen(params)==0) return SystemMsg(playerid,"{F81414}USAGE: /register [password]");
    if (udb_Create(PlayerName(playerid),params))
	{
	SystemMsg(playerid,"{6EF83C}Account Created! Now Use /login [password] To Login.");
	}
	}
  return 1;
}
and i get this error

Код:
C:\Users\Stephen-Laptop\Desktop\Samp Stunt Server\filterscripts\regsystem.pwn(110) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
please help thanks


Re: 1error command problem - deather - 23.02.2011

Why would you change the function parameters - OnPlayerCommandText(playerid, cmdtext[],params[])?

The header of the function - OnPlayerCommandText is

OnPlayerCommandText(playerid,cmdtext[])


Re: 1error command problem - Lethaal - 23.02.2011

Quote:
Originally Posted by deather
Посмотреть сообщение
Why would you change the function parameters - OnPlayerCommandText(playerid, cmdtext[],params[])?

The header of the function - OnPlayerCommandText is

OnPlayerCommandText(playerid,cmdtext[])
because then i get these errors

Код:
C:\Users\Stephen-Laptop\Desktop\Samp Stunt Server\filterscripts\regsystem.pwn(118) : error 017: undefined symbol "params"
C:\Users\Stephen-Laptop\Desktop\Samp Stunt Server\filterscripts\regsystem.pwn(119) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: 1error command problem - deather - 23.02.2011

You cannot modify predefined function headers simply because you get errors. When you get errors you have to blame yourself and try to correct your code rather than correcting the predefined ones.

And now for the error:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

  if (strcmp("/register", cmdtext, true, 10) == 0)
	{
 	if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"{F81414}Your Already Registered!");
    if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"{F81414}Your Registered But Not Logged In Type /login [password]");
    if (strlen(cmdtext)==0) return SystemMsg(playerid,"{F81414}USAGE: /register [password]");
    if (udb_Create(PlayerName(playerid),cmdtext))
	{
	SystemMsg(playerid,"{6EF83C}Account Created! Now Use /login [password] To Login.");
	}
	}
  return 1;
}



Re: 1error command problem - Lethaal - 23.02.2011

Quote:
Originally Posted by deather
Посмотреть сообщение
You cannot modify predefined function headers simply because you get errors. When you get errors you have to blame yourself and try to correct your code rather than correcting the predefined ones.

And now for the error:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{

  if (strcmp("/register", cmdtext, true, 10) == 0)
	{
 	if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"{F81414}Your Already Registered!");
    if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"{F81414}Your Registered But Not Logged In Type /login [password]");
    if (strlen(cmdtext)==0) return SystemMsg(playerid,"{F81414}USAGE: /register [password]");
    if (udb_Create(PlayerName(playerid),cmdtext))
	{
	SystemMsg(playerid,"{6EF83C}Account Created! Now Use /login [password] To Login.");
	}
	}
  return 1;
}
ok sorry im kinda new thanks

also just tested you can register without a pass like this /register

and it registers anyway 2 fix?


Re: 1error command problem - deather - 23.02.2011

You need to use strtok to extract the password the user types and if it doesnot exist then ask him to type. There are many registration systems in the forums. Grab a one using search and learn from it.


Re: 1error command problem - Lethaal - 23.02.2011

Quote:
Originally Posted by deather
Посмотреть сообщение
You need to use strtok to extract the password the user types and if it doesnot exist then ask him to type. There are many registration systems in the forums. Grab a one using search and learn from it.
couldnt i use something simlar to this??

Код:
if (strlen(params)<4) return SendClientMessage(playerid,red,"Password length must be greater than three characters");