PDA

View Full Version : problem


thefatshizms
13/06/2012, 08:20 PM
Hey!, i have a problem :/ im doing a admin system from a tutorial and i understand the tut fully but i got some errors, one of witch i have never encountered before

errors:
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(32) : error 028: invalid subscript (not an array or too many subscripts): "playerid"
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(32) : warning 215: expression has no effect
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(32) : error 001: expected token: ";", but found "]"
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(32) : error 029: invalid expression, assumed zero
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(32) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

here is the code: http://pastebin.com/3HeXbfPx

Drebin
13/06/2012, 08:26 PM
Dini is not a .pwn file. Dini is an include, and therefore is an .inc file and goes into the pawno/includes folder of your server.
I suggest you to do that.

Kindred
13/06/2012, 08:27 PM
PInfo[playerid[Ploged] =0;


Lol? Could this be the reason? You forgot a bracket (]).

Could easily been seen when using common sense.

PInfo[playerid][Ploged] =0; // Here you go, correct way to make it.

thefatshizms
13/06/2012, 08:30 PM
oops lol -_- anyway added the closing bracket

oh and drebin i know its a .inc file lol im not complete noob
edit: managed to get rid of some errors here is the errors


C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(34) : error 029: invalid expression, assumed zero
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(34) : error 017: undefined symbol "file"
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(34) : warning 215: expression has no effect
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(34) : error 001: expected token: ";", but found "]"
C:\Users\iphone\Desktop\SFCNR coding\filterscripts\Dini.pwn(34) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.

Ill post the new code:
#include <a_samp>
#include <Dini>
#include <zcmd>
#include <sscanf2>

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

enum gPInfo
{

Padmin,
Preg,
Ploged,
}
new PInfo[MAX_PLAYERS][gPInfo];


public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
PInfo[playerid][Padmin] =0;
PInfo[playerid][Preg] =0;
PInfo[playerid][Ploged] =0;

new name[MAX_PLAYERS];, file[256];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"FatAdmin/Users/%s.ini",name));

if(dini_Exists(file))
{
SendClientMessage(playerid, -1, "Your account has been loaded form our daterbase you may now /login");
PInfo[playerid][Preg] =1;
PInfo[playerid][Plog] =0;
return 1;
}
if(!dini_Exists(file))
{
SendClientMessage(playerid, -1, "You need to register");
PInfo[playerid][Preg] =0;
PInfo[playerid][Plog] =0;
return 1;
} }

public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYERS], file[256]
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini,name));
PInfo[playerid][Ploged] =0;
if(dini_Exists)
{
Dini_IntSet(file,Ploged,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[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
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;
}
CMD:reg(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name,MAX_PLAYER_NAME);
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name));
if(dini_Exists) return SendClientMessage(playerid, -1, "You have already registered!");
if(PInfo[playerid][Preg] ==1) return SendClientMessage(playerid, -1, "you have registered!");
if(PInfo[playerid]Ploged] ==1) return SendClientMessage(playerid, -1, "you have already loged in");
if(strlen(params))
{
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set("password",params);
dini_IntSet(file,"Preg",0);
dini_IntSet(file,"Plogged,0);
dini_IntSet(file,Padmin,0);
return SendClientMessage(playerid, -1, "congrats you registered");
PInfo[playerid][Preg] = 1;
}
else
{
SendClientMessage(playerid, -1, "USAGE: /reg <password>");
return 1;
}
return 1;
}
CMD:login(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(file, sizeof(file), "FatAdmin/Users/%s.ini",name);
if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
if(PInfo[playerid][Regged] == 0) return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
if(strlen(params))
{
new pass[256]
pass = dini_Get("password");
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0)
{
SendClientMessage(playerid,YELLOW,"Wrong Password!");
}
else
{
dini_IntSet(file,"Logged",1);
PInfo[playerid][Logged] = 1;
PInfo[playerid][Level] = dini_Int(file,"Level");
SendClientMessage(playerid,YELLOW,"You have now logged in!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
return 1;
}
return 1;
}
CMD:setlvl(playerid, params[])
{
new id;
new lvl;
new name[MAX_PLAYER_NAME]
new file
new string[128];
if(sscanf)params,"ui",id,lvl) return SendClientMessage(playerid, -1, "USAGE: /setlvl <id> <lvl>");
GetPlayerName(id,name,MAX_PLAYER_NAME);
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!")
if(!IsPlayerConnected(id) return SendClientMessage(playerid,-1,"invaild id");
PInfo[id][Padmin] =lvl;
dini_IntSet(file,"Padmin",lvl);
format(string, sizeof(string),"you have set %s to admin level %s",name,lvl);
SendClientMessage(playerid, -1,string);
return 1;
}

Ray0
13/06/2012, 09:21 PM
line 34:
new name[MAX_PLAYERS];, file[256];

Just take a close look at the line that the error is on and you should be able to see why it's giving an error.

hint: remember how to define multiple variables in 1 new statement e.g. new pName, pScore, pKills;

thefatshizms
13/06/2012, 09:29 PM
ye sorted that out aslong with some other errors but i think i missed out a bracket and cause me to have 26 errors

ViniBorn
13/06/2012, 09:34 PM
#include <a_samp>
#include <Dini>
#include <zcmd>
#include <sscanf2>

#define YELLOW 0xFFFF00AA
#define LIGHTBLUE 0x33CCFFFF
#define ORANGE 0xFF9900AA
#define GREY 0xAFAFAFAA

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

enum gPInfo
{
Padmin,
Preg,
Ploged,
Level
}
new PInfo[MAX_PLAYERS][gPInfo];

public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
PInfo[playerid][Padmin] =0;
PInfo[playerid][Preg] =0;
PInfo[playerid][Ploged] =0;

new name[MAX_PLAYERS], file[128];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"FatAdmin/Users/%s.ini",name);

