09.06.2014, 19:18
Hi everyone. I have a little problem with this code
When i write /sellzone id price it shows me this "Player with this id isnt found"
So what could be the problem?
P.S Tested with my friend, not alone
pawn Код:
if(!strcmp(cmd, "/sellzone", true))
{
if(GetOrganizationType(PlayerInfo[playerid][pMember]) != 2 && GetOrganizationType(PlayerInfo[playerid][pMember]) != AZTECAS_GANG) return SendClientMessage(playerid, COLOR_GREEN, "You are not in any gang");
if(PlayerInfo[playerid][pLeader] == 0) return SendClientMessage(playerid, COLOR_GREEN, "You have to be leader to sell zone");
if(PlayerInfo[playerid][pGiveBohka] > 0) return SendClientMessage(playerid, COLOR_GREEN, "When you are in prison you cannot sell your zone");
if(PlayerCuffed[playerid] || PlayerTied[playerid]) return SendClientMessage(playerid, COLOR_GREEN, "While you are cuffed or tied you cannot sell your zone");
new bool:gangzone;
for(new i=0; i<MAX_GANGZONE; i++)
{
if(PlayerInBox(playerid, GangZoneInfo[i][gzPos][0], GangZoneInfo[i][gzPos][1], GangZoneInfo[i][gzPos][2], GangZoneInfo[i][gzPos][3]) && GangZoneInfo[i][gzGang] == PlayerInfo[playerid][pMember] && !ZoneOnBattle[i])
{
gangzone = true;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREEN, "» Use: /sellzone [ leader id ] [ price ]");
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREEN, "» Use: /sellzone [ leader id ] [ price ]");
new price = strval(tmp);
if(price < 1000 || price > 1000000) return SendClientMessage(playerid, COLOR_GREEN, "You entered wrong price. Use from 1000$ дto 1000000$");
if(IsPlayerConnected(giveplayerid)) return MSG_NOTPLAYER(playerid);
if(playerid == giveplayerid) return MSG_NOMEACT(playerid);
if(GetOrganizationType(PlayerInfo[giveplayerid][pMember]) != 2) return SendClientMessage(playerid, COLOR_GREEN, "This player isnt leader of any gang");
if(price > GetPlayerMoneyEx(giveplayerid)) return SendClientMessage(playerid, COLOR_GREEN, "He doesnt have money");
f(string, "You offered player {9DDAF2}%s{FFFFFF} (gang leader {9DDAF2}%s{FFFFFF}) to buy zone for {9DDAF2}%d$", PlayerNameEx[giveplayerid], GetOrganizationName(PlayerInfo[giveplayerid][pMember]), price);
SendClientMessage(playerid, COLOR_WHITE, string);
f(string, "\
Player %s (gang leader %s) wants to sell\n\
you his zone for %d$. Buy?\
", PlayerNameEx[playerid], GetOrganizationName(PlayerInfo[playerid][pMember]), price);
ShowDialog(giveplayerid, GANG_ID, DIALOG_STYLE_MSGBOX, "Offer", string, "Yes", "No");
GetPlayerTransfer[giveplayerid] = playerid;
GetPlayerBuyZone[giveplayerid] = i;
GetPlayerOption[giveplayerid] = price;
break;
}
}
if(!gangzone) SendClientMessage(playerid, COLOR_GREEN, "You are not in the zone that you can sell");
return 1;
}
pawn Код:
#define MSG_NOTPLAYER(%0) SendClientMessage(%0, COLOR_GREEN, "Player with this id isnt foundн")
P.S Tested with my friend, not alone
