SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 09/05/2020, 02:49 PM   #1
supermember
Big Clucker
 
Join Date: May 2012
Posts: 95
Reputation: 0
Default How to /giveitem to the other players

My code :
Code:
if(strcmp(cmd, "/giveitem1", true) == 0)
Example : /giveitem1 [playerid] [amount]

My code not used ZCMD

I am Newbie. Thank you
supermember is offline   Reply With Quote
Old 09/05/2020, 03:02 PM   #2
TheOliver
Big Clucker
 
Join Date: Apr 2020
Posts: 94
Reputation: 0
Default Re: How to /giveitem to the other players

I think what you want to do cannot be done without CMD, or that is what I believe, the way I know of doing that is as follows.

Quote:
CMD:give(playerid, params[])
{
new player, quantity, str[80];
if (PlayerInfo[playerid][pAdmin] >= 2)
{
if(!sscanf(params, "medicamentos", player, quantity))
{
PlayerInfo[jugador][pMedicamentos] += quantity;
format(str,sizeof(str),"Un administrador te acaba de dar %i medicamentos.", quantity);
SendClientMessage(playerid, COLOR_NARANJA, str);
}
}
TheOliver is offline   Reply With Quote
Old 09/05/2020, 03:24 PM   #3
supermember
Big Clucker
 
Join Date: May 2012
Posts: 95
Reputation: 0
Default Re: How to /giveitem to the other players

HTML Code:
if(strcmp(cmd, "/givedrugs", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /givedrugs [playerid/PartOfName] [drugs]");
				return 1;
			}
			new drugs;
			giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			drugs = strval(tmp);
			if((drugs > 1000) { SendClientMessage(playerid, COLOR_GREY, " ËéÒÁÁÒ¡¡ÇèÒ 1000 !!"); return 1; }
			if (PlayerInfo[playerid][pDrugs] >= 1)
			{
			    if(IsPlayerConnected(playerid))
			    {
			        if(giveplayerid != INVALID_PLAYER_ID)
			        {
						PlayerInfo[playerid][pDrugs] += drugs;
			            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid,sendername, sizeof(sendername));
						format(string, 256, "AdmWarning: %s ä´éãËéÂÒ¢Âѹá¡è %s ¨Ó¹Ç¹ %d àÁç´", sendername, giveplayer, drugs);
						SendAdminMessage(COLOR_YELLOW, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
			}
		}
		return 1;
	}

I try but fales
supermember is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DayZ GiveItem to specified player. HELP buhs Scripting Help 1 30/11/2016 08:57 PM
giveitem doesnt work Voxel Scripting Help 3 17/10/2013 09:09 AM
Cmd "/giveitem" and "/sellitem" CALIN147 Scripting Help 0 07/09/2013 08:09 AM
Command problem. /giveitem is not working properly Amine_Mejrhirrou Scripting Help 0 30/11/2012 09:22 PM


All times are GMT. The time now is 10:23 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.