Erros in script
#1

I need help with this the error i dnt know how to fix

pawn Код:
// 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 color 0x00FFFFAA
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COL_EASY           "{FFF1AF}"
#define COLOR_YELLOW 0xFFFF00AA
#define COL_WHITE          "{FFFFFF}"
#define COL_BLACK          "{0E0101}"
#define COL_GREY           "{C3C3C3}"
#define COL_GREEN          "{6EF83C}"
#define COL_RED            "{F81414}"
#define COL_YELLOW         "{F3FF02}"
#define COL_ORANGE         "{FFAF00}"
#define COL_LIME           "{B7FF00}"
#define COL_CYAN           "{00FFEE}"
#define COL_LIGHTBLUE      "{00C0FF}"
#define COL_BLUE           "{0049FF}"
#define COL_MAGENTA        "{F300FF}"
#define COL_VIOLET         "{B700FF}"
#define COL_PINK           "{FF00EA}"
#define COL_MARONE         "{A90202}"
#define COL_CMD            "{B8FF02}"
#define COL_PARAM          "{3FCD02}"
#define COL_SERVER         "{AFE7FF}"
#define COL_VALUE          "{A3E4FF}"
#define COL_RULE           "{F9E8B7}"
#define COL_RULE2          "{FBDF89}"
#define COL_RWHITE         "{FFFFFF}"
#define COL_LGREEN         "{C9FFAB}"
#define COL_LRED           "{FFA1A1}"
#define COL_LRED2          "{C77D87}"
#define MAKE_COLOUR(%0,%1,%2) ((((%0) & 0xFF) << 16) | (((%1) & 0xFF) << 8) | (((%2) & 0xFF) << 0))
#define MAKE_COLOUR_AA(%0,%1,%2) ((((%0) & 0xFF) << 24) | (((%1) & 0xFF) << 16) | (((%2) & 0xFF) << 8) | 0xAA)
#define MAKE_COLOUR_ALPHA(%0,%1,%2,%3) ((((%0) & 0xFF) << 24) | (((%1) & 0xFF) << 16) | (((%2) & 0xFF) << 8) | (((%3) & 0xFF) << 0))

#define COLOUR_RED         MAKE_COLOUR(255, 0, 0)
#define COLOUR_GREEN       MAKE_COLOUR(0, 255, 0)
#define COLOUR_BLUE        MAKE_COLOUR(0, 0, 255)

#define COLOUR_CYAN_AA     MAKE_COLOUR_AA(0, 255, 255)
#define COLOUR_MAGENTA_AA  MAKE_COLOUR_AA(255, 0, 255)
#define COLOUR_YELLOW_AA   MAKE_COLOUR_AA(255, 255, 0)

#define BLACK_ALPHA        MAKE_COLOUR_ALPHA(0, 0, 0, 170) // 170 == 0xAA
#define WHITE_ALPHA        MAKE_COLOUR_ALPHA(255, 255, 255, 255)



main()
{
    print("\n----------------------------------");
    print(" Airlines by Tom");
    print("----------------------------------\n");
}


