[POMOC]/DUTY

Započeo m-a-r-k-o, Avgust 04, 2011, 19:18:52 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

mod koji koristim:Raven's

Opis problema:problem je sa komandom /duty kad sam pd/fbi mogu otic na bilo koje mjestu na serveru onduty.

dio skripte:
if(strcmp(cmd, "/duty", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
if(PlayerInfo[playerid][pWanted] == 1) return SendClientMessage(playerid, COLOR_GREY, "* Criminals can not go on duty!");
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 3 || IsAFreecop(playerid))
{
if(PlayerInfo[playerid][pDBanned] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "* You are Banned from Cop Duty!");
return 1;
}
if (IsPlayerInRangeOfPoint(playerid, 6,255.3,77.4,1003.6) || IsPlayerInRangeOfPoint(playerid, 6,223.6328,186.8251,1003.0313) || IsPlayerInRangeOfPoint(playerid, 6, 233.4989,123.6518,1003.2188) || PlayerInfo[playerid][pLocal] != 255)
{
if(PlayerInfo[playerid][pDuty] == 0)
        {
            if(IsAFreecop(playerid))
            {
                format(string, sizeof(string), "* Voluntary %s uzima znacku i pistolj iz ormarica.", sendername);
                            ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SafeResetPlayerWeapons(playerid);
SafeGivePlayerWeapon(playerid, 41, 150);
SafeGivePlayerWeapon(playerid, 24, 70);
SafeGivePlayerWeapon(playerid, 3, 0);
SetPlayerColor(playerid,0xa9c4e400);
PlayerInfo[playerid][pDuty] = 1;
PlayerInfo[playerid][pChar] = 71;
new factionskin = PlayerInfo[playerid][pChar];
    SetPlayerSkin(playerid, factionskin);
return 1;
}
            if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
            {
    format(string, sizeof(string), "* Officer %s uzima znacku i pistolj iz ormarica.", sendername);
    SendClientMessage(playerid, COLOR_WHITE, "Upisi /equip,za opremu!");
    }
else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
            {
    format(string, sizeof(string), "* Agent %s uzima znacku i pistolj iz ormarica.", sendername);
    SendClientMessage(playerid, COLOR_WHITE, "Upisi /equip,za opremu!");
    }
else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
            {
    format(string, sizeof(string), "* Soldier %s uzima znacku i pistolj iz ormarica.", sendername);
    SendClientMessage(playerid, COLOR_WHITE, "Upisi /equip,za opremu!");
}
SendClientMessage(playerid, COLOR_WHITE,"* Ako zelis koristiti i tazer, Koristi /tazer");
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SafeResetPlayerWeapons(playerid);
SafeGivePlayerWeapon(playerid, 24, 70);
SafeGivePlayerWeapon(playerid, 3, 0);
PlayerInfo[playerid][pTazerBullets] = 20;
PlayerInfo[playerid][pDuty] = 1;
SetPlayerToTeamColor(playerid);
new factionskin = PlayerInfo[playerid][pChar];
    SetPlayerSkin(playerid, factionskin);
}
else if(PlayerInfo[playerid][pDuty] == 1)
{
    if(IsAFreecop(playerid))
    {
        format(string, sizeof(string), "* Voluntary %s uzima znacku i pistolj iz ormarica.", sendername);
        ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SafeResetPlayerWeapons(playerid);
PlayerInfo[playerid][pDuty] = 0;
SetPlayerColor(playerid, TEAM_HIT_COLOR);
new originalskin = PlayerInfo[playerid][pModel];
    SetPlayerSkin(playerid, originalskin);
return 1;
}
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
    {
        OnSwatDuty[playerid] = 0;
format(string, sizeof(string), "* Officer %s stavlja znacku i pistolj u ormaric.", sendername);
}
else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
{
    OnTacticalDuty[playerid] = 0;
    format(string, sizeof(string), "* Agent %s stavlja znacku i pistolj u ormaric.", sendername);
}
else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
            {
                OnSpecialFDuty[playerid] = 0;
    format(string, sizeof(string), "* Soldier %s stavlja znacku i pistolj u ormaric.", sendername);
}
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
SafeResetPlayerWeapons(playerid);
SafeSetPlayerArmour(playerid, 0);
SafeGivePlayerWeapon(playerid, 41, 500);
PlayerInfo[playerid][pDuty] = 0;
SetPlayerColor(playerid, TEAM_HIT_COLOR);
new originalskin = PlayerInfo[playerid][pModel];
    SetPlayerSkin(playerid, originalskin);
}
}
else SendClientMessage(playerid, COLOR_GRAD2, "** Nisi u sobi sa ormaricem !");
return 1;
}
else if(PlayerInfo[playerid][pMember] == 4||PlayerInfo[playerid][pLeader] == 4)
{
    if(!IsPlayerInRangeOfPoint(playerid, 3.0, 1222.1793,-1246.3489,1287.8243))
    {
        SendClientMessage(playerid, COLOR_GRAD1, "Ti nisi bolnicar!");
        return 1;
}
    if(JobDuty[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "* Vise niste na duznosti kao bolnicar.");
        JobDuty[playerid] = 0;
        Medics -= 1;
        SetPlayerColor(playerid, TEAM_HIT_COLOR);
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "* Sad ste na duznosti kao bolnicar.");
        JobDuty[playerid] = 1;
        Medics += 1;
    }
}
else if(PlayerInfo[playerid][pMember] == 12||PlayerInfo[playerid][pLeader] == 12)
{
    if(!IsPlayerInRangeOfPoint(playerid, 3.0, 2811.7837,-1167.3248,1025.5703))
    {
        SendClientMessage(playerid, COLOR_GRAD1, "Ti nisi vatrogasac!");
        return 1;
}
    if(JobDuty[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "* Vise niste na duznosti kao vatrogasac.");
        JobDuty[playerid] = 0;
        SetPlayerColor(playerid, TEAM_HIT_COLOR);
        SafeResetPlayerWeapons(playerid);
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "* Sad ste na duznosti kao vatrogasac.");
        JobDuty[playerid] = 1;
SetPlayerColor(playerid, 0xAA333300);
SafeGivePlayerWeapon(playerid, 42, 2500);
SafeGivePlayerWeapon(playerid, 6, 1);
    }
}
else if(PlayerInfo[playerid][pJob] == 17)
    {
        if(JobDuty[playerid] == 1)
        {
            SendClientMessage(playerid, COLOR_WHITE, "* Ti vise nisi na duznosti i vise neces dobivati pozive za pizza dostavu.");
            JobDuty[playerid] = 0;
            PizzaBoys -= 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "* Ti si na duznosti i dobivat ces pozive za pizza dostavu.");
            JobDuty[playerid] = 1;
        PizzaBoys += 1;
        GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string, sizeof(string), "[OGLAS] Pizza Vozac %s je sada na duznosti, /call 111 da narucis pizzu.", sendername);
    OOCNews(0xFF7E00AA,string);
}
}
else if(PlayerInfo[playerid][pJob] == 7)
{
    if(JobDuty[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "* Ti vise nisi na duznosti i vise neces dobivati pozive za pomoc.");
        JobDuty[playerid] = 0;
        Mechanics -= 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "* Ti si na duznosti i dobivat ces pozive za pomoc.");
        JobDuty[playerid] = 1;
        Mechanics += 1;
        GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string, sizeof(string), "[OLGAS] Automehanicar %s je na duznosti, /call 555 da nazoves automehanicara.", sendername);
    OOCNews(0x2993EDAA,string);
    }
}
else SendClientMessage(playerid, COLOR_GRAD1, "   Nisi Policajac !");

