/give command problem
#1

Hello SA-MP players. Well I have a Question "we" made a drug system for my server and all works good, but there is one problem with the /give command. After you baught the drugs and all, it shows that you got the drug(lets take cocaine for example), and the /give command allows you to transfer the cocaine you got to another player, but when you do /givecocain nothing appears and nothing happends, can someone maybe help here:

Код:
dcmd_givecocaine(playerid, params[])//COCAINE
{
    GetPlayerPos(id,xd,yd,zd);
	if(IsPlayerInRangeOfPoint(playerid,5.0,xd,yd,zd))
	{
    if(Cocaine[playerid]== 1)
   	{
    	if (sscanf(params, "dz", id, reason)) SendClientMessage(playerid, COLOR_BLUE, "Usage: \"/givecocaine [playerid]\"");
		else if(!IsPlayerConnected(id))SendClientMessage(playerid, COLOR_BLUE, "Invalid id");
		else
  		{
		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");
		}
  	}
    SendClientMessage(playerid, 0xC20000FF, "You dont have any drugs to sell");
    }
	return 1;
}
-Thank you.
Reply
#2

PHP код:
dcmd_givecocaine(playeridparams[])
{
    new 
id;
    if(
sscanf(params,"u"id)) return SendClientMessage(playeridCOLOR_BLUE,"Usage: /givecocaine [Playerid / name]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridCOLOR_BLUE,"Invalid id");
    
GetPlayerPos(idxdydzd);
    if(!
IsPlayerInRangeOfPoint(playerid,5.0,xdydzd)) return SendClientMessage(playeridCOLOR_BLUE,"You are not near that player");
    if(
Cocaine[playerid] != 1) return SendClientMessage(playerid0xC20000FF"You don't have any drugs to sell");
    
SendClientMessage(playeridCOLOR_GREEN"You gave the other player some cocaine");
    
ApplyAnimation(playerid,"DEALER","DEALER_IDLE_01",4.1,0,1,1,1,1,1);  
    
ApplyAnimation(id,"DEALER","DEALER_IDLE_02",4.1,0,1,1,1,1,1);
    
Cocaine[playerid] = 0;
    
Cocaine[id] = 1;
    
SendClientMessage(idCOLOR_GREEN"you have drugs, now jizz with /usedrugs or sell it further to other people");
    return 
1;

Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)