
#include <a_samp>
#include <dini>
new IsLogged[MAX_PLAYERS];
enum pInfo
{
}
new PlayerInfo[MAX_PLAYERS][pInfo];
enum pInfo
{
AdminLevel,
Cash,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
. Now were going to make a /register command etc.... Under "OnPlayerCommandText" add this: new cmd[256], idx, file[128], tmp[256], tmp2[256]; cmd = strtok(cmdtext, idx);
#include <dudb>
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, eadmin, "[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;
}
return 0;
}
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;
}
IsLogged[playerid] = 0;

if(gLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR, "SERVER: You have not logged in yet.");
Kick(playerid);
return 1;
}
new bool: IsLogged[MAX_PLAYERS];
|
Originally Posted by dirkblok
Hey, can you add something in your tutorial, how to save skins when you logout?
Very good tutorial, I like it Dirk |
SetPlayerMoney(playerid, dini_Int(file, "Cash"));
SetPlayerSkin(playerid, dini_Int(file, "Skin"));
dini_IntSet(file,"Skin", 50);
C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : warning 219: local variable "name" shadows a variable at a preceding level C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(179) : warning 204: symbol is assigned a value that is never used: "tmp2" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(179 -- 211) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(214) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(215) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(217) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(220) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(222) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(226) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(229) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(235) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(238) : error 021: symbol already defined: "SetPlayerMoney" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(238) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(238 -- 244) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(238 -- 244) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 13 Errors.
C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : warning 219: local variable "name" shadows a variable at a preceding level
error 021: symbol already defined: "SetPlayerMoney"
C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(179 -- 211) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(214) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(215) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(217) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(220) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(222) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(226) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(229) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(235) : error 010: invalid function or declaration
warning 204: symbol is assigned a value that is never used: "tmp2"
new name[MAX_PLAYER_NAME];
C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : error 017: undefined symbol "name" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : error 017: undefined symbol "name" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : error 029: invalid expression, assumed zero C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
GetPlayerName(playerid, name, sizeof(name));
|
Originally Posted by cepiokas
I'm just delete
Code:
new name[MAX_PLAYER_NAME]; Code:
C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : error 017: undefined symbol "name" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : error 017: undefined symbol "name" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : error 029: invalid expression, assumed zero C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(184) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. Code:
GetPlayerName(playerid, name, sizeof(name)); |
C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(179) : warning 204: symbol is assigned a value that is never used: "tmp2" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(179 -- 209) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(212) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(213) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(214) : error 021: symbol already defined: "name" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(215) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(218) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(220) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(224) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(227) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(233) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(236) : error 021: symbol already defined: "SetPlayerMoney" C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(236) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(236 -- 242) : error 010: invalid function or declaration C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(236 -- 242) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <dini>
#include <dudb>
#define eadmin 0x33660000
new IsLogged[MAX_PLAYERS];
enum pInfo
{
AdminLevel,
Cash,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
IsLogged[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
IsLogged[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
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, eadmin, "[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, eadmin, "[System]: 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, eadmin, "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, eadmin, "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, eadmin, "[System]: Account Logged into!");
}
}
}
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
return 0;
C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(492) : warning 203: symbol is never used: "ret_memcpy" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
|
Originally Posted by cepiokas
Ok. I found my own mistake. The problem was
Code:
return 0; Code:
C:\Documents and Settings\Samsung\Desktop\sLife v1.0\gamemodes\sLife.pwn(492) : warning 203: symbol is never used: "ret_memcpy" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning. |