public OnGameModeInit()
{
    // Misc
    SetGameModeText("Airlines");
    //Class
    AddPlayerClass(255, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    //Cars
    AddStaticVehicle(608,1879.2600,-2401.2256,14.0886,1.5656,1,1); // stairs 1
    AddStaticVehicle(608,1877.2349,-2401.3079,14.0823,357.6205,1,1); // stair 2
    AddStaticVehicle(608,1869.9978,-2400.7791,14.0860,354.5709,1,1); // stair 3
    AddStaticVehicle(608,1875.4689,-2401.2971,14.0867,357.9840,1,1); // stair 4
    AddStaticVehicle(608,1872.5348,-2400.9446,14.0839,353.2430,1,1); // stair 5
    AddStaticVehicle(416,1934.6772,-2248.0476,13.6993,173.8238,1,3); // ambulance 1
    AddStaticVehicle(416,1930.0858,-2247.5081,13.6957,179.7971,1,3); // ambulance 2
    AddStaticVehicle(416,1926.1385,-2248.2830,13.6958,179.2902,1,3); // ambulance 3
    AddStaticVehicle(416,1921.3673,-2247.7832,13.6993,178.9306,1,3); // ambulance 4
    AddStaticVehicle(416,1917.3853,-2248.1794,13.6963,184.1634,1,3); // ambulance 5
    AddStaticVehicle(416,1913.4570,-2247.9443,13.6957,181.8982,1,3); // ambulance 6
    AddStaticVehicle(416,1909.3033,-2247.8630,13.6962,184.9742,1,3); // ambulance 7
    AddStaticVehicle(416,1905.6031,-2247.8091,13.6963,184.8825,1,3); // ambulance 8
    AddStaticVehicle(544,1995.3147,-2297.1028,13.7820,91.8021,3,1); // firetruck 1
    AddStaticVehicle(544,1994.8412,-2300.7241,13.7839,91.2975,3,1); // firetruck 2
    AddStaticVehicle(544,1994.7474,-2304.2795,13.7824,93.3867,3,1); // firetruck 3
    AddStaticVehicle(544,1994.6123,-2308.0220,13.7811,91.8051,3,1); // firetruck 4
    AddStaticVehicle(544,1994.5581,-2311.3313,13.7827,90.3123,3,1); // firetruck 5
    AddStaticVehicle(544,1994.7583,-2314.8208,13.7827,88.3501,3,1); // firetruck 6

    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)
{
new name[MAX_PLAYER_NAME];
    new file[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"/Users/%s.ini",name);
    if(!fexist(file))
    {
    SendClientMessage(playerid,color, "[SA-BOT] You arent registered! type /register to save your stats!");
    logged[playerid] = 0;
    }
    if(fexist(file))
    {
    SendClientMessage(playerid,color, "[SA-BOT] You are registered! type /login [pass]!!");
    }
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
new file[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"/Users/%s.ini",name);
    if(dini_Exists(file))
    {
  dini_IntSet(file, "score", PlayerInfo[playerid][score]);
  dini_IntSet(file, "money", PlayerInfo[playerid][cash]);
  dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel]);
    }
    logged[playerid] = 0;
    dcmd(register, 8, cmdtext);
    dcmd(login, 5, cmdtext);
    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("//afk", cmdtext, true) == 0)
    {
        new pName[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string, sizeof(string), "--> %s is AFK.", pName);
        SendClientMessageToAll(COLOR_YELLOW, string);
        TogglePlayerControllable(playerid, 0);
        SetPlayerHealth(playerid, 999999999.99);
        return 1;
    }
    if(strcmp("//back", cmdtext, true) == 0)
    {
        new pName[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string, sizeof(string), "--> %s is now back.", pName);
        SendClientMessageToAll(COLOR_YELLOW, string);
        TogglePlayerControllable(playerid, 1);
        SetPlayerHealth(playerid, 100);
        return 1;
    }
    if (strcmp("/lv", cmdtext, true, 10) == 0) //<--- This and the SetPlayerPos will make you teleport to Las Venturas for Example.
    {
        SetPlayerPos(playerid, 1282.6499,1267.8385,10.8203);
        // Now If you want to show a message you put this:
        SendClientMessage(playerid,color,"You have teleport to Las Ventura");
        //Sometimes you need a Virtual World Numberfor some interiors. When you for example want to teleport to an Original Interior of SanAndreas, you should follow the Command this:
        SetPlayerInterior(playerid, 0);
        return 1;
    }
    if (strcmp("/sf", cmdtext, true, 10) == 0) //<--- This and the SetPlayerPos will make you teleport to Las Venturas for Example.
    {
        SetPlayerPos(playerid, -1645.2598,-201.1026,13.9188);
        // Now If you want to show a message you put this:
        SendClientMessage(playerid,color,"You have teleport to San Ferro");
        //Sometimes you need a Virtual World Numberfor some interiors. When you for example want to teleport to an Original Interior of SanAndreas, you should follow the Command this:
        SetPlayerInterior(playerid,0);
        return 1;
    }
    if (strcmp("/ls", cmdtext, true, 10) == 0) //<--- This and the SetPlayerPos will make you teleport to Las Venturas for Example.
    {
        SetPlayerPos(playerid, 1527.3297,-2455.9033,13.5547);
        // Now If you want to show a message you put this:
        SendClientMessage(playerid,color,"You have teleport to Los Santos");
        //Sometimes you need a Virtual World Numberfor some interiors. When you for example want to teleport to an Original Interior of SanAndreas, you should follow the Command this:
        SetPlayerInterior(playerid,0);
        return 1;
    }
    if (strcmp("/help", cmdtext, true) == 0)
    {
        SendClientMessage(playerid,color,"Something here");
        SendClientMessage(playerid,color,"Something here");
        SendClientMessage(playerid,color,"Something here");
        return 1;
    }
    if (strcmp("/commands", cmdtext, true) == 0)
    {
        SendClientMessage(playerid,color,"[SA-BOT]:");
        SendClientMessage(playerid,color,"[SA-BOT]");
        SendClientMessage(playerid,color,"[SA-BOT]");
        SendClientMessage(playerid,color,"[SA-BOT]");
        return 1;
    }
    dcmd_register(playerid, params[])
{
  new file[128], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "\\Users\\%s.ini", pname);
  if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: /register [password]");
  if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: You are already registered!");
  dini_Create(file);
  dini_IntSet(file, "hashPW", udb_hash(params));
  dini_Set(file, "password", params);
  dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
  dini_IntSet(file, "score", PlayerInfo[playerid][score] = 0);
  dini_IntSet(file, "money", PlayerInfo[playerid][cash] = 500);
  new string[128];
  format(string, 128, "[SA-BOT]: You succesfully registered the nickname %s with password %s", pname, params);
  SendClientMessage(playerid, COLOR_YELLOW, string);
  logged[playerid] = 1;
  SendClientMessage(playerid, COLOR_YELLOW, "[SA-BOT]: You have been automatically logged in!");
  {
  dcmd_login(playerid, params[])
{
  new file[128];
  new string[MAX_STRING], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "\\Users\\%s.ini", pname);
  if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: /login [password]");
  if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: You are not registered!");
  if(logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: You are already logged in!");
  new tmp;
  tmp = dini_Int(file, "hashPW");
  if(udb_hash(params) != tmp)
  {
    format(string, 256, "You specified the wrong password for %s!", pname);
    SendClientMessage(playerid, COLOR_RED, string);
  }
  else
  {
    logged[playerid] = 1;
    PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
    SetPlayerScore(playerid, PlayerInfo[playerid][score]);
    new lebel = PlayerInfo[playerid][AdminLevel];
    GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid));
    format(string, 256, "[SA-BOT]: Successfully logged in! (level: %d)!", lebel);
        SendClientMessage(playerid,COLOR_RED, string);
    printf("%s (%i) logged in with password %s", pname, playerid, params);
  }
  return 1;}
  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;
}