if(dini_Exists(file))
{
SendClientMessage(playerid, -1, "Your account has been loaded form our daterbase you may now /login");
PInfo[playerid][Preg] =1;
PInfo[playerid][Ploged] =0;
return 1;
}
if(!dini_Exists(file))
{
SendClientMessage(playerid, -1, "You need to register");
PInfo[playerid][Preg] =0;
PInfo[playerid][Ploged] =0;
return 1;
}
return true;
}

public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYERS], file[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
PInfo[playerid][Ploged] = 0;
if(dini_Exists(file))
dini_IntSet(file,"Ploged",0);

return true;
}

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[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
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;
}
CMD:reg(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[128];
GetPlayerName(playerid, name,MAX_PLAYER_NAME);
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
if(dini_Exists(file)) return SendClientMessage(playerid, -1, "You have already registered!");
if(PInfo[playerid][Preg] == 1 ) return SendClientMessage(playerid, -1, "you have registered!");
if(PInfo[playerid][Ploged] == 1 ) return SendClientMessage(playerid, -1, "you have already loged in");
if(strlen(params))
{
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set(file,"password",params);
dini_IntSet(file,"Preg",0);
dini_IntSet(file,"Plogged",0);
dini_IntSet(file,"Padmin",0);
SendClientMessage(playerid, -1, "congrats you registered");
PInfo[playerid][Preg] = 1;
}
}
else
SendClientMessage(playerid, -1, "USAGE: /reg <password>");

return 1;
}
CMD:login(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[128];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(file, sizeof(file), "FatAdmin/Users/%s.ini",name);
if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
if(PInfo[playerid][Ploged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
if(PInfo[playerid][Preg] == 0) return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
if(strlen(params))
{
new pass[64];
format(pass,64,"%s",dini_Get(file,"password"));
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0)
{
SendClientMessage(playerid,YELLOW,"Wrong Password!");
}
else
{
dini_IntSet(file,"Logged",1);
PInfo[playerid][Ploged] = 1;
PInfo[playerid][Level] = dini_Int(file,"Level");
SendClientMessage(playerid,YELLOW,"You have now logged in!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
return 1;
}
return 1;
}
CMD:setlvl(playerid, params[])
{
new id, lvl;
new name[MAX_PLAYER_NAME],file[64], string[128];
if(sscanf(params,"ui",id,lvl)) return SendClientMessage(playerid, -1, "USAGE: /setlvl <id> <lvl>");
GetPlayerName(id,name,MAX_PLAYER_NAME);
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"invaild id");
PInfo[id][Padmin] =lvl;
dini_IntSet(file,"Padmin",lvl);
format(string, sizeof(string),"you have set %s to admin level %s",name,lvl);
SendClientMessage(playerid, -1,string);
return 1;
}

Kindred
13/06/2012, 09:40 PM
#include <a_samp>
#include <Dini>
#include <zcmd>
#include <sscanf2>

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

enum gPInfo
{
Padmin,
Preg,
Ploged
}
new PInfo[MAX_PLAYERS][gPInfo];


public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
PInfo[playerid][Padmin] = 0;
PInfo[playerid][Preg] = 0;
PInfo[playerid][Ploged] = 0;

new name[MAX_PLAYERS], file[256];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"FatAdmin/Users/%s.ini",name));

