Drug system don't work??
#1

Код:
CMD:buyheroin(playerid, params[])
{
 new Heroin[MAX_PLAYERS];
 new heroin = SendClientMessage(playerid, 0xFFFFFFFF, "Нямаш достатъчно пари за Хероин");
 GetPlayerMoney(playerid);
 if(GetPlayerMoney(playerid) < 5000) return heroin;
 GivePlayerMoney(playerid, -5000);
 Heroin[playerid]++;
 SendClientMessage(playerid, 0xFFFFFFFF, "Ти си купи хероин");
 return 1;
}

CMD:checkdrugs(playerid, params[])
{
 new string[128];
 new Heroin[MAX_PLAYERS];
 format(string, sizeof(string), "Ти имаш %d Heroin", Heroin[playerid]);
 SendClientMessage(playerid, 0xFFFFFFFF, string);
 return 1;
}

CMD:usedrug(playerid, params[])
{
 new Heroin[MAX_PLAYERS];
 if(Heroin[playerid] == 0) return SendClientMessage(playerid, -1, "Нямаш достатъчно Хероин");
 Heroin[playerid]--;
 GivePlayerWeapon(playerid, 24, 433);
 SetPlayerHealth(playerid, 100);
 SetPlayerArmour(playerid, 50);
 SendClientMessage(playerid, -1, "Ти използва 1 грам хероин");
 return 1;
}
this is the drug system but when i buy heroin i can't use it or when i check it 0 gtams of heroin can you explain me what did i do wrong
Reply
#2

First of all, declare
pawn Код:
new Heroin[MAX_PLAYERS];
as a global variable. After that:


pawn Код:
CMD:buyheroin(playerid, params[])
{
 if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFFFFFFFF, "Нямаш достатъчно пари за Хероин");
 GivePlayerMoney(playerid, -5000);
 Heroin[playerid]++;
 SendClientMessage(playerid, 0xFFFFFFFF, "Ти си купи хероин");
 return 1;
}

CMD:checkdrugs(playerid, params[])
{
 new string[128];
 format(string, sizeof(string), "Ти имаш %d Heroin", Heroin[playerid]);
 SendClientMessage(playerid, 0xFFFFFFFF, string);
 return 1;
}

CMD:usedrug(playerid, params[])
{
 if(Heroin[playerid] == 0) return SendClientMessage(playerid, -1, "Нямаш достатъчно Хероин");
 Heroin[playerid]--;
 GivePlayerWeapon(playerid, 24, 433);
 SetPlayerHealth(playerid, 100);
 SetPlayerArmour(playerid, 50);
 SendClientMessage(playerid, -1, "Ти използва 1 грам хероин");
 return 1;
}
Reply
#3

oh thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)