08.05.2011, 12:02
(
Последний раз редактировалось BizzyD; 08.05.2011 в 14:15.
)
Hello, I got a problem with my /give command. When i do /give 2 (someones id) firematches. It says i give them to the npc. Tom_Weaver hands some matches to intro(npc name).
So how do i fix this?
So i can give the player the things i want, And not only the npc.
this is my /give cmd:
Regards, Alex
So how do i fix this?
So i can give the player the things i want, And not only the npc.
this is my /give cmd:
pawn Код:
CMD:give(playerid, params[])
{
new targetid, option[15], string[128];
new targetname[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
GetPlayerName(targetid, targetname, sizeof(targetname));
GetPlayerName(playerid, sendername, sizeof(sendername));
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
new Float:tx,Float:ty,Float:tz;
GetPlayerPos(targetid,tx,ty,tz);
if(sscanf(params, "us[128]", targetid, option))
{
SendClientMessage(playerid, RED, "[LOST:RP] /give [ID] [OPTION");
SendClientMessage(playerid, COLOR_WHITE, "[LOST:RP] Options: Matches,Firewood,WaterBottle,FishingRod,FishingNet,Heroin");
return 1;
}
if(IsPlayerInRangeOfPoint(playerid, 2.0, tx,ty,tz))
{
if(targetid == playerid) return SendClientMessage(playerid, RED, "[LOST:RP] You cant give yourself stuff");
{
if (strcmp(option, "Matches", true) == 0)
{
if(PlayerInfo[playerid][pMatches] > 0)
{
PlayerInfo[playerid][pMatches] -= 1;
PlayerInfo[targetid][pMatches] += 1;
format(string, sizeof(string), "%s hands some matches to %s", sendername,targetname);
ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
}
else
{
SendClientMessage(playerid, RED, "[LOST:RP] You dont have any matches to give");
}
}
if (strcmp(option, "FireWood", true) == 0)
{
if(PlayerInfo[playerid][pWood] > 0)
{
PlayerInfo[playerid][pWood] -= 1;
PlayerInfo[targetid][pWood] += 1;
format(string, sizeof(string), "%s hands fire wood to %s", sendername,targetname);
ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
}
else
{
SendClientMessage(playerid, RED, "[LOST:RP] You dont have any firewoods to give");
}
}
if (strcmp(option, "WaterBottle", true) == 0)
{
if(PlayerInfo[playerid][pWaterBottle] > 0)
{
PlayerInfo[playerid][pWaterBottle] -= 1;
PlayerInfo[targetid][pWaterBottle] += 1;
format(string, sizeof(string), "%s hands a WaterBottle to %s", sendername,targetname);
ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
}
else
{
SendClientMessage(playerid, RED, "[LOST:RP] You dont have any WaterBottles");
}
}
if (strcmp(option, "FishingRod", true) == 0)
{
if(PlayerInfo[playerid][pFishingRod] > 0)
{
PlayerInfo[playerid][pFishingRod] -= 1;
PlayerInfo[targetid][pFishingRod] += 1;
format(string, sizeof(string), "%s hands a Fishing Rod to %s", sendername,targetname);
ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
}
else
{
SendClientMessage(playerid, RED, "[LOST:RP] You dont have a Fishing Rod");
}
}
if (strcmp(option, "FishingNet", true) == 0)
{
if(PlayerInfo[playerid][pFishingNet] > 0)
{
PlayerInfo[playerid][pFishingNet] -= 1;
PlayerInfo[targetid][pFishingNet] += 1;
format(string, sizeof(string), "%s hands a Fishing Net to %s", sendername,targetname);
ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
}
else
{
SendClientMessage(playerid, RED, "[LOST:RP] You dont have a Fishing Net");
}
}
if (strcmp(option, "Heroin", true) == 0)
{
if(PlayerInfo[playerid][pHeroin] >= 0)
{
PlayerInfo[playerid][pHeroin] -= 1;
PlayerInfo[targetid][pHeroin] += 1;
format(string, sizeof(string), "%s hands a bag of heroin to %s", sendername,targetname);
ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN);
}
else
{
SendClientMessage(playerid, RED, "[LOST:RP] You dont have any heroin");
}
}
else
{
SendClientMessage(playerid, RED, "[LOST:RP] You are not near anybody");
}
}
}
return 1;
}