14.09.2011, 15:33
try this:
pawn Код:
CMD:givecocaine(playerid, params[])
{//1
GetPlayerPos(id,xd,yd,zd);
if(IsPlayerInRangeOfPoint(playerid,5.0,xd,yd,zd))
{//2
if(Cocaine[playerid] == 1)
{//3 read >>>
if(sscanf(params, "r", id)) return SendClientMessage(playerid, COLOR_BLUE, "Usage: \"/givecocaine [playerid]\""); // your are not using "reason" , and the player should put a reason too.. to use the cmd , so if you dont use reason than you shoudl remove it , and its "r" not "d" , d will give you only an Integer (1, 42, -10)
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_BLUE, "Invalid id");
{//4
SendClientMessage(playerid, COLOR_GREEN, "You gave the other player some cocaine");
ApplyAnimation(playerid,"DEALER","DEALER_IDLE_01",4.1,0,1,1,1,1,1); //seller
ApplyAnimation(id,"DEALER","DEALER_IDLE_02",4.1,0,1,1,1,1,1);//buyer
Cocaine[playerid] = 0;
Cocaine[id] = 1;
SendClientMessage(id, COLOR_GREEN, "you have drugs, now jizz with /usedrugs or sell it further to other people");
}//4
}//3
SendClientMessage(playerid, 0xC20000FF, "You dont have any drugs to sell");
}//2
return 1;
}//1