1error command problem
#1

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
Reply
#2

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

The header of the function - OnPlayerCommandText is

OnPlayerCommandText(playerid,cmdtext[])
Reply
#3

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.
Reply
#4

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;
}
Reply
#5

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?
Reply
#6

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.
Reply
#7

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");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)