OnPlayerCommandText problem
#1

So here is my code
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/tune", cmdtext, true, 10) == 0)
	{
 		if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
 		{
			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
			CarmodDialog(playerid);
			return 1;
		}
		else SendClientMessage(playerid,RED,"You must be in a vehicle to open this dialog!");
	}
	return 0;
}
Can anybody help me cause i got an errors
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/tune", cmdtext, true, 5) == 0)
    {
        if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                CarmodDialog(playerid);
            }
            else
            {
                SendClientMessage(playerid, RED, "You must be in a vehicle to open this dialog!");
            }
        }
        return 1;
    }
    return 0;
}
Reply
#3

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/tune", cmdtext, true, 5) == 0)
    {
        if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                CarmodDialog(playerid);
            }
            else
            {
                SendClientMessage(playerid, RED, "You must be in a vehicle to open this dialog!");
            }
        }
        return 1;
    }
    return 0;
}
Thanks for helping but now the command (dialog) not showing , here is the original cmd and enum
Код:
enum pInfo
{
	pKey[131],
	pLevel,
	pAdmin,
	pDonateRank,
	gPupgrade,
	pConnectTime,
	pReg,
	pSex,
	pAge,
	pOrigin,
	pCK,
	pCash,
	pHospital,
	pMuted,
	pPrisonReason[128],
	pPrisonedBy[MAX_PLAYER_NAME],
	pFlag[128],
	pRMuted,
	pRMutedTotal,
	pRMutedTime,
	pVMuted,
	pVMutedTime,
	pFactionModerator,
	pGangModerator,
	pExp,
	pAccount,
	pCrimes,
	pPaintTeam,
	pKills,
	pDeaths,
	pArrested,
	pWantedDeaths,
	pPhoneBook,
	pLottoNr,
	pFishes,
	pToggedVIPChat,
	pBiggestFish,
	pJob,
	pAutoTextReply[64],
	pPhonePrivacy,
	pJob2,
	pNMute,
	pNMuteTotal,
	pAmute,
	pAmuteTotal,
	pADMute,
	pADMuteTotal,
	pOOCMute,
	pOOCMuteTotal,
	pCMute,
	pHelpMute,
	pPayCheck,
	pHeadValue,
	pJailed,
	pJailTime,
	pWRestricted,
	pMats,
	pPackages,
	pGM,
	pLeader,
	pMember,
	pDivision,
	pFMember,
	pSpeakerPhone,
	pRank,
	pChar,
	pStreetRep,
	pRepHandOut,
	pDetSkill,
	pSexSkill,
	pBoxSkill,
	pLawSkill,
	pMechSkill,
	pJackSkill,
	pCarSkill,
	pTruckSkill,
	pGarbageSkill,
	pUtilSkill,
	pWantedLevel,
	pGunSkill,
	p9mmSkill,
	pSilencedSkill,
	pDeagleSkill,
	pShotgunSkill,
	pSawnoffSkill,
	pSpasSkill,
	pUziSkill,
	pMp5Skill,
	pAKSkill,
	pM4Skill,
	pGoods,
	pSMats,
	pPot,
	pHeroin,
	pCrack,
	pMeth,
	pSDrugs,
	pMInsure,
	pPcarkey,
	pPcarkey2,
	pPcarkey3,
	pBadgeNumber,
	pRoadblock,
	pHelper,
	pNewsSkill,
	pDrugsSkill,
	pArmsSkill,
	pSmugSkill,
	pCookSkill,
	pFishSkill,
	Float:pHealth,
	Float:pArmor,
	Float:pSArmor,
	Float:pSHealth,
	pInt,
	pLocal,
	pTeam,
	pModel,
	pPnumber,
	pPhousekey,
	pPhousekey2,
	Float:pPos_x,
	Float:pPos_y,
	Float:pPos_z,
	Float:pPos_r,
	pCarLic,
	pCarLicP,
	pFlyLic,
	pBoatLic,
	pFishLic,
	pGunLic,
	pWeedLic,
	pCDLic,
	pGuns[12],
	pAGuns[12],
	pGunAmmo[12],
	pCarTime,
	pPayDay,
	pPayDayHad,
	pCDPlayer,
	pWins,
	pLoses,
	pAlcoholPerk,
	pDrugPerk,
	pMiserPerk,
	pPainPerk,
	pTraderPerk,
	pTut,
	pWarns,
	pLWarns,
	pRPSkill,
	pAdjustable,
	pMarried,
	pC4,
	pC4Get,
	pC4Used,
	pMarriedTo[128],
	pLock,
	pLockCar,
	pSprunk,
	pCigar,
	pPole,
	pSpraycan,
	pRope,
	pRag,
	pFuelCan,
	pDice,
	pBombs,
	pDuty,
	pFightStyle,
	pIP[32],
	pBanned,
	pPermaBanned,
	pDisabled,
	pAccent,
	pCHits,
	pFHits,
	pCrates,
	pVW,
	pHouseInvite,
	pClothes,
	pRenting,
	pVehicles,
	pVehFile,
	pVehActive,
	pType1,
	pTempVIP,
	pBuddyInvited,
	pVIPInviteDay,
	pTokens,
	pPaintTokens,
	pType2,
	pType3,
	pType4,
	pType5,
	pDrugsTime,
	pLawyerTime,
	pGangWarn,
	pFactionBanned,
	pCSFBanned,
	pMechTime,
	pSexTime,
	pLawyerFreeTime,
	pGiftTime,
	pRobTime,
	pWepTime,
	pContractBy[32],
	pContractDetail[64],
	pBanAppealer,
 	pShopTech,
        pUndercover,
	pTogReports,
	pRadio,
	pRadioFreq,
	pDutyHours,
	pAcceptedHelp,
	pAcceptReport,
	pTrashReport,
	pInsurance,
	pTriageTime,
	pVehicleKeys,
	pVehicleKeysFrom,
	pTaxiLicense,
	pTicketTime,
	pScrewdriver,
	pSmslog,
	pSmslog0[256],
	pSmslog1[256],
	pSmslog2[256],
	pSmslog3[256],
	pSmslog4[256],
	pSmslog5[256],
	pSmslog6[256],
	pSmslog7[256],
	pSmslog8[256],
	pSmslog9[256],
	pKillLog0[256],
	pKillLog1[256],
	pKillLog2[256],
	pKillLog3[256],
	pKillLog4[256],
	pKillLog5[256],
	pKillLog6[256],
	pKillLog7[256],
	pKillLog8[256],
	pKillLog9[256],
	pVmsg1[256],
	pVmsg2[256],
	pVmsg3[256],
	pVmsg4[256],
	pVmsg5[256],
	pVnum1[256],
	pVnum2[256],
	pVnum3[256],
	pVnum4[256],
	pVnum5[256],
	pWristwatch,
	pSurveillance,
	pTire,
	pFirstaid,
	pRccam,
	pReceiver,
	pGPS,
	pSweep,
	pSweepLeft,
	pBugged,
	pCheckCash,
	pChecks,
	pWExists,
	Float:pWX,
	Float:pWY,
	Float:pWZ,
	pWVW,
	pWInt,
	pWValue,
	pWObject,
	pWTimer,
	pWSeeds,
	pRawOpium,
	pSyringe,
	pWarrant[128],
	pJudgeJailTime,
	pJudgeJailType,
	pBeingSentenced,
	pProbationTime,
	pVehMods,
	pCarInsurance,
	pDMIndicators,
	pDMReport0[63],
	pDMReport1[63],
	pDMReport2[63],
	pDMReport3[63],
	pDMReport4[63],
	pDMReport5[63],
	pDMReport6[63],
	pDMReport7[63],
	pDMReport8[63],
	pDMReport9[63],
	pDMKills,
	pOrder,
	pOBlocked,
	pCallsAccepted,
	pPatientsDelivered,
	pLiveBanned,
	pFreezeBank,
	pServiceTime,
	pDispatch,
	pDispatchOn,
	pATCCert,
	pATCOn,
	pRobbingStore,
	pRobbingBank,
	pRobbingPaloBank,
	pRobbingSFBank,
	pRobbingLARecord,
	pRobbingLADonut,
	pRobbingFCBank,
	pRobbingCCBank,
	pRobbingLAPigpen,
	pRobbingLAIdlewood,
	pRobbingLAKFC,
	pRobbingBBGas,
	pRobbingBBDennys,
	pRobbingAPBarber,
	pRobbingLVNEGas,
	pRobbingLVSGas,
	pRobbingLVCoffee,
	pReceivedSpeedTicket,
	pSpeedTix,
	pSpeedoOn,
	pRefuel,
	pHasStereo,
	pTogRadio,
	pPSPlaying,
	pLoadCash,
	pHasGPS,
	pJackingCar,
	pHasCarJack,
	pJackAttempts,
	pUnListed,
	pAcceptID,
	pJustLogged,
	pLegalTruckJob1,
	pLegalTruckJob2,
	pLegalTruckJob3,
	pIllegalTruckJob1,
	pIllegalTruckJob2,
	pIllegalTruckJob3,
	pTruckingLevel,
	pTruckingXP,
	pReportsAccepted,
	pAMSSent,
	Text3D:aMeID,
	aMeStatus,
	pBadgeNum,
	pFLAttached,
	pTLAttached,
 	pEntered,
	pTogSpeedo,
	pTollBoothCharge,
	pAtTollBooth,
	pEmail[63],
	p911sAccepted,
	pArrestsMade,
	pInfractionsIssued,
	pOverdose,
	pNeededHeroin,
	pNeededPot,
	pNeededCrack,
	pNeededMeth,
	pColdMeds,
	pBatteryAcid,
	pCrackStuff,
	pMoonshine,
	p40ounce,
	pZipPot,
	pZipHeroin,
	pZipCrack,
	pZip,
	pCase,
	pCasecash,
	pLoggedIn,
	pLoginTime,
	pEnrolledEZPass,
	pPayedToll,
	pStatch[256],
	pChopShopped,
	pDeported,
	pAMuteTime[128],
	pCMuteTime[128],
	pAdMuteTime[128],
	pNMuteTime[128],
	pDeportTime[128],
	pOOCMuteTime[128]
};
new PlayerInfo[MAX_PLAYERS+1][pInfo];
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/tune", cmdtext, true, 10) == 0)
	{
	    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
			CarmodDialog(playerid);
			return 1;
		}
		else SendClientMessage(playerid,RED,"You must be in a vehicle to open this dialog!");
	}
	return 0;
}}
Reply
#4

