13.02.2013, 07:56
Hello Yves , try this
pawn Код:
CMD:sellbiz(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pPbiskey] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You don't own a Business!");
return 1;
}
new Index;
tmp = strtok(params,Index);
tmp2 = strtok(params, Index);
if(isnull(params))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sellbiz [PlayerID/PartOfName] [price]");
return 1;
}
new money, giveplayerid;
giveplayerid = ReturnUser(tmp);
money = strval(tmp2);
if(money < 1) { SendClientMessage(playerid, COLOR_GREY, " Price can't be lower than $1!"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pPbiskey] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " This player already own a Business!");
return 1;
}
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't sell Business to yourself !"); return 1; }
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* You offered to sell your Business to %s for $%d.", giveplayer, money);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s wants to sell his Business to you for $%d, (type /accept business) to accept.", sendername, money);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
BizID[giveplayerid] = PlayerInfo[playerid][pPbiskey];
BizOffer[giveplayerid] = playerid;
BizPrice[giveplayerid] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
}
}
return 1;
}