29.03.2012, 07:46
Quote:
It's good if players want to quickly spawn a weapon without having to open a dialog then browse through, though /weapon [weapon name/id] would be better.
|
pawn Код:
if(strcmp(cmd, "/weapon", true) == 0)
{
new choose[256];
choose = strtok(cmdtext, idx);
if(!strlen(choose)) {
SendClientMessage(playerid, COLOR_WHITE, "[USAGE:] /weapon [weapon id/weapon name]");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|_______ Weapons _______|");
SendClientMessage(playerid, COLOR_GRAD1, "| AK47(30) - $5,000, MP5 - $3,500");
return 1;
}
if(strcmp(choose,"AK47",true) == 0 || (strcmp(choose,"30",true) == 0) && GetPlayerMoney(playerid)>=50000)
GivePlayerMoney(playerid, - 5000);
SendClientMessage(playerid,COLOR_WHITE,"[{33CCFF}INFO{FFFFFF}]: You have bought an AK-47.");
}
blablabla....just continue it.
else
{
SendClientMessage(playerid,COLOR_GRAD2,"[{660000}ERROR{FFFFFF}]: Not enough money or invalid weapon!");
return 1;
}
return 1;
}
OFFT: Small question, how can I make this :
pawn Код:
if(strcmp(choose,"AK47",true) == 0
pawn Код:
if(strcmp(choose,"AK47",true) == 0 && (strcmp(choose,"30",true) == 0
EDIT: I understood how, it's
pawn Код:
if(strcmp(choose,"AK47",true) == 0 || (strcmp(choose,"30",true) == 0)