Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Why is it switched up?

$
0
0
I have this command:

Code:

CMD:tradecar(playerid, params[])
{       
        new id, dif, Float:x, Float:y, Float:z, string[256];
        if(sscanf(params, "r", id)) return SCM(playerid, COLOR_GRAD2, "Usage: {FFFFFF}/tradecar [playerid] + [difference]");
        if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, "You must be in your vehicle to use this command.");
        if(!IsPlayerInAnyVehicle(id)) return SCM(playerid, -1, "That user must be in his vehicle.");
        if(dif > playerVariables[playerid][pMoney]) return SCM(playerid, -1, "You don't have that much money.");
        new cf[128];
        format(cf, sizeof(cf), "You must wait %d seconds.", Cooldown[playerid]);
        if(Cooldown[playerid] > 0) return SCM(playerid, -1, cf);
        new hiscar = GetPlayerVehicleID(id);
        new mycar = GetPlayerVehicleID(playerid);
        new hid = GetVID(hiscar);
        new mid = GetVID(mycar);
        GetPlayerPos(id, x, y, z);
        if(vehStat[hid][vOwnerID] != playerVariables[id][pInternalID]) return SCM(playerid, -1, "That vehicle is not owned by that user.");
        if(vehStat[mid][vOwnerID] != playerVariables[playerid][pInternalID]) return SCM(playerid, -1, "That vehicle is not owned by you.");
        if(sscanf(params, "rd", id, dif))
        {
                if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
                {
                        MyTrade[playerid] = mycar;
                        HisTrade[id] = hiscar;
                        format(string, sizeof(string), "New Offer From %s", GetName(playerid));
                        SCM(id, 0xFF99311EFF, string);
                        format(string, sizeof(string), "%s want's to trade his: %s [%d] | %d days | %d KM | colors: %d - %d", GetName(playerid), VehicleNames[GetVehicleModel(mycar) - 400], vehStat[mid][vID], vehStat[mid][vDays], vehStat[mid][vKM], vehStat[mid][vColor1], vehStat[mid][vColor2]);
                        SCM(id, COLOR_YELLOW, string);       
                        format(string, sizeof(string), "For your: %s [%d] | %d days | %d KM | colors: %d - %d + $%s difference from him.", VehicleNames[GetVehicleModel(hiscar) - 400], vehStat[hid][vID], vehStat[hid][vDays], vehStat[hid][vKM], vehStat[hid][vColor1], vehStat[hid][vColor2], NumberFormat(dif));
                        SCM(id, COLOR_YELLOW, string);       
                        HisMoney[playerid] = dif;
                        format(string, sizeof(string), "Use /accept tradecar %d to trade your vehicle for %s's vehicle.", playerid, playerVariables[playerid][pNormalName]);
                        SCM(id, COLOR_YELLOW, string);
                        SCM(playerid, -1, "Offer has been sent 2.");
                        TradeType[playerid] = 2;
                }
                else return SCM(playerid, -1, "You're not near that player.");
        }
        else
        {
                if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
                {
                        MyTrade[playerid] = mycar;
                        HisTrade[id] = hiscar;
                        format(string, sizeof(string), "New Offer From %s", GetName(playerid));
                        SCM(id, 0xFF99311EFF, string);
                        format(string, sizeof(string), "%s want's to trade his: %s [%d] | %d days | %d KM | colors: %d - %d", GetName(playerid), VehicleNames[GetVehicleModel(mycar) - 400], vehStat[mid][vID], vehStat[mid][vDays], vehStat[mid][vKM], vehStat[mid][vColor1], vehStat[mid][vColor2]);
                        SCM(id, COLOR_YELLOW, string);       
                        format(string, sizeof(string), "For your: %s [%d] | %d days | %d KM | colors: %d - %d", VehicleNames[GetVehicleModel(hiscar) - 400], vehStat[hid][vID], vehStat[hid][vDays], vehStat[hid][vKM], vehStat[hid][vColor1], vehStat[hid][vColor2]);
                        SCM(id, COLOR_YELLOW, string);       
                        format(string, sizeof(string), "Use /accept tradecar %d to trade your vehiclel for %s's vehicle.", playerid, playerVariables[playerid][pNormalName]);
                        SCM(id, COLOR_YELLOW, string);
                        SCM(playerid, -1, "Offer has been sent.");
                        TradeType[playerid] = 1;
                }
                else return SCM(playerid, -1, "You're not near that player.");
        }
        return 1;
}

Whenever I use /tradecar [playerid] [difference]
this part gets called. This part should be called when you use /tradecar [playerid]. Not /tradecar [playerid] [difference]
Code:

else
        {
                if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
                {
                        MyTrade[playerid] = mycar;
                        HisTrade[id] = hiscar;
                        format(string, sizeof(string), "New Offer From %s", GetName(playerid));
                        SCM(id, 0xFF99311EFF, string);
                        format(string, sizeof(string), "%s want's to trade his: %s [%d] | %d days | %d KM | colors: %d - %d", GetName(playerid), VehicleNames[GetVehicleModel(mycar) - 400], vehStat[mid][vID], vehStat[mid][vDays], vehStat[mid][vKM], vehStat[mid][vColor1], vehStat[mid][vColor2]);
                        SCM(id, COLOR_YELLOW, string);       
                        format(string, sizeof(string), "For your: %s [%d] | %d days | %d KM | colors: %d - %d", VehicleNames[GetVehicleModel(hiscar) - 400], vehStat[hid][vID], vehStat[hid][vDays], vehStat[hid][vKM], vehStat[hid][vColor1], vehStat[hid][vColor2]);
                        SCM(id, COLOR_YELLOW, string);       
                        format(string, sizeof(string), "Use /accept tradecar %d to trade your vehiclel for %s's vehicle.", playerid, playerVariables[playerid][pNormalName]);
                        SCM(id, COLOR_YELLOW, string);
                        SCM(playerid, -1, "Offer has been sent.");
                        TradeType[playerid] = 1;
                }
                else return SCM(playerid, -1, "You're not near that player.");
        }

Instead of this part.
Code:

if(sscanf(params, "rd", id, dif))
        {
                if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
                {
                        MyTrade[playerid] = mycar;
                        HisTrade[id] = hiscar;
                        format(string, sizeof(string), "New Offer From %s", GetName(playerid));
                        SCM(id, 0xFF99311EFF, string);
                        format(string, sizeof(string), "%s want's to trade his: %s [%d] | %d days | %d KM | colors: %d - %d", GetName(playerid), VehicleNames[GetVehicleModel(mycar) - 400], vehStat[mid][vID], vehStat[mid][vDays], vehStat[mid][vKM], vehStat[mid][vColor1], vehStat[mid][vColor2]);
                        SCM(id, COLOR_YELLOW, string);       
                        format(string, sizeof(string), "For your: %s [%d] | %d days | %d KM | colors: %d - %d + $%s difference from him.", VehicleNames[GetVehicleModel(hiscar) - 400], vehStat[hid][vID], vehStat[hid][vDays], vehStat[hid][vKM], vehStat[hid][vColor1], vehStat[hid][vColor2], NumberFormat(dif));
                        SCM(id, COLOR_YELLOW, string);       
                        HisMoney[playerid] = dif;
                        format(string, sizeof(string), "Use /accept tradecar %d to trade your vehicle for %s's vehicle.", playerid, playerVariables[playerid][pNormalName]);
                        SCM(id, COLOR_YELLOW, string);
                        SCM(playerid, -1, "Offer has been sent 2.");
                        TradeType[playerid] = 2;
                }
                else return SCM(playerid, -1, "You're not near that player.");
        }

Why is this happaning?

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>