[Scriptnig] Pravljenje Timova Za Server
Results 1 to 1 of 1
  1. #1
    Senior Member Array
    Join Date
    Mar 2011
    Location
    Banja Luka
    Karma
    17

    Default [Scriptnig] Pravljenje Timova Za Server

    PRAVLJENJE TIMOVA ZA VAS SERVER

    Da zapocnete sa pravljenjem timova za svoj server, otvorite svoj gamemod u pawnu. Tada odmah iznad OnGameModeInit() dodajte sledece:
    Code:
    new pTeam[MAX_PLAYERS]; // Varijabla koja save-uje igracev tim
    #define team_bad 2 // Definiste tim
    #define team_good 1 // Definise tim
    Sada cemo napraviti da je igracev tim odredjen njegovim skinom. Zato dodajemo sledece u OnPlayerSpawn(playerid):
    Code:
    new skin = GetPlayerSkin(playerid);
    if (skin == 101) //Promenite ID skina,ovo je samo za tutorial
    {
        pTeam[playerid] = team_bad;
        SetPlayerTeam(playerid, 2);
    }
    else if (skin == 286) //Promenite ID skina,ovo je samo za tutorial
    {
        pTeam[playerid] = team_good;
        SetPlayerTeam(playerid, 1); 
    }
    Ovo nam postavlja igraca sa skinom ID 101 u tim losih momaka,a ukoliko bi njegov skin bio ID 286 postavilo bi njegov tim na dobre momke.Sada komanda /mojtim.Ovo ide pod OnPlayerCommandText(playerid,cmdtext[]).
    Code:
    if (strcmp("/mojtim", cmdtext, true, 10) == 0)
    {
        if (pTeam[playerid] == team_bad)
        {
            SendClientMessage(playerid, 0xAA3333AA, "Vas tim je - Losi Momci");
        }
        else if (pTeam[playerid] == team_good)
        {
            SendClientMessage(playerid, 0xAA3333AA, "Vas tim je - Dobri Momci");
        }
        return 1;
    }
    Ova komanda proverava koji je igrac tim i salje obavestava igraca o tome. Sada,da bismo napravili chat za odredjeni tim,dodajemo ovo ispod:
    Code:
    if(text[0] == '!')
    {
    new name[24], string[256];
    GetPlayerName(playerid, name, 24);
    format(string, sizeof(string), "[TIM]%s: %s", name, text[1]);
    for(new c = 0; c < MAX_PLAYERS; c++)
    {
    if(IsPlayerConnected(c))
    {
    if(GetPlayerTeam(c) == GetPlayerTeam(playerid))
        SendClientMessage(c, GetPlayerColor(playerid), string);
        }
    }
    retrn 0;
    }
    Ovo proverava da li postoji znak "!" ispred texta,i ukoliko postoji poslace poruku koju ce videti samo igraci jednog tima!

    Credits: monkeypantzz
    Last edited by k@lu^; 16-04-2012 at 11:16.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •