SA-MP Forums Archive
Max vehicles a player can own - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Max vehicles a player can own (/showthread.php?tid=611344)



Max vehicles a player can own - NealPeteros - 05.07.2016

Hi, guys! I was looking for a function/variable in my script that defines how much vehicles a player can own. So far, I haven't seen one yet. I really need help. Any help will be appreciated and be rewarded a reputation for trying.


Re: Max vehicles a player can own - Rdx - 05.07.2016

How we can find it without your code?


Re: Max vehicles a player can own - NealPeteros - 05.07.2016

Forgot to add "Please tell me what part of the script you need so that it can guide you". Sorry, my mistake


Re: Max vehicles a player can own - Rdx - 05.07.2016

Maybe command with list of player vehicles, or enum/array of player vehicles.


Re: Max vehicles a player can own - NealPeteros - 05.07.2016

What exactly? /stats?


Re: Max vehicles a player can own - Eymeric69 - 05.07.2016

Neal, in your code there is 45000 lines + 1000(i have created for the new faction) i have search a lot but i've not found i think it's illimited.


Re: Max vehicles a player can own - NealPeteros - 05.07.2016

What do you mean by "illimited"? Anyways, we need all the help we can get. Here's my /stats command
pawn Код:
CMD:stats(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command.");
    ShowStats(playerid, playerid);
    return 1;
}
My "stock ShowStats"
pawn Код:
stock ShowStats(playerid, playerb)
{
    new string[256], gender[8], Float:H, Float:A;
    // Gender
    if(PlayerInfo[playerb][pGender] == 1) format(gender, sizeof(gender), "Male");
    else if(PlayerInfo[playerb][pGender] == 2) format(gender, sizeof(gender), "Female");
    // Health and Armor
    GetPlayerHealth(playerb, H); GetPlayerArmour(playerb, A);
    // Total Wealth
    //new idx = PlayerInfo[playerb][pHouse];
    //new idx2 = PlayerInfo[playerb][pBiz];
    //new TotalWealth = PlayerInfo[playerb][pMoney]+PlayerInfo[playerb][pBank]+HouseInfo[idx][hMoney]+BizInfo[idx2][bMoney];
    // Loyal
    new loyal[4];
    if(!PlayerInfo[playerb][pLoyal]) format(loyal, sizeof(loyal), "Yes");
    if(PlayerInfo[playerb][pLoyal]) format(loyal, sizeof(loyal), "No");
    // Oldskool
    new oldskool[4];
    if(PlayerInfo[playerid][pHours] >= 248) format(oldskool, sizeof(oldskool), "Yes");
    else if(PlayerInfo[playerid][pHours] < 248) format(oldskool, sizeof(oldskool), "No");
    //fac-fam rank
    new rank[128];
    if(PlayerInfo[playerb][pFac] >= 1) format(rank, sizeof(rank), "%s", RPFRN(playerb));
    else if(PlayerInfo[playerb][pFam] >=1) format(rank, sizeof(rank), "%s", RPFaRN(playerb));
    else format(rank, sizeof(rank), "None");
    //fac-fam
    new org[128];
    if(PlayerInfo[playerb][pFac] >= 1) format(org, sizeof(org), "%s", RPFNEx(playerb));
    else if(PlayerInfo[playerb][pFam] >=1) format(org, sizeof(org), "%s", RPFaN(playerb));
    else format(org, sizeof(org), "None");
    //
    new exp = PlayerInfo[playerb][pExp];
    new nxtlevel = PlayerInfo[playerb][pLevel]+1;
    new expamount = nxtlevel*4;
    /*//respect
    new respectneed[4];
    if(PlayerInfo[playerb][pLevel] == 1) format(respectneed, sizeof(respectneed), "4");
    else if(PlayerInfo[playerb][pLevel] == 2) format(respectneed, sizeof(respectneed), "10");
    else if(PlayerInfo[playerb][pLevel] == 3) format(respectneed, sizeof(respectneed), "18");
    else if(PlayerInfo[playerb][pLevel] == 4) format(respectneed, sizeof(respectneed), "30");
    else if(PlayerInfo[playerb][pLevel] == 5) format(respectneed, sizeof(respectneed), "42");
    else if(PlayerInfo[playerb][pLevel] == 6) format(respectneed, sizeof(respectneed), "54");
    else if(PlayerInfo[playerb][pLevel] == 7) format(respectneed, sizeof(respectneed), "70");
    else if(PlayerInfo[playerb][pLevel] == 8) format(respectneed, sizeof(respectneed), "88");
    else if(PlayerInfo[playerb][pLevel] == 9) format(respectneed, sizeof(respectneed), "108");
    else if(PlayerInfo[playerb][pLevel] == 10) format(respectneed, sizeof(respectneed), "130");
    else if(PlayerInfo[playerb][pLevel] == 11) format(respectneed, sizeof(respectneed), "154");
    else if(PlayerInfo[playerb][pLevel] == 12) format(respectneed, sizeof(respectneed), "180");
    else if(PlayerInfo[playerb][pLevel] == 13) format(respectneed, sizeof(respectneed), "208");
    else if(PlayerInfo[playerb][pLevel] == 14) format(respectneed, sizeof(respectneed), "238");
    else if(PlayerInfo[playerb][pLevel] == 15) format(respectneed, sizeof(respectneed), "270");
    else if(PlayerInfo[playerb][pLevel] == 16) format(respectneed, sizeof(respectneed), "304");
    else if(PlayerInfo[playerb][pLevel] == 17) format(respectneed, sizeof(respectneed), "340");
    else if(PlayerInfo[playerb][pLevel] == 18) format(respectneed, sizeof(respectneed), "378");
    else if(PlayerInfo[playerb][pLevel] == 19) format(respectneed, sizeof(respectneed), "418");
    else if(PlayerInfo[playerb][pLevel] == 20) format(respectneed, sizeof(respectneed), "460");
    else if(PlayerInfo[playerb][pLevel] == 21) format(respectneed, sizeof(respectneed), "504");
    else if(PlayerInfo[playerb][pLevel] == 22) format(respectneed, sizeof(respectneed), "550");
    else if(PlayerInfo[playerb][pLevel] == 23) format(respectneed, sizeof(respectneed), "598");
    else if(PlayerInfo[playerb][pLevel] == 24) format(respectneed, sizeof(respectneed), "648");
    else if(PlayerInfo[playerb][pLevel] == 25) format(respectneed, sizeof(respectneed), "700");
    else if(PlayerInfo[playerb][pLevel] == 26) format(respectneed, sizeof(respectneed), "754");
    else if(PlayerInfo[playerb][pLevel] == 27) format(respectneed, sizeof(respectneed), "810");
    else if(PlayerInfo[playerb][pLevel] == 28) format(respectneed, sizeof(respectneed), "868");
    else if(PlayerInfo[playerb][pLevel] == 29) format(respectneed, sizeof(respectneed), "928");*/

    //new average = (PlayerInfo[playerb][pTMinutes] / PlayerInfo[playerb][pDay]);
    // Stats
    format(string, sizeof(string), " Statistics of %s", RPN(playerb));
    SendClientMessage(playerid, COLOR_ORANGE, string);
    format(string, sizeof(string), "Level: [%d] - Gender: [%s] - Age: [%d] - Money: [$%d] - Bank: [$%d] - Health: [%0.1f] - Armor: [%0.1f]", PlayerInfo[playerb][pLevel], gender, PlayerInfo[playerb][pAge], PlayerInfo[playerb][pMoney], PlayerInfo[playerb][pBank], H, A);
    SendClientMessage(playerid, COLOR_LIGHTRED, string);
    format(string, sizeof(string), "Phone Number: [%d] - Playing Hours: [%d] Next Level: [%d/%d] - Respect Points: [%d]", PlayerInfo[playerb][pNumber], PlayerInfo[playerb][pHours], exp, expamount, PlayerInfo[playerb][pExp]);
    SendClientMessage(playerid, COLOR_LIGHTRED, string);
    format(string, sizeof(string), "Occupation: [%s] - Wanted Level: [%d] - Crimes Committed: [%d] - Arrested: [%dx] - Kill: [%d] - Death: [%d]", RPJN(playerb), PlayerInfo[playerb][pWanted], PlayerInfo[playerb][pCrimes], PlayerInfo[playerb][pArrested], PlayerInfo[playerb][pKill], PlayerInfo[playerb][pDeath]);
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, sizeof(string), "Gas Can: [%d litres] - Materials: [%d]- Weed: [%d] - Cocaine: [%d] - Cigarettes: [%d] - Sprays: [%d] - Ropes: [%d] - Blindfolds: [%d]", PlayerInfo[playerb][pGas], PlayerInfo[playerb][pMaterials], PlayerInfo[playerb][pWeed], PlayerInfo[playerb][pcocaine], PlayerInfo[playerb][pCigar], PlayerInfo[playerb][pSpray], PlayerInfo[playerb][pRope], PlayerInfo[playerb][pBlindfold]);
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, sizeof(string), "Organization: [%s] - Rank: [%s] - Gates: 1[ID %s] - 2[ID %s] - 3[ID %s] - VIP:[%s]", org, rank, RPGAK1(playerb), RPGAK2(playerb), RPGAK3(playerb), RPVIPN(playerb));
    SendClientMessage(playerid, COLOR_RADIO, string);
    format(string, sizeof(string), "Job 1: [%s] - Job 2: [%s]", JOBN(playerb), VJOBN(playerb));
    SendClientMessage(playerid, COLOR_RADIO, string);
    format(string, sizeof(string), "Business: [%s] - Business: 2 [%s] House: [%s] - Garage: [%s] - Vehicles: 1[%s (ID:%d) - 2[%s (ID:%d)]", RBT(PlayerInfo[playerb][pBiz]), RBT(PlayerInfo[playerb][pVBiz]), RPHK(playerb), RPGK(playerb), RVN(GetVehicleModel(PlayerInfo[playerb][pVeh])), PlayerInfo[playerb][pVeh], RVN(GetVehicleModel(PlayerInfo[playerb][pVVeh])), PlayerInfo[playerb][pVVeh]);
    SendClientMessage(playerid, COLOR_RADIO, string);
    return 1;
}



