17.04.2014, 17:48
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
//dcmd(takedrugs,9, cmdtext);
if(strcmp(cmd, "/usedrugs", true) == 0)
{
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, -1, "{FF6A22}USAGE: {FFFFFF}/takedrugs [name]");
SendClientMessage(playerid, -1, "{FF6A22}Available names: {FFFFFF}Weed, Cocaine, Crack, Meth, Ectasy, Heroin");
return 1;
}
if(strcmp(x_nr,"weed",true) == 0)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
if(Pdrug[playerid][Weed] > 1)
{
Pdrug[playerid][Weed] -= 1;
SetPlayerHealth(playerid, Health + 2);
SetPlayerWeather(playerid, -68);
SendClientMessage(playerid, -1, "{FFFFFF}test msg");
}
else
{
SendClientMessage(playerid, -1, "{FF6A22}INFO: {FFFFFF}You don't have any weed to smoke.");
}
}
return 1;
}
//rest of cmds
return 0;
}