if(dini_Exists(file))
{
SendClientMessage(playerid, -1, "Your account has been loaded form our daterbase you may now /login");
PInfo[playerid][Preg] =1;
PInfo[playerid][Plog] =0;
return 1;
}
if(!dini_Exists(file))
{
SendClientMessage(playerid, -1, "You need to register");
PInfo[playerid][Preg] =0;
PInfo[playerid][Plog] =0;
return 1;
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256]
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini,name));
PInfo[playerid][Ploged] =0;
if(dini_Exists(file))
{
Dini_IntSet(file,Ploged,0);
return 1;
}
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[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
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;
}
CMD:reg(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name));
if(dini_Exists(file)) return SendClientMessage(playerid, -1, "You have already registered!");
if(PInfo[playerid][Preg] == 1) return SendClientMessage(playerid, -1, "you have registered!");
if(PInfo[playerid][Ploged] == 1) return SendClientMessage(playerid, -1, "you have already loged in");
if(strlen(params))
{
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set("password",params);
dini_IntSet(file,"Preg",0);
dini_IntSet(file,"Plogged,0);
dini_IntSet(file,Padmin,0);
return SendClientMessage(playerid, -1, "congrats you registered");
PInfo[playerid][Preg] = 1;
}
else
{
SendClientMessage(playerid, -1, "USAGE: /reg <password>");
return 1;
}
}
return 1;
}
CMD:login(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid,name, sizeof(name));
format(file, sizeof(file), "FatAdmin/Users/%s.ini",name);
if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
if(PInfo[playerid][Regged] == 0) return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
if(strlen(params))
{
new pass[256]
pass = dini_Get("password");
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0)
{
SendClientMessage(playerid,YELLOW,"Wrong Password!");
}
else
{
dini_IntSet(file,"Logged",1);
PInfo[playerid][Logged] = 1;
PInfo[playerid][Level] = dini_Int(file,"Level");
SendClientMessage(playerid,YELLOW,"You have now logged in!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
return 1;
}
return 1;
}
CMD:setlvl(playerid, params[])
{
new id;
new lvl;
new name[MAX_PLAYER_NAME];
new file;
new string[128];
if(sscanf(params,"ui",id,lvl)) return SendClientMessage(playerid, -1, "USAGE: /setlvl <id> <lvl>");
GetPlayerName(id,name,sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!")
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"invaild id");
PInfo[id][Padmin] = lvl;
dini_IntSet(file,"Padmin", lvl);
format(string, sizeof(string),"you have set %s to admin level %s", name, lvl);
SendClientMessage(playerid, -1,string);
return 1;
}


Viniborn's code is not fixed completely. I tried to fix them all. If you get more errors, post them here.

@Viniborn, some for example, is the variable "name"


new name[MAX_PLAYERS];

Should be

new name[MAX_PLAYER_NAME];

And so forth.

PS: You should really look through your script before posting for help. You forgot numerous brackets, numerous semicolons, and several mistypes (like stated, MAX_PLAYERS instead of MAX_PLAYER_NAME).

EDIT: Forgot the return 1; and closed bracket after OnPlayerDisconnect, fixed it.

EDIT2: Forgot something else as-well again. I should really keep an eye out while I edit.

ViniBorn
13/06/2012, 09:48 PM
Viniborn's code is not fixed completely. I tried to fix them all. If you get more errors, post them here.

