[POMOC]Komanda

Započeo Aldin Begovic, April 03, 2012, 01:18:39 PRE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

mod:moj gm
opis problema: Kada kucam /kupifirmu kaze da vec posjedujem firmu ! Greska je u pvaru ali neznam kako da postavim

COMMAND:kupifirmu(playerid, params[])
{
#pragma unused params
new string[ 128 ], stringt[64];
new bouse = GetPVarInt(playerid, "Firma");
if( bouse != 255 || GetPVarInt(playerid, "Firma") != 255)
{
SendClientMessage( playerid, WHITE, "*Vec posjedujes firmu." );
return 1;
}
if( bouse == 255 || GetPVarInt(playerid, "Firma") == 255)

Ovaj dio koda:

if( bouse != 255 || GetPVarInt(playerid, "Firma") != 255)
{
SendClientMessage( playerid, WHITE, "*Vec posjedujes firmu." );
return 1;
}


Bi trebao izgledati ovako (po tvom sadašnjem kodu):

if(GetPVarInt(playerid, "Firma") == 255)
{
SendClientMessage( playerid, WHITE, "*Vec posjedujes firmu." );
return 1;
}


I ova bouse varijabla je nepotrebna - tako da je možeš izbrisati iz komande.
Poslednja Izmena: April 03, 2012, 10:39:05 PRE PODNE od Joey_

Last nick: Paradox

Citat: Joey_ poslato April 03, 2012, 10:38:24 PRE PODNE
Ovaj dio koda:

if( bouse != 255 || GetPVarInt(playerid, "Firma") != 255)
{
SendClientMessage( playerid, WHITE, "*Vec posjedujes firmu." );
return 1;
}


Bi trebao izgledati ovako (po tvom sadašnjem kodu):

if(GetPVarInt(playerid, "Firma") == 255)
{
SendClientMessage( playerid, WHITE, "*Vec posjedujes firmu." );
return 1;
}


I ova bouse varijabla je nepotrebna - tako da je možeš izbrisati iz komande.
Sada kad kucam /kupifirmu ne izbacuje nista niti hoce da kupi :??? sta ne valja u komandi
COMMAND:kupifirmu(playerid, params[])
{
#pragma unused params
new string[ 128 ], stringt[64];
if(GetPVarInt(playerid, "Firma") == 255)
{
SendClientMessage( playerid, WHITE, "*Vec posjedujes firmu." );
return 1;
}
if(GetPVarInt(playerid, "Firma") == 255)
{
for(new b = 0; b < sizeof(Businesses); b++)
{
    if(IsPlayerInRangeOfPoint( playerid, 5, Businesses[b][bExteriorX], Businesses[b][bExteriorY], Businesses[b][bExteriorZ]) )
    {
        if(strcmp(Businesses[b][bOwner1], "Niko", true) == 0 )
{
if(Businesses[b][bPrice] == -1)
{
    SendClientMessage( playerid, WHITE, "*Zao nam je ova firma nije na prodaji." );
}
else
{
    if( GetPlayerMoney(playerid) >= Businesses[b][bPrice] && GetPVarInt(playerid, "Level") >= Businesses[b][bLevel])
    {
new sendername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(Businesses[b][bOwner1], sendername, 0, strlen(sendername), 255);
        GivePlayerMoney(playerid, -Businesses[b][bPrice]);
format( stringt, sizeof( stringt ), "~y~Kupili ste firmu za: ~g~%d$", Businesses[b][bPrice]);
                            SetPVarInt(playerid, "Firma",b);
Businesses[b][bOwnedd] = 1;
OnPropTextdrawUpdate();
SaveBusiness( b );

  if(Businesses[b][bType] == 1)
{
ShowPlayerDialog(playerid, PRODAVNICAMENU, DIALOG_STYLE_LIST, "{FF0000}Odaberi Interijer - {FFFF00}24/7 Supermarket","{0080C0}Interijer 1\n{0080C0}Interijer 2\n{0080C0}Interijer 3", "Odaberi", "Ponisti");
return 1;
}
if(Businesses[b][bType] == 2)
{
ShowPlayerDialog(playerid, CLOTHMENU, DIALOG_STYLE_LIST, "Odaberi interijer - {FFFF00}Clothes Shop","{0080C0}Binco\n{0080C0}Didier Sachs\n{0080C0}Sub Urban\n{0080C0}Victim \n{0080C0}ZIP", "Odaberi", "Ponisti");
return 1;
}
if(Businesses[b][bType] == 7)
{
ShowPlayerDialog(playerid, 4891, DIALOG_STYLE_LIST, "{FF0000}Odaberi Interijer - {FFFF00}Gun Shop","{0080C0}Interijer 1\n{0080C0}Interijer 2\n{0080C0}Interijer 3\n{0080C0}Interijer 4", "Odaberi", "Ponisti");
return 1;
}
if(Businesses[b][bType] == 10)
{
ShowPlayerDialog(playerid, 5105, DIALOG_STYLE_LIST, "{FF0000}Odaberi Interijer - {FFFF00}Teretana","{0080C0}Interijer 1\n{0080C0}Interijer 2\n{0080C0}Interijer 3", "Odaberi", "Ponisti");
return 1;
}
if(Businesses[b][bType] == 3)
{
ShowPlayerDialog(playerid, 8504, DIALOG_STYLE_LIST, "{FF0000}Odaberi Interijer - Kafana","{0080C0}Interijer 1\n{0080C0}Interijer 2\n{0080C0}Interijer 3", "Odaberi", "Ponisti");
return 1;
}
if(Businesses[b][bType] == 4)
{
ShowPlayerDialog(playerid, 8958, DIALOG_STYLE_LIST, "{FF0000}Odaberi Interijer - {FFFF00}Restoran","{0080C0}Interijer 1\n{0080C0}Interijer 2", "Odaberi", "Ponisti");
return 1;
}
if(Businesses[b][bType] == 5)
{
Businesses[b][bInteriorX] = - 100.42053222656;
Businesses[b][bInteriorY] = -24.546438217163;
Businesses[b][bInteriorZ] = 1000.71875;
Businesses[b][bInteriorID] = 3;
SaveBusiness( b );
return 1;
}
if(Businesses[b][bType] == 6)
{
Businesses[b][bInteriorX] = 363.72998046875;
Businesses[b][bInteriorY] = -74.745864868164;
Businesses[b][bInteriorZ] = 1001.5078125;
Businesses[b][bInteriorID] = 10;
SaveBusiness( b );
return 1;
}
if(Businesses[b][bType] == 8)
{
Businesses[b][bInteriorX] = 365.03305053711;
Businesses[b][bInteriorY] = -11.412439346313;
Businesses[b][bInteriorZ] = 1001.8515625;
Businesses[b][bInteriorID] = 9;
SaveBusiness( b );
return 1;
}
if(Businesses[b][bType] == 9)
{
Businesses[b][bInteriorX] = 493.4958190918;
Businesses[b][bInteriorY] = -24.089570999146;
Businesses[b][bInteriorZ] = 1000.6796875;
Businesses[b][bInteriorID] = 17;
SaveBusiness( b );
return 1;
}
        SaveBusiness( b );

    }
    else
    {
        SendClientMessage( playerid, WHITE, "*Nemas dovoljno novca da kupis ovu firmu ili nemas dovoljno veliki level." );
    }
    }
}
    }
}
for(new b = 0; b < sizeof(SBusinesses); b++)
{
    if(IsPlayerInRangeOfPoint( playerid, 5, SBusinesses[b][sbExteriorX], SBusinesses[b][sbExteriorY], SBusinesses[b][sbExteriorZ]) )
    {
        if(strcmp(SBusinesses[b][sbOwner1], "Niko", true) == 0 )
{
if(SBusinesses[b][sbPrice] == -1)
{
    SendClientMessage( playerid, WHITE, "*Zao nam je ova firma nije na prodaji." );
}
else
{
    if( GetPlayerCash(playerid) >= SBusinesses[b][sbPrice] &&  GetPVarInt(playerid, "Level") >= SBusinesses[b][sbLevel])
    {
new sendername[MAX_PLAYER_NAME];
format( stringt, sizeof( stringt ), "~y~Kupili ste firmu za: ~g~%d$", SBusinesses[b][sbPrice]);
        GetPlayerName(playerid, sendername, sizeof(sendername));
strmid(SBusinesses[b][sbOwner1], sendername, 0, strlen(sendername), 255);
        GivePlayerMoney(playerid, -SBusinesses[b][sbPrice]);
        format( string, sizeof( string ), "Cestitamo! Sada ste vlasnik: %s.", SBusinesses[b][sbName] );
        SendClientMessage( playerid, ANNOUNCEMENT, string);
        SetPVarInt(playerid, "Firma",b);
SBusinesses[b][sbOwnedd] = 1;
OnPropTextdrawUpdate();
SaveSBusiness( b );
    }
    else
    {
        SendClientMessage( playerid, WHITE, "*Nemas dovoljno novca da kupis ovu firmu ili nemas dovoljno veliki level." );
    }
    }
}
else
{
    SendClientMessage( playerid, WHITE, "*Zao nam je ova firma nije na prodaji!" );
}
    }
}
}
return 1;
}

Umjesto ovog:

if(GetPVarInt(playerid, "Firma") == 255)
{
for(new b = 0; b < sizeof(Businesses); b++)


Stavi ovo:

if(GetPVarInt(playerid, "Firma") != 255)
{
for(new b = 0; b < sizeof(Businesses); b++)

Last nick: Paradox

hwala brate radi ! Slabo znam sa ovim pvarovima pa non stop me zeza !hwala i wozdra

Ništa i drugi put. ;)

Problem riješen - LOCK.

Last nick: Paradox