SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/06/2012, 08:20 PM   #1
thefatshizms
High-roller
 
thefatshizms's Avatar
 
Join Date: Dec 2011
Location: England
Posts: 1,750
Reputation: 259
Default problem

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
__________________
SFCNR ******* | SFCNR Forum
thefatshizms is offline   Reply With Quote
Old 13/06/2012, 08:26 PM   #2
Drebin
High-roller
 
Drebin's Avatar
 
Join Date: Oct 2010
Posts: 1,103
Reputation: 567
Default AW: problem

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.
__________________


GamerX - The SA-MP legend.
Online since 2006.

188.165.219.63:8800
www.gamerxserver.com
Drebin is offline   Reply With Quote
Old 13/06/2012, 08:27 PM   #3
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,252
Reputation: 504
Default Re: problem

pawn Code:
PInfo[playerid[Ploged] =0;

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

Could easily been seen when using common sense.

pawn Code:
PInfo[playerid][Ploged] =0; // Here you go, correct way to make it.
Kindred is offline   Reply With Quote
Old 13/06/2012, 08:30 PM   #4
thefatshizms
High-roller
 
thefatshizms's Avatar
 
Join Date: Dec 2011
Location: England
Posts: 1,750
Reputation: 259
Default Re: problem

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:
pawn 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;
}
__________________
SFCNR ******* | SFCNR Forum
thefatshizms is offline   Reply With Quote
Old 13/06/2012, 09:21 PM   #5
Ray0
Little Clucker
 
Join Date: Jan 2009
Posts: 16
Reputation: 1
Default Re: problem

line 34:
pawn Code:
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.
pawn Code:
new pName, pScore, pKills;
Ray0 is offline   Reply With Quote
Old 13/06/2012, 09:29 PM   #6
thefatshizms
High-roller
 
thefatshizms's Avatar
 
Join Date: Dec 2011
Location: England
Posts: 1,750
Reputation: 259
Default Re: problem

ye sorted that out aslong with some other errors but i think i missed out a bracket and cause me to have 26 errors
__________________
SFCNR ******* | SFCNR Forum
thefatshizms is offline   Reply With Quote
Old 13/06/2012, 09:34 PM   #7
ViniBorn
Godfather
 
ViniBorn's Avatar
 
Join Date: Aug 2010
Location: Brasília
Posts: 5,313
Reputation: 720
Default Re: problem

pawn Code:
#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;
}
__________________



CONTATO: F A C E B O O K: @vinibornpawn

ViniBorn is offline   Reply With Quote
Old 13/06/2012, 09:40 PM   #8
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,252
Reputation: 504
Default Re: problem

pawn 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;
    }
    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"

pawn Code:
new name[MAX_PLAYERS];
Should be
pawn Code:
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.
Kindred is offline   Reply With Quote
Old 13/06/2012, 09:48 PM   #9
ViniBorn
Godfather
 
ViniBorn's Avatar
 
Join Date: Aug 2010
Location: Brasília
Posts: 5,313
Reputation: 720
Default Re: problem

Quote:
Originally Posted by Kindred View Post
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"

pawn Code:
new name[MAX_PLAYERS];
Should be
pawn Code:
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 ...

pawn Code:
#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;
}
__________________



CONTATO: F A C E B O O K: @vinibornpawn

ViniBorn is offline   Reply With Quote
Old 13/06/2012, 09:50 PM   #10
Kindred
High-roller
 
Join Date: Aug 2011
Posts: 1,252
Reputation: 504
Default AW: problem

Same. I downloaded it so I could compile as I do it.

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

pawn Code:
#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.
Kindred is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with time formatted message (or some other problem) CptK Scripting Help 0 02/06/2012 02:11 PM
Spawn Problem/Virtual World Problem Globe2009 Help Archive 5 05/11/2009 10:12 AM
SetVehicleHealth problem (Angle problem SOLVED) Paranoja Help Archive 5 03/08/2009 02:06 PM
problem with CWRP in linux (mysql problem) BSMan Server Support 1 16/06/2009 03:36 PM


All times are GMT. The time now is 10:23 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.