@Viniborn, some for example, is the variable "name"


new name[MAX_PLAYERS];

Should be

new name[MAX_PLAYER_NAME];


It isn't an error, but it is a considerable waste of cells.
But, thanks for the tip

Looking quickly, I found about 30 errors.
Surely there must be more ...


#include <a_samp>
#include <Dini>
#include <zcmd>
#include <sscanf2>

#define YELLOW 0xFFFF00AA
#define LIGHTBLUE 0x33CCFFFF
#define ORANGE 0xFF9900AA
#define GREY 0xAFAFAFAA

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

enum gPInfo
{
Padmin,
Preg,
Ploged,
Level
}
new PInfo[MAX_PLAYERS][gPInfo];

public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
PInfo[playerid][Padmin] =0;
PInfo[playerid][Preg] =0;
PInfo[playerid][Ploged] =0;

new name[MAX_PLAYER_NAME], file[50];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"FatAdmin/Users/%s.ini",name);

if(dini_Exists(file))
{
SendClientMessage(playerid, -1, "Your account has been loaded form our daterbase you may now /login");
PInfo[playerid][Preg] =1;
PInfo[playerid][Ploged] =0;
return 1;
}
if(!dini_Exists(file))
{
SendClientMessage(playerid, -1, "You need to register");
PInfo[playerid][Preg] =0;
PInfo[playerid][Ploged] =0;
return 1;
}
return true;
}

public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[50];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
PInfo[playerid][Ploged] = 0;
if(dini_Exists(file))
dini_IntSet(file,"Ploged",0);

return true;
}

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[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
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;
}
CMD:reg(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[50];
GetPlayerName(playerid, name,MAX_PLAYER_NAME);
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
if(dini_Exists(file)) return SendClientMessage(playerid, -1, "You have already registered!");
if(PInfo[playerid][Preg] == 1 ) return SendClientMessage(playerid, -1, "you have registered!");
if(PInfo[playerid][Ploged] == 1 ) return SendClientMessage(playerid, -1, "you have already loged in");
if(strlen(params))
{
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set(file,"password",params);
dini_IntSet(file,"Preg",0);
dini_IntSet(file,"Plogged",0);
dini_IntSet(file,"Padmin",0);
SendClientMessage(playerid, -1, "congrats you registered");
PInfo[playerid][Preg] = 1;
}
}
else
SendClientMessage(playerid, -1, "USAGE: /reg <password>");

