SERVER: Unknown Command
#1

Hi, this is my /buyinsurance command, its used for my vehicle system.. But when i type /buyinsurance, it says that i have bought Insurances, but it will not add the Insurances to the car system..

pawn Код:
if(strcmp(cmd, "/buyinsurance", true) == 0 || strcmp(cmd, "/buyinsurances", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(!IsPlayerInRangeOfPoint(playerid,2.0,1529.6,-1691.2,13.3))
            {
                SendClientMessage(playerid, COLOR_GREY, "You can not buy insurance here.");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [amount]");
                return 1;
            }
            new amount = strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [amount]");
                return 1;
            }
            //for(new i=0; i<MAX_VEHICLES; i++)
            for(new i = 0; i < sizeof(CarInfo); i++)
            {
                VehSpawned[CarInfo[i][cInsurances]] += amount;
                CarInfo[VehSpawned[i]][cInsurances] += amount;
                CarInfo[i][cInsurances] += amount;
                format(string, sizeof(string), "You have purchased %d insurances.", amount);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
        }
        return 0;
    }
Reply
#2

PHP код:
if(strcmp(cmd, "/buyinsurance", true) == 0 || strcmp(cmd, "/buyinsurances", true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(!
IsPlayerInRangeOfPoint(playerid,2.0,1529.6,-1691.2,13.3))
            {
                
SendClientMessage(playerid, COLOR_GREY, "You can not buy insurance here.");
                return 
1;
            }
            
tmp = strtok(cmdtext, idx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [amount]");
                return 
1;
            }
            new 
amount = strval(tmp);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [amount]");
                return 
1;
            }
            for(new 
i=0; i<MAX_VEHICLES; i++)
            {
                new 
veh;
                
veh = VehicleOwned[i];
                
VehSpawned[CarInfo[veh][cInsurances]] += amount;
                
CarInfo[VehSpawned[veh]][cInsurances] += amount;
                
format(string, sizeof(string), "You have purchased %d insurances.", amount);
                
SendClientMessage(playerid, COLOR_WHITE, string);
                return 
1;
            }
        }
        return 
0; // Should return 0 and not 1;
    
} 
Reply
#3

Still not working
Reply
#4

Show me the full code.
Reply
#5

Well i have fixed it now, it doesnt say unknown command anymore, now it tells me that i have bought the Insurances, but it doesnt show any Insurances on /v list

pawn Код:
if(strcmp(cmd, "/buyinsurance", true) == 0 || strcmp(cmd, "/buyinsurances", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(!IsPlayerInRangeOfPoint(playerid,2.0,1529.6,-1691.2,13.3))
            {
                SendClientMessage(playerid, COLOR_GREY, "You can not buy insurance here.");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [amount]");
                return 1;
            }
            new amount = strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [amount]");
                return 1;
            }
            //for(new i=0; i<MAX_VEHICLES; i++)
            for(new i = 0; i < sizeof(CarInfo); i++)
            {
                VehSpawned[CarInfo[i][cInsurances]] += amount;
                CarInfo[VehSpawned[i]][cInsurances] += amount;
                CarInfo[i][cInsurances] += amount;
                format(string, sizeof(string), "You have purchased %d insurances.", amount);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
        }
        return 0;
    }
Reply
#6

^ This is the code i had told you and you told me that it isn't fixed.
Reply
#7

It doesnt say unknown command anymore, but it doesnt add any Insurances to my spawned vehicle
Reply
#8

Nevermind, i have fixed it myself
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)