22.07.2012, 09:03
How about before you expect people to fix things for you, tell them what is wrong.
I think you mean you want to know why it isn't working when you type in the drugname.
Try this:
You cannot compare strings like this:
and if it was possible, they would probably make it like this: considering it is writing weed is a variable, not a string.
I think you mean you want to know why it isn't working when you type in the drugname.
Try this:
pawn Код:
CMD:givedrugs(playerid, params[])
{
if(gTeam[playerid] == DRUG)
{
new id, drug[100], ammount;
if(sscanf(params,"us[100]i",id,drug,ammount)) return SendClientMessage(playerid, -1, "USAGE: /givedrugs <id/name> <drugname> <grams> - drug names: weed & heroin");
if GetPlayerWeed(playerid) < ammount) return SendClientMessage(playerid, -1, "You do not have that much grams!");
if(!strcmp(drug, "weed", true)) { GivePlayerWeed(id, ammount); }
if(!strcmp(drug, "heroin", true)) { GivePlayerHeroin(id, ammount); }
return 1;
}
else if(gTeam[playerid] != DRUG)
{
SendClientMessage(playerid, -1, "You are not a drug dealer");
return 1;
}
return 1;
}
pawn Код:
drugname == weed
pawn Код:
drugname == "weed" // This doesn't work either, fyi

