01.07.2016, 19:26
this supposed to work
Usage:
GetDrugName(playerid, slotID);
example:
PHP код:
GetDrugName(playerid, slotID) {
new drugname [30];
switch(PlayerInfo [ playerid ] [ pDrug ] [ slotID ]) {
case 1: {
drugname = "Marijuana";
}
case 2: {
drugname = "Cocaine";
}
case 3: {
drugname = "Heroine";
}
default: {
drugname = "-255";
}
}
return drugname;
}
GetDrugName(playerid, slotID);
example:
PHP код:
public OnPlayerConnect(playerid) {
new string[128];
for( new slot = 0; slot < 13; slot++ ) {
new drugname[30];
drugname = GetDrugName(playerid, slot);
if(strval(drugname) != -255) {
format(string, sizeof(string), "%s[ %d. %s (%d) ], ",string, slot+1, GetDrugName(playerid, slot), PlayerInfo[playerid][pDrugAmount][slot]);
}
}
}