Need advise for that cmd!
#1

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?
Reply
#2

PHP код:
enum HVInfo
{
    
hVehName[15],
    
hVehID,
    
hVehVIP,
}
new 
HouseVehicles[34][HVInfo]=
{
    {
"stretch"4091},
    {
"hotknife"4341},
    {
"bandito"5681},
    {
"sultan"5601},
    {
"elegy",5621},
    {
"phoenix",6031},
    {
"cheetah"4151},
    {
"banshee",4291},
    {
"comet"4801},
    {
"supergt"5061},
    {
"savana"5671},
    {
"euros",5871},
    {
"hotring",5031},
    {
"hustler"5451},
    {
"infernus",4111},
    {
"turismo",4511},
    {
"blistacompact"4960},
    {
"clover"5420},
    {
"elegant"5070},
    {
"emperor"5850},
    {
"glendale"4660},
    {
"greenwood"4920},
    {
"huntley",5790},
    {
"jester"5590},
    {
"landstalker"4000},
    {
"merit"5510},
    {
"nebula"5160},
    {
"sabre",4750},
    {
"stratum",5610},
    {
"sunrise"5500},
    {
"tahoma"5660},
    {
"zr-350",4770},
    {
"bullet",5410},
    {
"uranus"5580}
};
stock GetVehicleDetails(params[])
{
    new 
vehid;
    if(
sscanf(params"k<vehicle>"vehid))
    {
        return -
1;
    }
    else
    {
        for(new 
0i<34i++)
        {
            if(
vehid==HouseVehicles[i][hVehID])
            {
                return 
i;
            }
        }
    }
    return -
1;
}
if (
strcmp(cmd"/carupgrade"true) == 0)
{
    if(
IsPlayerConnected(playerid))
    {
        new 
house PlayerInfo[playerid][pPhousekey];
        
GetPlayerName(playeridplayernamesizeof(playername));
        if (
house != 255 && strcmp(playernameHouseInfo[PlayerInfo[playerid][pPhousekey]][hOwner], true) == 0)
        {
            new 
gunid[16];
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
format(stringsizeof(string), "USAGE: /carupgrade [carname]");
                
SendClientMessage(playeridCOLOR_GRAD2,"____________ * CAR UPGRADES *___________________________");
                
SendClientMessage(playeridCOLOR_WHITE,"** CAR UPGRADES Cost $100.000 **");
                
SendClientMessage(playeridCOLOR_GRAD2,string);
                if(
PlayerInfo[playerid][pLevel] >= 3)
                {
                    
SendClientMessage(playeridCOLOR_GRAD3"Cars: Blistacompact Clover Elegant Emperor Glendale Greenwood");
                    
SendClientMessage(playeridCOLOR_GRAD3"Cars: Huntley Jester Landstalker Merit Nebula Sabre");
                    
SendClientMessage(playeridCOLOR_GRAD3"Cars: Sunrise Tahoma Uranus ZR-350 Bullet Stratum");
                    
SendClientMessage(playeridCOLOR_GRAD3"Donation cars: Infernus Stretch Elegy Phoenix Hotknife Turismo Bandito Sultan");
                    
SendClientMessage(playeridCOLOR_GRAD3"Donation cars: Cheetah Banshee Comet SuperGT Savana Euros Hotring Hustler");
                }
                
SendClientMessage(playeridCOLOR_GREEN,"_______________________________________");
                return 
1;
            }
            if(
SBizzInfo[5][sbProducts] == 0)
            {
                
GameTextForPlayer(playerid"~r~Out Of Stock"50001);
                return 
1;
            }
            
strmid(gunidtmp0strlen(cmdtext), 255);
            if (
GetPlayerMoney(playerid) > 100000)
            {
                new 
vMSG[200];
                new 
vinfo=GetVehicleDetails(gunid);
                if(
vinfo>=0)
                {
                    if(
PlayerInfo[playerid][pDonateRank] < HouseVehicles[vinfo][hVehVIP])
                    {
                        
SendClientMessage(playeridCOLOR_GREY"   Numai donatorii au acces la aceasta comanda! (/vip)");
                        return 
1;
                    }
                    
format(vMSGsizeof(vMSG), "New Upgrade: Your House Car Is Now A %s",HouseVehicles[vinfo][hVehName]);
                       
SendClientMessage(playeridCOLOR_GRAD6vMSG);
                    
HouseInfo[house][hVec] = HouseVehicles[vinfo][hVehID];
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GRAD6"Unrecognized Car or Donate Rank not High enough.");
                    return 
1;
                }
                
SendClientMessage(playeridCOLOR_GRAD6"Your new car will be delivered within 24 hours! (-$100.000)");
                
OnPropUpdate();
                
GivePlayerMoney(playerid,-100000);
                
SBizzInfo[5][sbTill] += 100000;
                
ExtortionSBiz(5100000);
                
SBizzInfo[5][sbProducts]--;
                
PlayerPlaySound(giveplayerid10520.00.00.0);
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD2"  You can't afford that ($100.000)");
                return 
1;
            }
        }
        else
        {
            
SendClientMessage(playeridCOLOR_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
Reply
#3

Still same "problem"!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)