Please help :( -
MayaEU - 20.11.2015
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;
}
Re: SERVER: Unknown Command -
Karan007 - 20.11.2015
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;
}
Re: SERVER: Unknown Command -
MayaEU - 20.11.2015
Still not working
Re: SERVER: Unknown Command -
Karan007 - 20.11.2015
Show me the full code.
Re: SERVER: Unknown Command -
MayaEU - 20.11.2015
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;
}
Re: SERVER: Unknown Command -
Karan007 - 20.11.2015
^ This is the code i had told you and you told me that it isn't fixed.
Re: SERVER: Unknown Command -
MayaEU - 20.11.2015
It doesnt say unknown command anymore, but it doesnt add any Insurances to my spawned vehicle
Re: SERVER: Unknown Command -
MayaEU - 20.11.2015
Nevermind, i have fixed it myself