And here the error someone please help



C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(10 : warning 217: loose indentation
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(114) : error 017: undefined symbol "logged"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(114) : warning 215: expression has no effect
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(114) : error 001: expected token: ";", but found "]"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(114) : error 029: invalid expression, assumed zero
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(114) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

ON Top:
pawn Код:
new logged;
or

pawn Код:
new logged[MAX_PLAYERS];
Reply
#3

SetGameModeText("Airlines");
//Class
AddPlayerClass(255, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);?
Reply
#4

it not working
Reply
#5

I suggest using
pawn Код:
if(GetPVarInt(playerid, "PlayerLogged") == 1)
Reply
#6

where to put that
Reply
#7

It's all bugged man
Reply
#8

Use GetPVar instead of "logged" to make it easier for you
https://sampwiki.blast.hk/wiki/GetPVarInt
it's not only for being logged in or not but it works good.
Reply
#9

it was working fine antil i add that register piece
Reply
#10

pawn Код:
// 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 color 0x00FFFFAA
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COL_EASY           "{FFF1AF}"
#define COLOR_YELLOW 0xFFFF00AA
#define COL_WHITE          "{FFFFFF}"
#define COL_BLACK          "{0E0101}"
#define COL_GREY           "{C3C3C3}"
#define COL_GREEN          "{6EF83C}"
#define COL_YELLOW         "{F3FF02}"
#define COL_ORANGE         "{FFAF00}"
#define COL_LIME           "{B7FF00}"
#define COL_CYAN           "{00FFEE}"
#define COL_LIGHTBLUE      "{00C0FF}"
#define COL_BLUE           "{0049FF}"
#define COL_MAGENTA        "{F300FF}"
#define COL_VIOLET         "{B700FF}"
#define COL_PINK           "{FF00EA}"
#define COL_MARONE         "{A90202}"
#define COL_CMD            "{B8FF02}"
#define COL_PARAM          "{3FCD02}"
#define COL_SERVER         "{AFE7FF}"
#define COL_VALUE          "{A3E4FF}"
#define COL_RULE           "{F9E8B7}"
#define COL_RULE2          "{FBDF89}"
#define COL_RWHITE         "{FFFFFF}"
#define COL_LGREEN         "{C9FFAB}"
#define COL_LRED           "{FFA1A1}"
#define COL_LRED2          "{C77D87}"
#define MAKE_COLOUR(%0,%1,%2) ((((%0) & 0xFF) << 16) | (((%1) & 0xFF) << 8) | (((%2) & 0xFF) << 0))
#define MAKE_COLOUR_AA(%0,%1,%2) ((((%0) & 0xFF) << 24) | (((%1) & 0xFF) << 16) | (((%2) & 0xFF) << 8) | 0xAA)
#define MAKE_COLOUR_ALPHA(%0,%1,%2,%3) ((((%0) & 0xFF) << 24) | (((%1) & 0xFF) << 16) | (((%2) & 0xFF) << 8) | (((%3) & 0xFF) << 0))

#define COLOUR_RED         MAKE_COLOUR(255, 0, 0)
#define COLOR_RED         MAKE_COLOUR(255, 0, 0)
#define COLOUR_GREEN       MAKE_COLOUR(0, 255, 0)
#define COLOUR_BLUE        MAKE_COLOUR(0, 0, 255)

#define COLOUR_CYAN_AA     MAKE_COLOUR_AA(0, 255, 255)
#define COLOUR_MAGENTA_AA  MAKE_COLOUR_AA(255, 0, 255)
#define COLOUR_YELLOW_AA   MAKE_COLOUR_AA(255, 255, 0)

#define BLACK_ALPHA        MAKE_COLOUR_ALPHA(0, 0, 0, 170) // 170 == 0xAA
#define WHITE_ALPHA        MAKE_COLOUR_ALPHA(255, 255, 255, 255)

new logged[MAX_PLAYERS];

main()
{
    print("\n----------------------------------");
    print(" Airlines by Tom");
    print("----------------------------------\n");
}

enum pInfo
{
    score,
    cash,
    AdminLevel
};
new PlayerInfo[MAX_PLAYERS][pInfo];

public OnGameModeInit()
{
    // Misc
    SetGameModeText("Airlines");
    //Class
    AddPlayerClass(255, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    //Cars
    AddStaticVehicle(608,1879.2600,-2401.2256,14.0886,1.5656,1,1); // stairs 1
    AddStaticVehicle(608,1877.2349,-2401.3079,14.0823,357.6205,1,1); // stair 2
    AddStaticVehicle(608,1869.9978,-2400.7791,14.0860,354.5709,1,1); // stair 3
    AddStaticVehicle(608,1875.4689,-2401.2971,14.0867,357.9840,1,1); // stair 4
    AddStaticVehicle(608,1872.5348,-2400.9446,14.0839,353.2430,1,1); // stair 5
    AddStaticVehicle(416,1934.6772,-2248.0476,13.6993,173.8238,1,3); // ambulance 1
    AddStaticVehicle(416,1930.0858,-2247.5081,13.6957,179.7971,1,3); // ambulance 2
    AddStaticVehicle(416,1926.1385,-2248.2830,13.6958,179.2902,1,3); // ambulance 3
    AddStaticVehicle(416,1921.3673,-2247.7832,13.6993,178.9306,1,3); // ambulance 4
    AddStaticVehicle(416,1917.3853,-2248.1794,13.6963,184.1634,1,3); // ambulance 5
    AddStaticVehicle(416,1913.4570,-2247.9443,13.6957,181.8982,1,3); // ambulance 6
    AddStaticVehicle(416,1909.3033,-2247.8630,13.6962,184.9742,1,3); // ambulance 7
    AddStaticVehicle(416,1905.6031,-2247.8091,13.6963,184.8825,1,3); // ambulance 8
    AddStaticVehicle(544,1995.3147,-2297.1028,13.7820,91.8021,3,1); // firetruck 1
    AddStaticVehicle(544,1994.8412,-2300.7241,13.7839,91.2975,3,1); // firetruck 2
    AddStaticVehicle(544,1994.7474,-2304.2795,13.7824,93.3867,3,1); // firetruck 3
    AddStaticVehicle(544,1994.6123,-2308.0220,13.7811,91.8051,3,1); // firetruck 4
    AddStaticVehicle(544,1994.5581,-2311.3313,13.7827,90.3123,3,1); // firetruck 5
    AddStaticVehicle(544,1994.7583,-2314.8208,13.7827,88.3501,3,1); // firetruck 6

    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)
{
    new name[MAX_PLAYER_NAME];
    new file[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"/Users/%s.ini",name);
    if(!fexist(file))
    {
        SendClientMessage(playerid,color, "[SA-BOT] You arent registered! type /register to save your stats!");
        logged[playerid] = 0;
    }
    if(fexist(file))
    {
        SendClientMessage(playerid,color, "[SA-BOT] You are registered! type /login [pass]!!");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new file[128];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"/Users/%s.ini",name);
    if(dini_Exists(file))
    {
        dini_IntSet(file, "score", PlayerInfo[playerid][score]);
        dini_IntSet(file, "money", PlayerInfo[playerid][cash]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel]);
    }
    logged[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[])
{
    dcmd(register, 8, cmdtext);
    dcmd(login, 5, cmdtext);
    if (strcmp("//afk", cmdtext, true) == 0)
    {
        new pName[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string, sizeof(string), "--> %s is AFK.", pName);
        SendClientMessageToAll(COLOR_YELLOW, string);
        TogglePlayerControllable(playerid, 0);
        SetPlayerHealth(playerid, 999999999.99);
        return 1;
    }
    if(strcmp("//back", cmdtext, true) == 0)
    {
        new pName[MAX_PLAYER_NAME];
        new string[128];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string, sizeof(string), "--> %s is now back.", pName);
        SendClientMessageToAll(COLOR_YELLOW, string);
        TogglePlayerControllable(playerid, 1);
        SetPlayerHealth(playerid, 100);
        return 1;
    }
    if (strcmp("/lv", cmdtext, true, 10) == 0) //<--- This and the SetPlayerPos will make you teleport to Las Venturas for Example.
    {
        SetPlayerPos(playerid, 1282.6499,1267.8385,10.8203);
        // Now If you want to show a message you put this:
        SendClientMessage(playerid,color,"You have teleport to Las Ventura");
        //Sometimes you need a Virtual World Numberfor some interiors. When you for example want to teleport to an Original Interior of SanAndreas, you should follow the Command this:
        SetPlayerInterior(playerid, 0);
        return 1;
    }
    if (strcmp("/sf", cmdtext, true, 10) == 0) //<--- This and the SetPlayerPos will make you teleport to Las Venturas for Example.
    {
        SetPlayerPos(playerid, -1645.2598,-201.1026,13.9188);
        // Now If you want to show a message you put this:
        SendClientMessage(playerid,color,"You have teleport to San Ferro");
        //Sometimes you need a Virtual World Numberfor some interiors. When you for example want to teleport to an Original Interior of SanAndreas, you should follow the Command this:
        SetPlayerInterior(playerid,0);
        return 1;
    }
    if (strcmp("/ls", cmdtext, true, 10) == 0) //<--- This and the SetPlayerPos will make you teleport to Las Venturas for Example.
    {
        SetPlayerPos(playerid, 1527.3297,-2455.9033,13.5547);
        // Now If you want to show a message you put this:
        SendClientMessage(playerid,color,"You have teleport to Los Santos");
        //Sometimes you need a Virtual World Numberfor some interiors. When you for example want to teleport to an Original Interior of SanAndreas, you should follow the Command this:
        SetPlayerInterior(playerid,0);
        return 1;
    }
    if (strcmp("/help", cmdtext, true) == 0)
    {
        SendClientMessage(playerid,color,"Something here");
        SendClientMessage(playerid,color,"Something here");
        SendClientMessage(playerid,color,"Something here");
        return 1;
    }
    if (strcmp("/commands", cmdtext, true) == 0)
    {
        SendClientMessage(playerid,color,"[SA-BOT]:");
        SendClientMessage(playerid,color,"[SA-BOT]");
        SendClientMessage(playerid,color,"[SA-BOT]");
        SendClientMessage(playerid,color,"[SA-BOT]");
        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;
}

dcmd_register(playerid, params[])
{
  new file[128], pname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pname, sizeof(pname));
  format(file, sizeof(file), "\\Users\\%s.ini", pname);
  if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: /register [password]");
  if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: You are already registered!");
  dini_Create(file);
  dini_IntSet(file, "hashPW", udb_hash(params));
  dini_Set(file, "password", params);
  dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
  dini_IntSet(file, "score", PlayerInfo[playerid][score] = 0);
  dini_IntSet(file, "money", PlayerInfo[playerid][cash] = 500);
  new string[128];
  format(string, 128, "[SA-BOT]: You succesfully registered the nickname %s with password %s", pname, params);
  SendClientMessage(playerid, COLOR_YELLOW, string);
  logged[playerid] = 1;
  SendClientMessage(playerid, COLOR_YELLOW, "[SA-BOT]: You have been automatically logged in!");
  return 1;
}

dcmd_login(playerid, params[])
{
    new file[128];
    new string[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "\\Users\\%s.ini", pname);
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: /login [password]");
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: You are not registered!");
    if(logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "[SA-BOT]: You are already logged in!");
    new tmp;
    tmp = dini_Int(file, "hashPW");
    if(udb_hash(params) != tmp)
    {
        format(string, 256, "You specified the wrong password for %s!", pname);
        SendClientMessage(playerid, COLOR_RED, string);
    }
    else
    {
        logged[playerid] = 1;
        PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
        SetPlayerScore(playerid, PlayerInfo[playerid][score]);
        new lebel = PlayerInfo[playerid][AdminLevel];
        GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid));
        format(string, 256, "[SA-BOT]: Successfully logged in! (level: %d)!", lebel);
        SendClientMessage(playerid,COLOR_RED, string);
        printf("%s (%i) logged in with password %s", pname, playerid, params);
    }
    return 1;
}
All fixed man, next time 20€ :P
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)