31.05.2011, 21:29
Hey everyone. I started scripting again, it's just so much fun.
I need someone to clean up my command if that's possible and if it''s needed
I made this command:
It works excellent.
The problem is that I think that I could've scripted this on a better and decent way.
Can anybody clean up my command please?
Thanks
I need someone to clean up my command if that's possible and if it''s needed
I made this command:
pawn Код:
COMMAND:takewood(playerid,params[])
{
new amount,string[70];
if(IsPlayerInRangeOfPoint(playerid, 7.0, 1018.5685,-2195.3081,37.7154))
{
if(PlayerInfo[playerid][Job] != Woodjob) return SendClientMessage(playerid,COLOR_RED,"You're not a wood deliverer.");
if(sscanf(params,"d",amount)) return SendClientMessage(playerid,COLOR_GREY,"USAGE:/pickwood [amount] 10$ each");
if(amount >100) return SendClientMessage(playerid,COLOR_RED,"Value must be between 1-100");
if(amount <1) return SendClientMessage(playerid,COLOR_RED,"Value must be between 1-100");
if(PlayerInfo[playerid][pCash] <10*amount) return SendClientMessage(playerid,COLOR_RED,"You don't have enough money.");
if(PlayerInfo[playerid][Wood] + amount > 5 && PlayerInfo[playerid][pScore] <5) return SendClientMessage(playerid,COLOR_RED,"You need atleast 5 score to cary more then 5 wood.");
PlayerInfo[playerid][Wood] += amount;
PlayerInfo[playerid][pCash] -= amount*10;
format(string,sizeof(string),"You've bought %d wood for $%d",amount,amount*10);
SendClientMessage(playerid,COLOR_YELLOW,string);
SendClientMessage(playerid,COLOR_YELLOW,"Bring them to the dropoff point at the docs.");
}
else
{
SendClientMessage(playerid,COLOR_RED,"You're not at the pickup point");
}
return 1;
}
The problem is that I think that I could've scripted this on a better and decent way.
Can anybody clean up my command please?
Thanks