07.05.2011, 22:18
Alright i tested it now. And when i only do /give. This is what happends:
the code is:
the code is:
pawn Код:
COMMAND: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));
if(sscanf(params, "us[128]", targetid, option))
{
SendClientMessage(playerid, RED, "[LOST:RP] /give [ID] [OPTION");
SendClientMessage(playerid, RED, "[LOST:RP] Options: Matches,Firewood,WaterBottle,FishingRod,FishingNet,Heroin");
}
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");
}
}
return 1;
}
}