Re: [TUT] Creating a Register System using Dini -
Eazy_Efolife - 11.10.2009
Quote:
Originally Posted by cepiokas
Some question about it.
1st - How to make, that server didn't spawn to play or let to do something ( type commands ), if you didn't logged in?
2nd - How to save your last X, Y and Z coordinates.
3rd - How to make, that you can save with pickup ( game saved just when, when you take a savedisket pickup )
Thanks.
|
1: it autosaves
2: If you want it to make it as, you must login first to spawn here is the code, put it under "OnPlayerSpawn"
Code:
if(gLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR, "SERVER: You have not logged in yet.");
return 1;
}
Re: [TUT] Creating a Register System using Dini -
cepiokas - 11.10.2009
Ok. It's autosaves. But i NEED to make, that it saves JUST by a command or pickup.
Re: [TUT] Creating a Register System using Dini -
Abernethy - 12.10.2009
Uh, what the fuck.
Code:
C:\Users\Madhouse\Desktop\Server\gamemodes\wif.pwn(366) : warning 203: symbol is never used: "ret_memcpy"
I searched, I couldn't find anything in my script which had ret_memcpy in it?
Re: [TUT] Creating a Register System using Dini -
Niixie - 07.12.2009
I used this Tutorial, and i'd like a tutorial where dcmd + sscanf is there to make the register and login command.
Re: [TUT] Creating a Register System using Dini -
Dodo9655 - 11.12.2009
Undefined Symbol "eadmin"
help!
Re: [TUT] Creating a Register System using Dini -
rong13 - 16.12.2009
i got error 3 warings
---------------------------
C:\Documents and Settings\шеп\My Documents\GTA San Andreas User Files\gta sa mp server\pawno\Untitled.pwn(20) : warning 217: loose indentation
C:\Documents and Settings\шеп\My Documents\GTA San Andreas User Files\gta sa mp server\pawno\Untitled.pwn(2
: warning 217: loose indentation
C:\Documents and Settings\шеп\My Documents\GTA San Andreas User Files\gta sa mp server\pawno\Untitled.pwn(41) : error 017: undefined symbol "eadmin"
C:\Documents and Settings\шеп\My Documents\GTA San Andreas User Files\gta sa mp server\pawno\Untitled.pwn(49) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
-----------------------------------
and here a pastebin if some 1 need
http://pastebin.com/f4606212f
Re: [TUT] Creating a Register System using Dini -
DeathOnaStick - 16.12.2009
Fixed.
pawn Code:
#include <a_samp>
#include <dini>
#include <dudb>
#define COLOR 0xFFFF00AA
#pragma unused ret_memcpy
//------------------------
new IsLogged[MAX_PLAYERS];
enum pInfo
{
AdminLevel,
Cash,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnPlayerDisconnect(playerid, reason)
{
IsLogged[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx, file[128], tmp[256], tmp2[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/register", true) == 0)
{
new name[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, name, sizeof(name));
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]");
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(tmp));
dini_IntSet(file,"AdminLevel", 0);
dini_IntSet(file,"Cash", 0);
SendClientMessage(playerid, COLOR, "[System]: Account Created!");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
GetPlayerName(playerid, name, sizeof(name));
printf("%s has registered a account!", name);
}
else
{
SendClientMessage(playerid, COLOR, " Account Already Found In Database");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
return 1;
}
if(strcmp(cmd, "/login", true) == 0)
{
new PlayerName[24];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /login [password]");
new name[MAX_PLAYER_NAME];
if(IsLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR, "You already are logged in!");
return 1;
}
else
{
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(fexist(file))
{
tmp2 = dini_Get(file, "Password");
if(udb_hash(tmp) != strval(tmp2))
{
SendClientMessage(playerid, COLOR, "Login Failed!");
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
printf("%s has failed to login", name);
}
else
{
IsLogged[playerid] = 1;
SetPlayerMoney(playerid, dini_Int(file, "Cash"));
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
SendClientMessage(playerid, COLOR, "[System]: Account Logged into!");
}
}
}
return 1;
}
return 0;
}
I hope it works =).
Cheerz.
Re: [TUT] Creating a Register System using Dini -
rong13 - 16.12.2009
tanks
Re: [TUT] Creating a Register System using Dini -
DeathOnaStick - 16.12.2009
You're welcome.
btw: Why is my code blue? XD
Re: [TUT] Creating a Register System using Dini -
LarzI - 16.12.2009
Because if includes, defines and pragmas on top.
Idk why it is that way, but it has always been like that :P
Re: [TUT] Creating a Register System using Dini -
rong13 - 16.12.2009
there is a bag
i do the register command
/register myid and i do enter and that continue
is not need the pass
and when i do login
/login myid
that do login
so what the bag pliz help
Re: [TUT] Creating a Register System using Dini -
rong13 - 16.12.2009
when i do register i register only a password
or its suppusd to register a id and pass
Re: [TUT] Creating a Register System using Dini -
Eazy_Efolife - 16.12.2009
Your password.
Re: [TUT] Creating a Register System using Dini -
rong13 - 16.12.2009
a ok now i get it
now i want make admin commands
look i these commands
_____________________
if ( strcmp( cmd, "/bring", true ) == 0 )
{
new tmp[256];
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) { return 1; }
new Float:X, Float:Y, Float:Z;
if ( GetPlayerVehicleID( strval(tmp) ) )
{
GetPlayerPos( playerid, X, Y, Z );
SetVehiclePos( GetPlayerVehicleID(strval(tmp)), X+2, Y+2, Z );
} else {
GetPlayerPos( playerid, X, Y, Z );
SetPlayerPos( strval(tmp), X+2, Y+2, Z );
}
return 1;
}
if ( strcmp( cmd, "/goto", true ) == 0 )
{
new tmp[256];
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) { return 1; }
new Float:X, Float:Y, Float:Z;
if ( GetPlayerVehicleID( playerid ) )
{
GetPlayerPos( strval(tmp), X, Y, Z );
SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
} else {
GetPlayerPos( strval(tmp), X, Y, Z );
SetPlayerPos( playerid, X+2, Y+2, Z );
}
return 1;
}
if(strcmp( cmd, "/vehicle", true ) == 0 )
{
new Float:X, Float:Y, Float:Z;
new tmp[256];
new created_vehicle_id;
tmp = strtok( cmdtext, idx );
GetPlayerPos( playerid, X, Y, Z );
created_vehicle_id = CreateVehicle( strval(tmp), X+2, Y+2, Z, 0, 0, 0, -1 );
new msg[256];
format(msg,256,"Created vehicle: %d",created_vehicle_id);
SendClientMessage(playerid,0xAAAAAAAA,msg);
return 1;
}
_____________________
and if i want to make it admin command i need to add
if isplayeradmin(playerid)
or some thing like that
pliz help me
Re: [TUT] Creating a Register System using Dini -
Eazy_Efolife - 16.12.2009
Use it like this:
Code:
if(PlayerInfo[playerid][AdminLevel] == 1) // Then your code
Re: [TUT] Creating a Register System using Dini -
rong13 - 16.12.2009
ok tanks
Re: [TUT] Creating a Register System using Dini -
admantis - 17.12.2009
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx, file[128], tmp[256], tmp2[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/register", true) == 0)
{
new name[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, name, sizeof(name));
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]");
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(tmp));
dini_IntSet(file,"Materials", 10);
dini_IntSet(file,"Cash", 10);
dini_IntSet(file,"Dead", 0);
SendClientMessage(playerid, COLOR_SYSTEM, "Account created!");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
GetPlayerName(playerid, name, sizeof(name));
printf("%s has registered a account!", name);
}
else
{
SendClientMessage(playerid, COLOR_SYSTEM, "[System]: Account already found in database!");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
return 1;
}
I have added Class, Materials, Dead and Money... so... I need a code so if the player deads the variable 'Dead' sets to True (1), and if the name is Dead you can't play in that account enymore.
If anyone can help me thanks
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
// What goes here?
return 1;
}
Code:
public OnPlayerConnect(playerid)
{
// And here?
return 1;
}
I hope you get me. thanks.
Re: [TUT] Creating a Register System using Dini -
Willstah - 20.12.2009
sweet fer noobs (like me)
easy to follow and very simple instructions
Re: [TUT] Creating a Register System using Dini -
Juve913 - 24.12.2009
Very Nice Guide For Any Class of Person
Re: [TUT] Creating a Register System using Dini -
LarzI - 24.12.2009
Remove the ';'