#1

[ame]http://www.youtube.com/watch?v=yTEIgHrXxW0[/ame]
In my gamemode no commands work. when i join it says register your account ect.. but if i try to do /register {pass}
It says sorry, you need to login / register to continue. Heres the code on register system / error message.
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------

Quote:

dcmd_register(playerid,params[]) {
new index = 0;
tmps1 = strtok(params, index);
GetPlayerName(playerid, playername, sizeof(playername));
if(!strlen(tmps1)) {
SendClientMessage(playerid, COLOR_CMD, "* USAGE: /register [password]. This will register your nick. Don't forget your password.");
return 1;
}
if(20 < strlen(tmps1) || strlen(tmps1) < 5) {
SendClientMessage(playerid, COLOR_SYSTEM_PW, "* Password length must be 5-20 symbols.");
return 1;
} else {
if (!dini_Exists(udb_encode(playername))) {
dini_Create(udb_encode(playername));
dini_IntSet(udb_encode(playername), "password", udb_hash(tmps1));
dini_IntSet(udb_encode(playername), "newplayer", 1);
format(strings, sizeof(strings), "%s --- %s (id: %d) created account. Passwordhash: %s.", SystemTime,playername, playerid,udb_hash(tmps1));
printf(strings);
format(strings, sizeof(strings), "* Account named %s created! You can login with password %s.", playername, tmps1);
SendClientMessage(playerid, COLOR_SYSTEM_PM, strings);
if(spawned[playerid]){
GameTextForPlayer(playerid, "~w~ You are not logged in! type /login", 120000, 3);
LoginTimeout[playerid]=60;
}
} else {
format(strings, sizeof(strings), "* %s is already registered.", playername,tmps1);
SendClientMessage(playerid, COLOR_SYSTEM_PW, strings);
}
}
return 1;
}

------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------

Quote:

f(logged[playerid] == 0){
dcmd(help,4,cmdtext);
dcmd(register,8,cmdtext);
dcmd(login,5,cmdtext);
dcmd(accounthelp,11,cmdtext);
return SendClientMessage(playerid,COLOR_MENU,"* You need to login before other commands are available. Check /accounthelp for the available commands.");

------------------------------------------------------------------------------------------------------------

Anyone can help? =/
Reply
#2

Please use the [PAWN] tags when posting your code, they can be really helpful and let us who's trying to help you and other people 'see the code more clearly'.

pawn Код:
example
Reply
#3

Anyone? Please :/
Reply
#4

The problem is somewhere else, I think you have disabled of the ability of making any command before logging in. Search for the text it says when you /register [pass] and paste the code function.
Reply
#5

search first the strtok or string that u give properly?
Reply
#6

Quote:

SetPlayerInterior(playerid,3);
SetPlayerFacingAngle(playerid, 90);
SetCameraBehindPlayer(playerid);
SetPlayerPos(playerid, notLoggedSpawn[0], notLoggedSpawn[1], notLoggedSpawn[2]);
spawned[playerid] = 1;
GameTextForPlayer(playerid, "~w~ You require an account! type /register", 120000, 3);
SendClientMessage(playerid, COLOR_SYSTEM_PM, "* Before you can play, you need to register. You can type /register <your password>.");
SendClientMessage(playerid, COLOR_SYSTEM_PM, "* After successful registration, identify yourself using /login <your password>.");
SendClientMessage(playerid, COLOR_SYSTEM_PM, "* This server saves your progress(money, frags, etc).");
LoginTimeout[playerid]=60;
return 1;
}

Quote:

////////////Not logged or spawned/////////////
if(spawned[playerid] == 1){
GetPlayerName(playerid,playername,sizeof(playernam e));
if (dini_Exists(udb_encode(playername))) {
if(logged[playerid] == 0) {
LoginTimeout[playerid]--;
if( LoginTimeout[playerid] == 50 ||
LoginTimeout[playerid] == 40 ||
LoginTimeout[playerid] == 30 ||
LoginTimeout[playerid] == 20 ||
LoginTimeout[playerid] == 10 ){
//Bekende gebruiker, niet ingelogd.
SendClientMessage(playerid, COLOR_GREENYELLOW, "* You are not logged in. Type /login <password> to login.");
SendClientMessage(playerid, COLOR_GREENYELLOW, "* Note that you will receive your spawn weapons at your next spawn (next time you have died).");
format(strings,sizeof(strings),"~w~You have %d seconds to login. type /login", LoginTimeout[playerid]);
GameTextForPlayer(playerid, strings, 120000, 3);
}
if(LoginTimeout[playerid] == 1) {
SendClientMessage(playerid, COLOR_GREENYELLOW, "* You failed to login. The connection to the server will be disconnected.");
}
if(LoginTimeout[playerid] == 0) {
//Niet ingelogd binnen de minuut, kick
format(strings,sizeof(strings),"* Player %s failed to login within the 60 seconds period.",playername);
SendClientMessageToAll(COLOR_SYSTEM_GW, strings);
Kick(playerid);
}
}
} else {
LoginTimeout[playerid]--;
if( LoginTimeout[playerid] == 50 ||
LoginTimeout[playerid] == 40 ||
LoginTimeout[playerid] == 30 ||
LoginTimeout[playerid] == 20 ||
LoginTimeout[playerid] == 10 ){
//Niet bekende gebruiker, niet ingelogd.
SendClientMessage(playerid, COLOR_GREENYELLOW, "* You need to create an account on this server. Type /register <password> to do so.");
format(strings,sizeof(strings),"~w~You have %d seconds to register. type /register", LoginTimeout[playerid]);
GameTextForPlayer(playerid, strings, 120000, 3);
}
if(LoginTimeout[playerid] == 1) {
//Niet geregistreerd binnen de minuut, kick
SendClientMessage(playerid, COLOR_GREENYELLOW, "* You failed to register. The connection to the server will be disconnected.");
}
if(LoginTimeout[playerid] == 0) {
format(strings,sizeof(strings),"* Player %s failed to register within the 60 seconds period.",playername);
SendClientMessageToAll(COLOR_SYSTEM_GW, strings);
Kick(playerid);
}

?
Reply
#7

EDIT: Added Video.
Reply
#8

When you spawn, do you actually call the variable Spawn[playerid]?
If not:
pawn Код:
public OnPlayerSpawn(playerid)
{
spawned[playerid] = 1;
return 1;
}
Note: indent the code above, lazy to copy & paste it into notepad
Reply
#9

No i dont have that added could you tell me how onplayerconnect? thx
Reply
#10

Well, if you spawned you dont have the spawned[playerid] = 1;. In your register command you need to have "spawned[playerid] == 1", so if you didnt change spawned[playerid] in the callback OnPlayerSpawn, youre not alowed to use the command register.
Add under OnPlayerSpawn: spawned[playerid] = 1;, and your problem might be solved.

Edit: You just edited your post, didnt saw that.
Post the WHOLE OnPlayerSpawn, OnPlayerConnect and the register command.
Also, use the [ pawn ] [ /pawn ] tags, so we can read it proprely. (Without the spaces ofcourse)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)