no cmds or dini work
#1

Hi, i have some code (no errors) but the cmds neither the dini bits work in-game

pawn Код:
#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;
}
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}
try removing that
Reply
#3

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}
try removing that
Thank you So Much <3
Reply
#4

haha no problem
Reply
#5

Still dont work D:

edit: Ah seems that my sscanf plugin is failing... how i fix this?
Reply
#6

Update your sscanf include and complie your gamemode with that , after update your sscanf plugin too. To run sscanf you will need .net Framework and VC Redist... make sure you have these installed.
Reply
#7

got it all.
Reply
#8

ive tried re-downloading sscanf but it still fails
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)