Re: Max vehicles a player can own - Dayrion - 05.07.2016

Something like that should work
PHP код:
PlayerInfo[MAX_PLAYERS][pVehicle1]
PlayerInfo[MAX_PLAYERS][pVehicle2]
... 



Re: Max vehicles a player can own - NealPeteros - 05.07.2016

This is my full PlayerInfo variable
PHP код:
// User settings
enum pInfo
{
    
// Temp Values
    
pLoggedIn,
    
pSpawn,
    
// Permanent Values
    
pIP[16],
    
pOwner,
    
pLevel,
    
pArmorUpgrade,
    
pUpgradePoints,
    
pMinutes,
    
pTMinutes,
    
pHours,
    
pGender,
    
pAge,
    
pMoney,
    
pBank,
    
pModel,
    
pAdmin,
    
pOldAdmin,
    
pMapper,
    
pBanned,
    
Float:pX,
    
Float:pY,
    
Float:pZ,
    
pInt,
    
pVW,
    
pVehVW,
    
pWalkStyle,
    
pNeon,
    
pVNeon,
    
pTGun[2],
    
pTGunAmmo[2],
    
pvTGun[2],
    
pvTGunAmmo[2],
    
pFac,
    
pFacRank,
    
pFacLeader,
    
pWeapon[13],
    
pWeaponAmmo[13],
    
pHospital,
    
pFacDuty,
    
pFacDiv,
    
pFacDivLeader,
    
pBiz,
    
pVBiz,
    
pHouse,
    
pVHouse,
    
pGarage,
    
pVGarage,
    
pJob,
    
pJobSkill[MAX_JOBS],
    
pJackSkill,
    
pTPackages,
    
pMPackages,
    
pDPackages,
    
pMaterials,
    
pMMaterials,
    
pMMPackages,
    
pHMaterials,
    
pHPackages,
    
pWeed,
    
pcocaine,
    
pTWeed,
    
pTcocaine,
    
pvTWeed,
    
pvTcocaine,
    
pHasCellphone,
    
pCellphone,
    
pMask,
    
pMasked,
    
pMaskID,
    
pSeatbelt,
    
pPhonebook,
    
pDice,
    
pCigar,
    
pSpeedo,
    
pSprunk,
    
pSpray,
    
pRope,
    
pBlindfold,
    
pWT,
    
pWTC,
    
pGas,
    
pRadio,
    
Float:pHealth,
    
Float:pArmor,
    
pInternet,
    
pPrison,
    
pPrisonTime,
    
pPrisonReason[64],
    
pPrisonBy[32],
    
pWanted,
    
pWanted1[64],
    
pWanted2[64],
    
pWanted3[64],
    
pWanted4[64],
    
pWanted5[64],
    
pWanted6[64],
    
pCrimes,
    
pArrested,
    
pContract,
    
pContractBy[32],
    
pTutorial,
    
pWarns,
    
pWarn1[64],
    
pWarn2[64],
    
pWarn3[64],
    
pFlag[65],
    
pNMute,
    
pRMute,
    
pADMute,
    
pSpawnFreeze,
    
pFam,
    
pFamRank,
    
pCSuccess,
    
pCFail,
    
pDeath,
    
pDead,
    
pDied,
    
pKill,
    
pHelper,
    
pExp,
    
pVeh,
    
pBugged,
    
pNumber,
    
vModel,
    
Float:vX,
    
Float:vY,
    
Float:vZ,
    
Float:vA,
    
vC1,
    
vC2,
    
vPJ,
    
pVehMod[14],
    
vLocked,
    
pGangMod,
    
pFacMod,
    
pBanAppealer,
    
pCarLic,
    
pFlyLic,
    
pWepLic,
    
pAccent[16],
    
pDay,
    
// VIP
    
pVIP,
    
pVIPDay,
    
pVIPMonth,
    
pVIPHour,
    
pVIPTemp,
    
// VIP Job
    
pVIPJob,
    
// VIP Car
    
pVVeh,
    
vVModel,
    
Float:vVX,
    
Float:vVY,
    
Float:vVZ,
    
Float:vVA,
    
vVC1,
    
vVC2,
    
vVPJ,
    
pVVehMod[14],
    
vVLocked,
    
pVIPBuddy,
    
pDeliverTruck,
    
pNew,
    
pRefPoints,
    
pTester,
    
pFightStyle,
    
pRun,
    
pScope,
    
pCookies,
    
pOldskool,
    
// Toys
    
pToyModel[10],
    
Float:pToyX[10],
    
Float:pToyY[10],
    
Float:pToyZ[10],
    
Float:pToyRX[10],
    
Float:pToyRY[10],
    
Float:pToyRZ[10],
     
Float:pToySX[10],
    
Float:pToySY[10],
    
Float:pToySZ[10],
    
pReward,
    
pFish[5],
    
pLoyal,
    
pLoyalTag,
    
pLPoints,
    
pStoned,
    
pGate[3],
    
pSafeAdmin,
    
pAsshole,
    
pHunger
}
new 
PlayerInfo[MAX_PLAYERS][pInfo]; 
In my opinion, I think this is the code needed:
PHP код:
    vC1,
    
vC2



Re: Max vehicles a player can own - NealPeteros - 05.07.2016

But I still need help on how to make it more to 8 slots.