error 001: expected token: "-identifier-", but found "-integer value-"
#3

Hi!

I did that what you want. Also I optimized your code.

PHP код:
CMD:sellmats(playerid,params[])
{
    if(
Player[playerid][Admin] >= 1)return SendClientMessage(playerid,COLOR_WHITE,"Administrators can't use this command.");
    new 
string[145];
    if(
GetPVarInt(playerid,"SellMatsTimer") > 0)
    {
        
format(string,sizeof string,"You must wait %d seconds before selling more materials.",GetPVarInt(playerid,"SellMatsTimer"));
        
SendClientMessage(playerid,COLOR_WHITE,string);
        return 
1;
    }
    new 
giveplayerid,amount,material[2],price;
    if(
sscanf(params,"us[2]dd",giveplayerid,material,amount,price))return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /sellmats [playerid / partofname] [material] [amount] [price]");
    if(
amount 1)return SendClientMessage(playerid,COLOR_GREY,"Materials amount must be no lower than 1!");
    if(
price 5000)return SendClientMessage(playeridCOLOR_GREY"Price must be no lower than $5000.");
    if(!
strcmp(material,"A",true))if(amount Player[playerid][MatsA])return SendClientMessage(playeridCOLOR_GREY"You don't have that many materials!");
    else if(!
strcmp(material,"B",true))if(amount Player[playerid][MatsB])return SendClientMessage(playeridCOLOR_GREY"You don't have that many materials!");
    else if(!
strcmp(material,"C",true))if(amount Player[playerid][MatsC])return SendClientMessage(playeridCOLOR_GREY"You don't have that many materials!");
    else 
SendClientMessage(playeridCOLOR_GREY"Invalid material class.");
    if(
IsPlayerConnected(giveplayerid))
    {
        if(
giveplayerid != INVALID_PLAYER_ID)
        {
            if(
giveplayerid == playerid)return SendClientMessage(playeridCOLOR_GREY"You can't sell materials to yourself!");
            if(
ProxDetectorS(8.0,playerid,giveplayerid))
            {
                new 
givename[MAX_PLAYER_NAME],myname[MAX_PLAYER_NAME];
                
GetPlayerName(giveplayerid,givename,sizeof(givename));
                
GetPlayerName(playerid,myname,sizeof(myname));
                
format(string,sizeof string,"* You affered %s to buy %d class %s materials for $%d.",givename,amount,material,price);
                
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
                
format(string,sizeof string,"* %s wants to sell you %d class %s materials for $%d. (type /accept mats - to buy)",myname,amount,material,price);
                
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE,string);
                
SetPVarInt(playerid,"SellMatsTimer",30);
                
SetTimerEx("OtherTimerEx",1000,false,"ii",playerid,TYPE_SELLMATSTIMER);
                
MatsOffer[giveplayerid] = playerid;
                
MatsPrice[giveplayerid] = price;
                
MatsType[giveplayerid] = material;
                
MatsAmount[giveplayerid] = amount;
            }
            else return 
SendClientMessage(playeridCOLOR_GREY"That player isn't near you.");
        }
        else return 
SendClientMessage(playeridCOLOR_GREY"Invalid player specified.");
    }
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)