30.08.2010, 21:37
Can someone can tell me why my command wont work ![Undecided](images/smilies/confused.gif)
![Undecided](images/smilies/confused.gif)
pawn Код:
COMMAND:sellhto(playerid,params[])
{
print("jedan");
new
id,
cijena,
string[128],
ime1[MAX_PLAYER_NAME],
ime2[MAX_PLAYER_NAME];
print("dva");
if (sscanf(params, "ud", id,cijena)) SendClientMessage(playerid, COLOR_GRAD4, "Koristi: /sellhto [ID] [Cijena]");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_GRAD4, "ERROR: Igrac nije online.");
else
{
GetPlayerName(playerid, ime1, MAX_PLAYER_NAME);
GetPlayerName(id, ime2, MAX_PLAYER_NAME);
print("tri");
if(!IsPlayerNearPlayer(playerid,id,10))
{
SCM(playerid,COLOR_GRAD4,"ERROR: Taj igrac nije blizu tebe.");
}
if(PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_WHITE, "[ERROR]: Moras posjedovati kucu kako bi je mogao prodati.");
return 1;
}
print("cetri");
if(PlayerInfo[playerid][pMarried] > 0)
{
SendClientMessage(playerid, COLOR_GREY, "[ERROR]: Nemozes prodati kucu jer si u braku.");
return 1;
}
print("pet");
if(PlayerInfo[playerid][pPhousekey] != 255 && strcmp(ime1, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
new house = PlayerInfo[playerid][pPhousekey];
if(cijena > HouseInfo[house][hValue] || cijena < 15000)
{
format(string, sizeof string,"[ERROR]: Maximalno %d$ i minimalno 15,000$",HouseInfo[house][hValue]);
SCM(playerid,COLOR_Text,string);
return 1;
}
print("sest");
if(PlayerInfo[id][pPhousekey] == 255 && strcmp(ime2, HouseInfo[PlayerInfo[id][pPhousekey]][hOwner], true) == 0)
{
SetPVarInt(id,"PonudaKuce",1);
SetPVarInt(id,"PonudivacKuce",playerid);
SetPVarInt(id,"PonudenaCijena",cijena);
format(string, sizeof string,"INFO: %s vam je ponudio kupnju kuce za %d$ napisi /prihvati da prihvatis. ",ime1,cijena);
SCM(id,COLOR_Text,string);
SetTimerEx("PonudaKuceKupnja",15000,0,"%d",id);
PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
format(string, sizeof string,"Ponudio si %s da kupi kucu za %d$",ime2,cijena);
SCM(playerid,COLOR_Text,string);
print("sedam");
}
else
{
SCM(playerid,COLOR_GRAD4,"[ERROR]: Taj igrac vec posjeduje kucu.");
print("osam");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "[ERROR]: Moras posjedovati kucu kako bi je mogao prodati.");
print("devet");
}
}
return 1;
}