Show CarmodDialog(playerid) function.
Reply
#5

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
Show CarmodDialog(playerid) function.
Like this? But still not showing
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/tune", cmdtext, true, 5) == 0)
    {
        if(PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                ShowPlayerDialog(playerid,1111,DIALOG_STYLE_LIST,"Select things to put in your car","Nitro\nWheels\nStereo\nHydraulics\nCar Components","Select","Cancel");
            }
            else
            {
                SendClientMessage(playerid, RED, "You must be in a vehicle to open this dialog!");
            }
        }
        return 1;
    }
    return 0;
}
Reply
#6

It's not showing because player isn't PlayerInfo[playerid][pMember] == 14 Or PlayerInfo[playerid][pLeader] == 14.
Reply
#7

Quote:
Originally Posted by ]Rafaellos[
Посмотреть сообщение
It's not showing because player isn't PlayerInfo[playerid][pMember] == 14 Or PlayerInfo[playerid][pLeader] == 14.
I'm the member and the leader of faction 14 but still not showing
Reply
#8

We should guess what is the errors? bring them here.
Reply
#9

Quote:
Originally Posted by DemME
Посмотреть сообщение
We should guess what is the errors? bring them here.
I want that cmd only can used by the leader or member of faction number 14 here is the default code
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/tune", cmdtext, true, 10) == 0)
	{
	    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
			CarmodDialog(playerid);
			return 1;
		}
		else SendClientMessage(playerid,RED,"You must be in a vehicle to open this dialog!");
	}
	return 0;
}
public OnRconCommand(cmd[])
{
	return 1;
}
Reply
#10

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/tune", cmdtext, true))
    {
        if(PlayerInfo[playerid][pMember] != 14 && PlayerInfo[playerid][pLeader] != 14) return SendClientMessage(playerid, RED, "You are not a leader or member of the correct group.");
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) ShowPlayerDialog(playerid,1111,DIALOG_STYLE_LIST,"Select things to put in your car","Nitro\nWheels\nStereo\nHydraulics\nCar Components","Select","Cancel");
        else SendClientMessage(playerid, RED, "You must be in a vehicle to open this dialog!");
        return 1;
    }
    return 0;
}
See if you get any messages.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)