Fix my errors :(
#3

pawn Код:
#include <a_samp>
#include <a_players>
#include <dini>

#define DIALOG_RULES 0
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2

main()
{
    print("\n----------------------------------");
    print(" Freeroam by Stunter");
    print("----------------------------------\n");
}


public OnGameModeInit()
{
    SetGameModeText("Freeroam");
    AddPlayerClass(23,1943.9281,-1383.6829,18.5781,145.8178,24,200,27,500,30,500); // Stunter
    AddStaticVehicle(522,1926.8888,-1415.0078,13.1452,3.9353,6,126); // stunter bikes
    AddStaticVehicle(522,1922.1050,-1414.4047,13.1421,7.9576,6,126); // stunter bikes
    AddStaticVehicle(522,1915.5049,-1415.3289,13.1489,8.5629,6,126); // stunter bikes
    AddStaticVehicle(522,1908.9871,-1415.2377,13.1436,4.8548,6,126); // stunter bikes
    AddStaticVehicle(522,1948.2291,-1377.4291,18.1489,149.6639,6,126); // stunter bikes
    AddStaticVehicle(522,1884.8481,-1371.0393,13.1280,235.3797,6,126); // stunter bikes

    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1950.6169,-1382.0916,24.1484);
    SetPlayerFacingAngle(playerid, 312.7043);
    SetPlayerCameraPos(playerid, 1954.4738,-1378.3209,24.1484);
    SetPlayerCameraLookAt(playerid, 1950.6169,-1382.0916,24.1484);
    return 1;
}

public OnPlayerConnect(playerid)
{
    new Playerdata[64];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Playerdata,sizeof(Playerdata),"/Accounts/%s.txt",name);
    if(dini_Exists(Playerdata))
    {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Enter your desired password here to login","Login", "Cancel");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registration", "Write here your desired password:", "Register", "Cancel");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    ShowPlayerDialog(playerid, DIALOG_RULES,DIALOG_STYLE_MSGBOX,"Rules","No Cheats or hack \n No Racism \n No Adversting others servers website or ip \n Respect players and admins \n Don't insult other players or admins \n Do not Spawnkill or Writekill \n Do not Spam.","Accept","Refuse");
    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[])
{
    if(dialogid == DIALOG_LOGIN)
    {
        if(response == 0)
        {
            Kick(playerid);
            SendClientMessage(playerid, 0x00FFFF0F,"Enter your true password or you get ban");
            return 1;
        }
   }
    if(dialogid == DIALOG_REGISTER)
    {
        if(response == 0)
        {
            SendClientMessage(playerid, 0x00FFFF0F, "You have to register your account to save your stats");
            Kick(playerid);
            return 1;
        }
        if(response == 1)
        {
            if(!strlen(inputtext))
            {
                SendClientMessage(playerid, 0xFF0000FF, "The password was not long enough");
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registration", "Write here your desired password:", "Register", "Cancel");
                return 1;
            }
            else
            {
            Register(playerid,inputtext);
            return 1;
            }
        }
    }
    if(dialogid == DIALOG_RULES)
    {
        if(response==0)
        {
            SendClientMessage(playerid, 0xFFFF00FF,"Have Fun");
        }
        if(response==1)
        {
            SendClientMessage(playerid, 0xFF00FFF0, "You have to accept server rules");
            Kick(playerid);
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

stock Register(playerid,key[])
{
    new Playerdata[64];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Playerdata,sizeof(Playerdata),"/Accounts/%s.txt",name);
    dini_Create(Playerdata);
    dini_Set(Playerdata,"Password",key);
    return 1;
}

stock Login(playerid,key[])
{
    new Playerdata(64);
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Playerdata,sizeof(Playerdata),"/Accounts/%s.txt",name);
    if(!strcmp(key,dini_Set(Playerdata,"Password",false)));
    {
        SetPlayerScore(playerid,dini_Int(playerdata,"Level"));
        SendClientMessage(playerid, 0xFF0000FF, "You have login successfully.").
    }
    else
    {
        SendClientMessage(playerid, 0x00FFFF00, "Wrong Password");
    }
    return 1;
}
Reply


Messages In This Thread
Fix my errors :( - by New Ilyass - 30.01.2011, 11:35
Re : Fix my errors :( - by New Ilyass - 30.01.2011, 11:42
Re: Fix my errors :( - by HyperZ - 30.01.2011, 11:43
Re: Fix my errors :( - by Ballu Miaa - 30.01.2011, 11:54

Forum Jump:


Users browsing this thread: 2 Guest(s)