SA-MP Forums Archive
Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help (/showthread.php?tid=206002)



Help - Notorious29 - 02.01.2011

hel; i need thread with tut for me get learn to script a dialog register with save stats and a teleport command admin commands and with 3 faction


Re: Help - blackwave - 02.01.2011

Do you know which means "Search"? Well, then you could do it easily. Always: Click here [TUTORIAL SECTION]


Re: Help - Notorious29 - 02.01.2011

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, 1645.2598,-201.1026,13.9188, 277.277, 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 pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has joined the server", pname);
    SendClientMessageToAll(0xAAAAAAAA, string);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
        case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
        case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
    }
    SendClientMessageToAll(0xAAAAAAAA, string);
    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;

    new cmd[256], idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/makeadmin", true) == 0)
    {
            new string[128];
            new tmp[256];
            new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
            new giveplayerid;
            if (IsPlayerAdmin(playerid))
            {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                            SendClientMessage(playerid, ORANGE, "USAGE: /makeadmin [playerid] [level]");
                            SendClientMessage(playerid, ORANGE, "FUNCTION: Player will be an admin.");
                            return 1;
                    }
                    giveplayerid = ReturnUser(tmp);
                    tmp = strtok(cmdtext, idx);
                    new level = strval(tmp);
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, player, sizeof(player));
                            PlayerInfo[giveplayerid][AdminLevel] = level;
                            printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
                            format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level,  player);
                            SendClientMessage(giveplayerid, 0x00C2ECFF, string);
                            format(string, sizeof(string), "You have given %s level %d admin.",  giveplayer,PlayerInfo[giveplayerid][AdminLevel]);
                                    SendClientMessage(playerid, 0x00C2ECFF, string);
                    }
                    else if(giveplayerid == INVALID_PLAYER_ID)
                    {
                            format(string, sizeof(string), "%i is not an active player.", giveplayerid);
                            SendClientMessage(playerid, 0xE60000FF, string);
                    }
            }
            else
            {
                SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!");
            }
            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;
}
i have error but dnt kow how to fix am


here' error
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(204) : warning 225: unreachable code
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(204) : warning 217: loose indentation
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(205) : error 017: undefined symbol "strtok"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(205) : error 033: array must be indexed (variable "cmd")
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(214) : error 017: undefined symbol "strtok"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(214) : error 033: array must be indexed (variable "tmp")
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(217) : error 017: undefined symbol "ORANGE"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(21 : error 017: undefined symbol "ORANGE"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(221) : error 017: undefined symbol "ReturnUser"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(222) : error 017: undefined symbol "strtok"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(222) : error 033: array must be indexed (variable "tmp")
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(22 : error 017: undefined symbol "PlayerInfo"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(22 : warning 215: expression has no effect
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(22 : error 001: expected token: ";", but found "]"
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(22 : error 029: invalid expression, assumed zero
C:\Users\Charles\Desktop\Server\gamemodes\Airline. pwn(22 : fatal error 107: too many error messages on one line

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