Help Errors
#6

'params' has no given length or size, as it is determined at the moment the player uses the command. What you can do instead is:
pawn Код:
format(PlayerInfo[playerid][pVehPlate], 32, "%s", params);
Full code:
pawn Код:
CMD:plateregister(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] < 7) return SendClientMessage(playerid, COLOR_GREY, "You are not a level 7 player ");
    if(!IsPlayerInRangeOfPoint(playerid, 3, 366.4916, 158.6417, 1008.3828)) return SendClientMessage(playerid, COLOR_GREY, "You aren't near Vehicle Registration Place.");
    new vslot[6];
    if(sscanf(params, "s[6]", vslot))
    {
        SendClientMessage(playerid, COLOR_ALIREZA, "USAGE: /vehicleregister [VehSlot]");
        return SendClientMessage(playerid, COLOR_ALIREZA, "Vehicle Slots: one(for all players)   two(vip)   three(bvip) ");
    }
    if(!strcmp(vslot, "one", true))
    {
        new platetext[32];
        if(sscanf(params, "{s[6]}s[32]", platetext)) return SendClientMessage(playerid, COLOR_ALIREZA, "USAGE: /vehicleregister one [PlateText]");
        new Float:carpos_x, Float:carpos_y, Float:carpos_z;
        SetVehicleNumberPlate(PlayerInfo[playerid][pVeh], platetext);
        GetVehiclePos(PlayerInfo[playerid][pVeh], carpos_x, carpos_y, carpos_z);
        SetVehicleToRespawn(PlayerInfo[playerid][pVeh]);
        SetVehiclePos(PlayerInfo[playerid][pVeh], carpos_x, carpos_y, carpos_z);
        format(PlayerInfo[playerid][pVehPlate], 32, "%s", platetext);
        new string[65];
        format(string, sizeof(string), "* changed plate to %s(slot 1).", platetext);
        SendClientMessage(playerid, COLOR_GREY, string);
    }
    else if(!strcmp(vslot, "two", true))
    {
        new platetext[32];
        if(sscanf(params, "{s[6]}s[32]", platetext)) return SendClientMessage(playerid, COLOR_ALIREZA, "USAGE: /vehicleregister two [PlateText]");
        new Float:carpos_x, Float:carpos_y, Float:carpos_z;
        SetVehicleNumberPlate(PlayerInfo[playerid][pVVeh], platetext);
        GetVehiclePos(PlayerInfo[playerid][pVVeh], carpos_x, carpos_y, carpos_z);
        SetVehicleToRespawn(PlayerInfo[playerid][pVVeh]);
        SetVehiclePos(PlayerInfo[playerid][pVVeh], carpos_x, carpos_y, carpos_z);
        format(PlayerInfo[playerid][pVVehPlate], 32, "%s", platetext);
        new string[65];
        format(string, sizeof(string), "* changed plate to %s(slot 2).", platetext);
        SendClientMessage(playerid, COLOR_GREY, string);
    }
    else if(!strcmp(vslot, "three", true))
    {
        new platetext[32];
        if(sscanf(params, "{s[6]}s[32]", platetext)) return SendClientMessage(playerid, COLOR_ALIREZA, "USAGE: /vehicleregister three [PlateText]");
        new Float:carpos_x, Float:carpos_y, Float:carpos_z;
        SetVehicleNumberPlate(PlayerInfo[playerid][pBVeh], platetext);
        GetVehiclePos(PlayerInfo[playerid][pBVeh], carpos_x, carpos_y, carpos_z);
        SetVehicleToRespawn(PlayerInfo[playerid][pBVeh]);
        SetVehiclePos(PlayerInfo[playerid][pBVeh], carpos_x, carpos_y, carpos_z);
        format(PlayerInfo[playerid][pBVehPlate], 32, "%s", platetext);
        new string[65];
        format(string, sizeof(string), "* changed plate to %s (Slot 3).", platetext);
        SendClientMessage(playerid, COLOR_GREY, string);
    }
    else
    {
        SendClientMessage(playerid, COLOR_ALIREZA, "USAGE: /vehicleregister [VehSlot]");
        SendClientMessage(playerid, COLOR_ALIREZA, "Vehicle Slots: one(for all players)   two(vip)   three(bvip) ");
    }
    return 1;
}
Reply


Messages In This Thread
Help Errors - by Airblog - 13.01.2015, 07:29
Re: Help Errors - by CalvinC - 13.01.2015, 07:33
Re: Help Errors - by Airblog - 13.01.2015, 08:15
Re: Help Errors - by Airblog - 14.01.2015, 12:40
Re: Help Errors - by iggy1 - 14.01.2015, 12:57
Re: Help Errors - by Threshold - 14.01.2015, 15:28

Forum Jump:


Users browsing this thread: 1 Guest(s)