Код:
if(strcmp(cmd,"/sellpills",true)==0)
{
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4 && PlayerInfo[playerid][pPPills] > 0)
{
new ammount;
ammount = strval(tmp);
if(ammount < 1500 || ammount > 10000)
{
SendClientMessage(playerid,COLOR_GREY, "The price can't be lower than 1,500$ or higher than 10.000$");
return 1;
}
if(PlayerInfo[playerid][pPPills] < 1)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Nu ai nici un kit de Pills.");
return 1;
}
// new string[128];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{D580FE}Foloseste:{FFFFFF} /sellpills [playerid] [ammount]");
return 1;
}
{
PlayerInfo[giveplayerid][pPills] = 15;
PlayerInfo[playerid][pPPills] -= 1;
format(string, sizeof(string), "Ai primit 15 pills pentru %d$.",ammount);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "I-ai vandut lui %s 15 pills pentru %d$.", giveplayer, ammount);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoney(giveplayerid, -ammount);
GivePlayerMoney(playerid, ammount);
}
return 1;
}
}
}