17.03.2013, 13:00
Didn't understand you well,
is this you want?
is this you want?
pawn Код:
new Materials[MAX_PLAYERS];
YCMD:getmats(playerid, params[], help)
{
#pragma unused help
if(!IsAnArmDealer(playerid)) return SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: You are not allowed!");
// You should change it, put variable instead of this check.
else if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /getmats [ammount]");
else if(params < 1 || params > 10) return SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: Ammount of materials can't go over 10 or below 1!");
else if(Materials[playerid] + params > 10) return SendClientMessage(playerid, 0xFFFFFFAA, "You can't hold it!");
else if(!IsPlayerInRangeOfPoint(playerid, 4.0, X, Y, Z); // Your co-ords
return SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: You are not near mats selling place!");
else if(GetPlayerMoney(playerid) < (params * 10))
return SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: You don't have enough money!");
GivePlayerMoney(playerid, - (params * 10));
Materials[playerid] += params;
new myString[128];
format(myString, sizeof(myString), "SUCCES: You have bought %d crates of materials for $ %d", params, params*10);
SendClientMessage(playerid, 0xFFFFFFAA, myString);
return true;
}