new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /duty",d,m,y,h,mi,s,sendername);
CommandLog(string);
}
return 1;
}

Nisam te najbolje razumeo. Koliko vidim iz skripte, ne bi si trebao moći otići OnDuty na bilokojem mestu. Ali ako možeš ići OnDuty bilogde, a to ne želiš, iz uslova: if (IsPlayerInRangeOfPoint(playerid, 6,255.3,77.4,1003.6) || IsPlayerInRangeOfPoint(playerid, 6,223.6328,186.8251,1003.0313) || IsPlayerInRangeOfPoint(playerid, 6, 233.4989,123.6518,1003.2188) || PlayerInfo[playerid][pLocal] != 255)

Makni ovo zadnje sa pLocal (iako se više ne sećam šta to radi).

Odnosno neka novi uslov izgleda ovako:
if (IsPlayerInRangeOfPoint(playerid, 6,255.3,77.4,1003.6) || IsPlayerInRangeOfPoint(playerid, 6,223.6328,186.8251,1003.0313) || IsPlayerInRangeOfPoint(playerid, 6, 233.4989,123.6518,1003.2188))

A ako ne možeš ići bilogde, a želiš bilogde, imenovani uslov zameni da izgleda na sledeći način:
if (1)

pLocal, to je varijabla (koja je jako bespotrebna) u GF modu, stavlja se igracu kad ulazi u interior i slicno, to bi bilo nesto kao Virtual World ili nesto slicno..
Aequam memento rebus in arduis servare mentem.