22.11.2015, 08:15
Hi, is it possible to make that for example Insurances for a sultan is more expensive than for a clover?
I hope anyone can help me Rep+
This is my /buyinsurance command
I hope anyone can help me Rep+

This is my /buyinsurance command
pawn Код:
if(strcmp(cmd, "/buyinsurance", true) == 0 || strcmp(cmd, "/buyinsurances", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsPlayerInRangeOfPoint(playerid,2.0,956.7999, -53.7001, 1001.5))
{
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 [number of policies], insurances cost $10,000 each.");
return 1;
}
new amount = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, ""COL_SZR"Usage:"COL_WHITE" /buyinsurance [number of policies], insurances cost $10,000 each.");
return 1;
}
if(amount < 1 || amount > 20)
return SendClientMessage(playerid, COLOR_GREY, "The company will not go below 1 and above 20.");
//for(new i=0; i<MAX_VEHICLES; i++)
for(new i = 0; i < sizeof(CarInfo); i++)
{
new key2;
new price = amount * insurecost;
if(ForwardOwnCar(1,playerid)) { key2 = PlayerInfo[playerid][pCarkey]; }
else if(ForwardOwnCar(2,playerid)) { key2 = PlayerInfo[playerid][pCarkey2]; }
else if(ForwardOwnCar(3,playerid)) { key2 = PlayerInfo[playerid][pCarkey3]; }
else if(ForwardOwnCar(4,playerid)) { key2 = PlayerInfo[playerid][pCarkey4]; }
else if(ForwardOwnCar(5,playerid)) { key2 = PlayerInfo[playerid][pCarkey5]; }
else { SendClientMessage(playerid, COLOR_GREY, "You don't have a vehicle out."); return 1; }
if(GetMoney(playerid) <= price)
{
SendClientMessage(playerid, COLOR_GRAD2, "You can not afford this insurance. There is an ATM to your right.");
return 1;
}
if(CarInfo[key2][cInsure] > 19)
{
format(string,sizeof(string),"your %s already has %d policies, the company will only let you have 20.",CarInfo[key2][cDescription],CarInfo[key2][cInsure]);
SendClientMessage(playerid,COLOR_GRAD2, string);
return 1;
}
CarInfo[key2][cInsure] += amount;
GiveMoney(playerid, -price);
format(string, sizeof(string), "%s enters their details into the terminal and pays $%d for %d insurances",RemoveUnderScore(playerid),price,amount);
ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SaveCars();
UpdateAccount(playerid);
return 1;
}
}
return 1;
}