return 1;
}
CMD:login(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[50];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(file, sizeof(file), "FatAdmin/Users/%s.ini",name);
if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
if(PInfo[playerid][Ploged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
if(PInfo[playerid][Preg] == 0) return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
if(strlen(params))
{
new pass[64];
format(pass,64,"%s",dini_Get(file,"password"));
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0)
{
SendClientMessage(playerid,YELLOW,"Wrong Password!");
}
else
{
dini_IntSet(file,"Logged",1);
PInfo[playerid][Ploged] = 1;
PInfo[playerid][Level] = dini_Int(file,"Level");
SendClientMessage(playerid,YELLOW,"You have now logged in!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
return 1;
}
return 1;
}
CMD:setlvl(playerid, params[])
{
new id, lvl;
new name[MAX_PLAYER_NAME],file[50], string[128];
if(sscanf(params,"ui",id,lvl)) return SendClientMessage(playerid, -1, "USAGE: /setlvl <id> <lvl>");
GetPlayerName(id,name,MAX_PLAYER_NAME);
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"invaild id");
PInfo[id][Padmin] =lvl;
dini_IntSet(file,"Padmin",lvl);
format(string, sizeof(string),"you have set %s to admin level %s",name,lvl);
SendClientMessage(playerid, -1,string);
return 1;
}

Kindred
13/06/2012, 09:50 PM
Same. I downloaded it so I could compile as I do it.

Will edit this post when the new compiled script is finished.


#include <a_samp>
#include <Dini>
#include <zcmd>
#include <sscanf2>

#define YELLOW 0xFFFF00FF
#define LIGHTBLUE 0x00FFFFFF
#define ORANGE 0xFFA500FF
#define GREY 0x808080FF

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

enum gPInfo
{
Padmin,
Preg,
Ploged,
Level
}
new PInfo[MAX_PLAYERS][gPInfo];


public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
PInfo[playerid][Padmin] = 0;
PInfo[playerid][Preg] = 0;
PInfo[playerid][Ploged] = 0;

new name[MAX_PLAYERS], file[256];
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"FatAdmin/Users/%s.ini",name);

if(dini_Exists(file))
{
SendClientMessage(playerid, -1, "Your account has been loaded form our daterbase you may now /login");
PInfo[playerid][Preg] =1;
PInfo[playerid][Ploged] =0;
return 1;
}
if(!dini_Exists(file))
{
SendClientMessage(playerid, -1, "You need to register");
PInfo[playerid][Preg] =0;
PInfo[playerid][Ploged] =0;
return 1;
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini,name");
PInfo[playerid][Ploged] =0;
if(dini_Exists(file))
{
dini_IntSet(file,"PLoged",0);
return 1;
}
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[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
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;
}
CMD:reg(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
if(dini_Exists(file)) return SendClientMessage(playerid, -1, "You have already registered!");
if(PInfo[playerid][Preg] == 1) return SendClientMessage(playerid, -1, "you have registered!");
if(PInfo[playerid][Ploged] == 1) return SendClientMessage(playerid, -1, "you have already loged in");
if(strlen(params))
{
if(!dini_Exists(file))
{
dini_Create(file);
dini_Set(file,"password", params);
dini_IntSet(file,"Preg", 0);
dini_IntSet(file,"PLoged",0);
dini_IntSet(file,"Padmin",0);
PInfo[playerid][Preg] = 1;
return SendClientMessage(playerid, -1, "congrats you registered");
}
else
{
SendClientMessage(playerid, -1, "USAGE: /reg <password>");
return 1;
}
}
return 1;
}
CMD:login(playerid, params[])
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid,name, sizeof(name));
format(file, sizeof(file), "FatAdmin/Users/%s.ini",name);
if(!dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are not registered! Please /register");
if(PInfo[playerid][Ploged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already logged in!");
if(PInfo[playerid][Preg] == 0) return SendClientMessage(playerid,ORANGE,"You are not registered! Please /register");
if(strlen(params))
{
new pass[256];
pass = dini_Get(file, "password");
if(dini_Exists(file))
{
if(strcmp(params,pass,false) != 0)
{
SendClientMessage(playerid,YELLOW,"Wrong Password!");
}
else
{
dini_IntSet(file,"Logged",1);
PInfo[playerid][Ploged] = 1;
PInfo[playerid][Level] = dini_Int(file,"Level");
SendClientMessage(playerid,YELLOW,"You have now logged in!");
return 1;
}
}
}
else
{
SendClientMessage(playerid,GREY,"USAGE: /login <Password>");
return 1;
}
return 1;
}
CMD:setlvl(playerid, params[])
{
new id;
new lvl;
new name[MAX_PLAYER_NAME];
new file[128];
new string[128];
if(sscanf(params,"ui",id,lvl)) return SendClientMessage(playerid, -1, "USAGE: /setlvl <id> <lvl>");
GetPlayerName(id,name,sizeof(name));
format(file, sizeof(file),"FatAdmin/Users/%s.ini",name);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,GREY,"You are not an RCON admin!");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"invaild id");
PInfo[id][Padmin] = lvl;
dini_IntSet(file,"Padmin", lvl);
format(string, sizeof(string),"you have set %s to admin level %s", name, lvl);
SendClientMessage(playerid, -1,string);
return 1;
}


Untested, but compiled perfectly.

You need to script more, I had to fix nearly 60+ errors in that all together.

EDIT: Plus, learn to indent. Indented all of this.

JhnzRep
13/06/2012, 09:56 PM
Hey!, i have a problem :/ im doing a admin system from a tutorial and i understand the tut fully but i got some errors, one of witch i have never encountered before

Probably didn't understand it that well..

BTW, in my scripting experience I've learned debugging something is much harder then just re-writing it.

Deleted code is debugged code.

— Jeff Sickel

thefatshizms
14/06/2012, 05:36 PM
ok thanks guys soz about the indetation just being lazy yesterday lol