pawn Код:
if (strcmp(cmd, "/carupgrade", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new house = PlayerInfo[playerid][pPhousekey];
GetPlayerName(playerid, playername, sizeof(playername));
if (house != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
new gunid[16];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
format(string, sizeof(string), "USAGE: /carupgrade [carname]");
SendClientMessage(playerid, COLOR_GRAD2,"____________ * CAR UPGRADES *___________________________");
SendClientMessage(playerid, COLOR_WHITE,"** CAR UPGRADES Cost $100.000 **");
SendClientMessage(playerid, COLOR_GRAD2,string);
if(PlayerInfo[playerid][pLevel] >= 3)
{
SendClientMessage(playerid, COLOR_GRAD3, "Cars: Blistacompact Clover Elegant Emperor Glendale Greenwood");
SendClientMessage(playerid, COLOR_GRAD3, "Cars: Huntley Jester Landstalker Merit Nebula Sabre");
SendClientMessage(playerid, COLOR_GRAD3, "Cars: Sunrise Tahoma Uranus ZR-350 Bullet Stratum");
SendClientMessage(playerid, COLOR_GRAD3, "Donation cars: Infernus Stretch Elegy Phoenix Hotknife Turismo Bandito Sultan");
SendClientMessage(playerid, COLOR_GRAD3, "Donation cars: Cheetah Banshee Comet SuperGT Savana Euros Hotring Hustler");
}
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
return 1;
}
if(SBizzInfo[5][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
strmid(gunid, tmp, 0, strlen(cmdtext), 255);
if (GetPlayerMoney(playerid) > 100000)
{
if(strcmp(gunid, "stretch", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Stretch");
HouseInfo[house][hVec] = 409;
}
else if(strcmp(gunid, "hotknife", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Hotknife");
HouseInfo[house][hVec] = 434;
}
else if(strcmp(gunid, "bandito", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Bandito");
HouseInfo[house][hVec] = 568;
}
else if(strcmp(gunid, "sultan", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Sultan");
HouseInfo[house][hVec] = 560;
}
else if(strcmp(gunid, "elegy", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Elegy");
HouseInfo[house][hVec] = 562;
}
else if(strcmp(gunid, "phoenix", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Phoenix");
HouseInfo[house][hVec] = 603;
}
else if(strcmp(gunid, "cheetah", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Cheetah");
HouseInfo[house][hVec] = 415;
}
else if(strcmp(gunid, "banshee", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Banshee");
HouseInfo[house][hVec] = 429;
}
else if(strcmp(gunid, "comet", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Comet");
HouseInfo[house][hVec] = 480;
}
else if(strcmp(gunid, "supergt", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Super GT");
HouseInfo[house][hVec] = 506;
}
else if(strcmp(gunid, "savana", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Savana");
HouseInfo[house][hVec] = 567;
}
else if(strcmp(gunid, "euros", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now an Euros");
HouseInfo[house][hVec] = 587;
}
else if(strcmp(gunid, "hotring", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Hotring Racer");
HouseInfo[house][hVec] = 503;
}
else if(strcmp(gunid, "hustler", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Hustler");
HouseInfo[house][hVec] = 545;
}
else if(strcmp(gunid, "infernus", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now an Infernus");
HouseInfo[house][hVec] = 411;
}
else if(strcmp(gunid, "turismo", true, strlen(gunid)) == 0)
{
if(PlayerInfo[playerid][pDonateRank] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Turismo");
HouseInfo[house][hVec] = 451;
}
else if(strcmp(gunid, "blistacompact", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Blista Compact");
HouseInfo[house][hVec] = 496;
}
else if(strcmp(gunid, "clover", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Clover");
HouseInfo[house][hVec] = 542;
}
else if(strcmp(gunid, "elegant", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Elegant");
HouseInfo[house][hVec] = 507;
}
else if(strcmp(gunid, "emperor", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Emperor");
HouseInfo[house][hVec] = 585;
}
else if(strcmp(gunid, "glendale", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Glendale");
HouseInfo[house][hVec] = 466;
}
else if(strcmp(gunid, "greenwood", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Greenwood");
HouseInfo[house][hVec] = 492;
}
else if(strcmp(gunid, "huntley", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Huntley");
HouseInfo[house][hVec] = 579;
}
else if(strcmp(gunid, "jester", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Jester");
HouseInfo[house][hVec] = 559;
}
else if(strcmp(gunid, "landstalker", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Landstalker");
HouseInfo[house][hVec] = 400;
}
else if(strcmp(gunid, "merit", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Merit");
HouseInfo[house][hVec] = 551;
}
else if(strcmp(gunid, "nebula", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Nebula");
HouseInfo[house][hVec] = 516;
}
else if(strcmp(gunid, "sabre", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Sabre");
HouseInfo[house][hVec] = 475;
}
else if(strcmp(gunid, "stratum", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Stratum");
HouseInfo[house][hVec] = 561;
}
else if(strcmp(gunid, "sunrise", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Sunrise");
HouseInfo[house][hVec] = 550;
}
else if(strcmp(gunid, "tahoma", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Tahoma");
HouseInfo[house][hVec] = 566;
}
else if(strcmp(gunid, "zr-350", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A ZR-350");
HouseInfo[house][hVec] = 477;
}
else if(strcmp(gunid, "bullet", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Bullet");
HouseInfo[house][hVec] = 541;
}
else if(strcmp(gunid, "uranus", true, strlen(gunid)) == 0)
{
SendClientMessage(playerid, COLOR_GRAD6, "New Upgrade: Your House Car Is Now A Uranus");
HouseInfo[house][hVec] = 558;
}
else
{
SendClientMessage(playerid, COLOR_GRAD6, "Unrecognized Car or Donate Rank not High enough.");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "Your new car will be delivered within 24 hours! (-$100.000)");
OnPropUpdate();
GivePlayerMoney(playerid,-100000);
SBizzInfo[5][sbTill] += 100000;
ExtortionSBiz(5, 100000);
SBizzInfo[5][sbProducts]--;
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You can't afford that ($100.000)");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a house");
return 1;
}
}
return 1;
}
ENG: I need some help with this command,I want the car to upgrade imediatly,how I should do that? Anyone could help me please?
RO:As avea si eu nevoie de un sfat! Ce-ar trebui sa fac sa-mi apara masina instant,sa nu mai necesite asteptare sau restart server? Ma poate ajuta cineva va rog?
PHP код:
enum HVInfo
{
hVehName[15],
hVehID,
hVehVIP,
}
new HouseVehicles[34][HVInfo]=
{
{"stretch", 409, 1},
{"hotknife", 434, 1},
{"bandito", 568, 1},
{"sultan", 560, 1},
{"elegy",562, 1},
{"phoenix",603, 1},
{"cheetah", 415, 1},
{"banshee",429, 1},
{"comet", 480, 1},
{"supergt", 506, 1},
{"savana", 567, 1},
{"euros",587, 1},
{"hotring",503, 1},
{"hustler", 545, 1},
{"infernus",411, 1},
{"turismo",451, 1},
{"blistacompact", 496, 0},
{"clover", 542, 0},
{"elegant", 507, 0},
{"emperor", 585, 0},
{"glendale", 466, 0},
{"greenwood", 492, 0},
{"huntley",579, 0},
{"jester", 559, 0},
{"landstalker", 400, 0},
{"merit", 551, 0},
{"nebula", 516, 0},
{"sabre",475, 0},
{"stratum",561, 0},
{"sunrise", 550, 0},
{"tahoma", 566, 0},
{"zr-350",477, 0},
{"bullet",541, 0},
{"uranus", 558, 0}
};
stock GetVehicleDetails(params[])
{
new vehid;
if(sscanf(params, "k<vehicle>", vehid))
{
return -1;
}
else
{
for(new i = 0; i<34; i++)
{
if(vehid==HouseVehicles[i][hVehID])
{
return i;
}
}
}
return -1;
}
if (strcmp(cmd, "/carupgrade", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new house = PlayerInfo[playerid][pPhousekey];
GetPlayerName(playerid, playername, sizeof(playername));
if (house != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
{
new gunid[16];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
format(string, sizeof(string), "USAGE: /carupgrade [carname]");
SendClientMessage(playerid, COLOR_GRAD2,"____________ * CAR UPGRADES *___________________________");
SendClientMessage(playerid, COLOR_WHITE,"** CAR UPGRADES Cost $100.000 **");
SendClientMessage(playerid, COLOR_GRAD2,string);
if(PlayerInfo[playerid][pLevel] >= 3)
{
SendClientMessage(playerid, COLOR_GRAD3, "Cars: Blistacompact Clover Elegant Emperor Glendale Greenwood");
SendClientMessage(playerid, COLOR_GRAD3, "Cars: Huntley Jester Landstalker Merit Nebula Sabre");
SendClientMessage(playerid, COLOR_GRAD3, "Cars: Sunrise Tahoma Uranus ZR-350 Bullet Stratum");
SendClientMessage(playerid, COLOR_GRAD3, "Donation cars: Infernus Stretch Elegy Phoenix Hotknife Turismo Bandito Sultan");
SendClientMessage(playerid, COLOR_GRAD3, "Donation cars: Cheetah Banshee Comet SuperGT Savana Euros Hotring Hustler");
}
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
return 1;
}
if(SBizzInfo[5][sbProducts] == 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
strmid(gunid, tmp, 0, strlen(cmdtext), 255);
if (GetPlayerMoney(playerid) > 100000)
{
new vMSG[200];
new vinfo=GetVehicleDetails(gunid);
if(vinfo>=0)
{
if(PlayerInfo[playerid][pDonateRank] < HouseVehicles[vinfo][hVehVIP])
{
SendClientMessage(playerid, COLOR_GREY, " Numai donatorii au acces la aceasta comanda! (/vip)");
return 1;
}
format(vMSG, sizeof(vMSG), "New Upgrade: Your House Car Is Now A %s",HouseVehicles[vinfo][hVehName]);
SendClientMessage(playerid, COLOR_GRAD6, vMSG);
HouseInfo[house][hVec] = HouseVehicles[vinfo][hVehID];
}
else
{
SendClientMessage(playerid, COLOR_GRAD6, "Unrecognized Car or Donate Rank not High enough.");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD6, "Your new car will be delivered within 24 hours! (-$100.000)");
OnPropUpdate();
GivePlayerMoney(playerid,-100000);
SBizzInfo[5][sbTill] += 100000;
ExtortionSBiz(5, 100000);
SBizzInfo[5][sbProducts]--;
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You can't afford that ($100.000)");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, " You don't own a house");
return 1;
}
return 1;
}
}
If you cant/dont want to use sscanf, for-loop and compare every VehName with params and return the "i" of which it matches