15.08.2009, 11:32
Okay guys heres the deal. I made this code just now and everytime I goto the materials pickup A and type /mget a it says "SERVER: Unknown command." But when I'm not on the point it says "You are not at Materials pickup A" So can someone tell me what I'm doing wrong?
http://pastebin.com/m564ba3b0
http://pastebin.com/m564ba3b0
pawn Код:
if(strcmp(cmd, "/mget", true) == 0) //by Ian Stuart
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pJob] != 9)
{
SendClientMessage(playerid,COLOR_GREY," You are not a Arms Dealer!");
return 1;
}
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid, COLOR_GRAD6, "USAGE: /mget [A/B/C]");
return 1;
}
if(strcmp(x_nr,"A",true) == 0)
{
new matget = 0;
new matsmult = 1;
if(PlayerToPoint(3.0, playerid, 1410.475830,-1305.475463,9.399000))
{
new point_pickup = -1;
new point_drop = -1;
for (new i=0; i<MAX_POINTS; i++)
{
if (Points[i][Type] == 1 && Points[i][MatPoint] == matget)
{
point_pickup = i;
}
if (Points[i][Type] == 2 && Points[i][MatPoint] == matget)
{
point_drop = i;
}
}
if (point_pickup >=0 && point_drop >= 0 && PlayerInfo[playerid][pFMember] < MAX_FAMILY)
{
new fam = PlayerInfo[playerid][pFMember];
if (strcmp(Points[point_pickup][Owner], FamilyInfo[fam][FamilyName], true) == 0 && strcmp(Points[point_drop][Owner], FamilyInfo[fam][FamilyName], true) == 0)
{
matsmult = 2;
}
}
if(MatsHolding[playerid] >= 20)
{
SendClientMessage(playerid, COLOR_GREY, "You can't hold any more Materials Packages!");
return 1;
}
moneys = MatsPickup[matget-1][MatsAmount] * matsmult;
new price = moneys * 20;
if(GetPlayerMoney(playerid) > price)
{
format(string, sizeof(string), "* You bought %d Packages for $%d.", moneys, price);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoney(playerid, - price);
MatsHolding[playerid] = moneys;
MatsGet[playerid] = matget;
PlayerInfo[playerid][pGotA] = 1;
}
else
{
format(string, sizeof(string), "You can't afford the $%d!", price);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not at the correct materials pickup for Materials type A!");
return 1;
}
return 1;
}