PROBLEM -
Lajko1 - 21.12.2009
wooo guys i am so angry , i had zcmd + ''OnPlayerReciveCommand'' but it works great but it save all make file etc etc but when i type /login it login me but under that says ''SERVER Unknown Command'' and its anyoing same for /register this is realy crap and i was trying to fix and nothing work ... can u help me guys ?
here is now the command
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
dcmd(register, 8, cmdtext);
dcmd(login, 5, cmdtext);
return 0;
}
dcmd_register(playerid,params[])
{
// The command shouldn't work if we already are authed
if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid,0xFF9900AA,"[Account]:You Already Have Account");
// The command shouldn't work if an account with this
// nick already exists
if (udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid,0xFF9900AA,"[Account]:Account Already Exist, Use /login password");
// Did he forgot the password?
if (strlen(params)==0) return SendClientMessage(playerid,0xFF9900AA,"USAGE:/register [password]");
// We save the money to the accstate
if (udb_Create(PlayerName(playerid),params))
{
dUserSetINT(PlayerName(playerid)).("money",500);
dUserSetINT(PlayerName(playerid)).("score",0);
return SendClientMessage(playerid,0x33CCFFAA,"[Account]:Account Successfully Created! Use /login [password]");
}
return true;
}
dcmd_login(playerid,params[])
{
// The command shouldn't work if we already are authed
if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid,0xFF9900AA,"[Account]:You Are Already Loged In!");
// The command shouldn't work if an account with this
// nick does not exists
if (!udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid,0xFF9900AA,"[Account]:Account Doesn't Exist, Use /register [password] To Create A New Account!");
// Did he forgot the password?
if (strlen(params)==0) return SendClientMessage(playerid,0xFF9900AA,"USAGE:/register [password]");
if (udb_CheckLogin(PlayerName(playerid),params))
{
// Login was correct
// Following thing is the same like the missing SetPlayerCommand
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")-GetPlayerScore(playerid));
PLAYERLIST_authed[playerid]=true;
return SendClientMessage(playerid,0x33CCFFAA,"[Account]:You Are Now Loged In! Have Fun With Playing!");
}
// Login was incorrect
return SendClientMessage(playerid,0xFF9900AA,"[Account]:Login Faild! (Wrong Password)");
}
here are the commands , i dont use OnPlayerCommandText Yet cuz i must make /register and /login first ... all is ok but when i type /login or /register all works ok but than it says udner messages ''SERVER Unknown Command'' ... crap,can u help please ?
ty for any help
Re: PROBLEM -
Lajko1 - 21.12.2009
god can anyone help me ?
Re: PROBLEM -
Kurence - 21.12.2009
Oh, I dont use sampDB to create accounts.. I don't know what it is, but what is OnPlayerCommandRecieved?
Re: PROBLEM -
Lajko1 - 22.12.2009
a callback for using dcmd + zcmd commands ... so if anyone know how i can fix this ''Server Unknown Command'' error message please tell me
Re: PROBLEM -
[HiC]TheKiller - 22.12.2009
Just try
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(register, 8, cmdtext);
dcmd(login, 5, cmdtext);
return 0;
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
return 0;
}
dcmd_register(playerid,params[])
{
// The command shouldn't work if we already are authed
if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid,0xFF9900AA,"[Account]:You Already Have Account");
// The command shouldn't work if an account with this
// nick already exists
if (udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid,0xFF9900AA,"[Account]:Account Already Exist, Use /login password");
// Did he forgot the password?
if (strlen(params)==0) return SendClientMessage(playerid,0xFF9900AA,"USAGE:/register [password]");
// We save the money to the accstate
if (udb_Create(PlayerName(playerid),params))
{
dUserSetINT(PlayerName(playerid)).("money",500);
dUserSetINT(PlayerName(playerid)).("score",0);
return SendClientMessage(playerid,0x33CCFFAA,"[Account]:Account Successfully Created! Use /login [password]");
}
return true;
}
dcmd_login(playerid,params[])
{
// The command shouldn't work if we already are authed
if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid,0xFF9900AA,"[Account]:You Are Already Loged In!");
// The command shouldn't work if an account with this
// nick does not exists
if (!udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid,0xFF9900AA,"[Account]:Account Doesn't Exist, Use /register [password] To Create A New Account!");
// Did he forgot the password?
if (strlen(params)==0) return SendClientMessage(playerid,0xFF9900AA,"USAGE:/register [password]");
if (udb_CheckLogin(PlayerName(playerid),params))
{
// Login was correct
// Following thing is the same like the missing SetPlayerCommand
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")-GetPlayerScore(playerid));
PLAYERLIST_authed[playerid]=true;
return SendClientMessage(playerid,0x33CCFFAA,"[Account]:You Are Now Loged In! Have Fun With Playing!");
}
// Login was incorrect
return SendClientMessage(playerid,0xFF9900AA,"[Account]:Login Faild! (Wrong Password)");
}
Re: PROBLEM - Zeex - 22.12.2009
pawn Код:
/*Remove this:
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
}
and this:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
return 0;
}
*/
COMMAND:register(playerid,params[])
{
// The command shouldn't work if we already are authed
if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid,0xFF9900AA,"[Account]:You Already Have Account");
// The command shouldn't work if an account with this
// nick already exists
if (udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid,0xFF9900AA,"[Account]:Account Already Exist, Use /login password");
// Did he forgot the password?
if (strlen(params)==0) return SendClientMessage(playerid,0xFF9900AA,"USAGE:/register [password]");
// We save the money to the accstate
if (udb_Create(PlayerName(playerid),params))
{
dUserSetINT(PlayerName(playerid)).("money",500);
dUserSetINT(PlayerName(playerid)).("score",0);
return SendClientMessage(playerid,0x33CCFFAA,"[Account]:Account Successfully Created! Use /login [password]");
}
return true;
}
COMMAND:login(playerid,params[])
{
// The command shouldn't work if we already are authed
if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid,0xFF9900AA,"[Account]:You Are Already Loged In!");
// The command shouldn't work if an account with this
// nick does not exists
if (!udb_Exists(PlayerName(playerid))) return SendClientMessage(playerid,0xFF9900AA,"[Account]:Account Doesn't Exist, Use /register [password] To Create A New Account!");
// Did he forgot the password?
if (strlen(params)==0) return SendClientMessage(playerid,0xFF9900AA,"USAGE:/register [password]");
if (udb_CheckLogin(PlayerName(playerid),params))
{
// Login was correct
// Following thing is the same like the missing SetPlayerCommand
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")-GetPlayerScore(playerid));
PLAYERLIST_authed[playerid]=true;
return SendClientMessage(playerid,0x33CCFFAA,"[Account]:You Are Now Loged In! Have Fun With Playing!");
}
// Login was incorrect
return SendClientMessage(playerid,0xFF9900AA,"[Account]:Login Faild! (Wrong Password)");
}
And no more problems
Re: PROBLEM -
Lajko1 - 22.12.2009
THANK U GUYS FOR UR TIME AND HELP,Zex COMMAND WORK IF SOMEONE HAVE SAME PROBLEM ^^