Jump to content
  • 0

Problema /stats /check /quitjob


GTA_SA

Question

Problema intalnita (descriere):la unii jucatori cand suntem mai multi conectati nu le mai merge comanda  /quitjob /stats si la admini nu le merge /check la acei jucatori.
Ero(area / rile) / warning-(ul / urile):-
Liniile de cod / sursa / script-ul(obligatoriu):-
Imagini / Video (optional):-
Ati incercat sa rezolvati singur?:Da

 

Code edit value param 32>64 nu merge(

stock showStats(playerid, targetid)
{
    new param1[64],param2[64],param4[64],param69[64],param59[64],param70[64],param3[64],param100[64];
    new nxtlevel = playerVariables[targetid][pLevel];
    new expamount = nxtlevel*levelexp;

    switch(playerVariables[targetid][pGender])
    {
        case 1: param2 = "Male";
        case 2: param2 = "Female";
        default: param2 = "Unknown";
    }
    new param20[182];
    if(playerVariables[targetid][pPhoneNumber] != -1)
    {
        format(param20,sizeof(param20),"%d",playerVariables[targetid][pPhoneNumber]);
    }
    else
    {
        param20 = "None";
    }
    if(playerVariables[targetid][pJob] == 0)
    {
        param1 = "Unemployed";
    }
    else
    {
        strcpy(param1, jobVariables[playerVariables[targetid][pJob]][jJobName], sizeof(param1));
     }
    SendClientMessage(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
    format(szMessage, sizeof(szMessage), "%s | Age: %d | Gender: %s | Respect points: %d/%d | Level: %d | Playing hours: %d | Phone number: %s | Job: %s",playerVariables[targetid][pNormalName],
    playerVariables[targetid]

,param2,playerVariables[targetid][pRPoints], expamount, playerVariables[targetid][pLevel], playerVariables[targetid][pPlayingHours],param20,param1);
    SendClientMessage(playerid, COLOR_WHITE, szMessage);
    if(playerVariables[targetid][pGroup] < 1)
    {
        param1 = "None";
        param2 = "None";
    }
    else
    {
        format(param1, sizeof(param1), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupName]);
        switch(playerVariables[targetid][pGroupRank])
        {
            case 1: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName1]);
            case 2: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName2]);
            case 3: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName3]);
            case 4: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName4]);
            case 5: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName5]);
            case 6: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName6]);
            case 7: format(param2, sizeof(param2), "%s", groupVariables[playerVariables[targetid][pGroup]][gGroupRankName7]);
        }
    }
    if(playerVariables[targetid][pWalkieTalkie] == -1) param3 = "None";
    else if(playerVariables[targetid][pWalkieTalkie] == 0) param3 = "Disabled";
    else format(param3, sizeof(param3), "#%d khz", playerVariables[targetid][pWalkieTalkie]);

    new donator[256];
    if(playerVariables[targetid][pDonate] == 0) donator = "No";
    else format(donator, sizeof(donator), "Yes");
    format(szMessage, sizeof(szMessage), "Group: %s | Rank: %s (%d) | Bank money: $%s | Money: $%s | Materials: %d | Radio: %s", param1, param2, playerVariables[targetid][pGroupRank], NumberFormat(playerVariables[targetid][pBankMoney]), NumberFormat(playerVariables[targetid][pMoney]), playerVariables[targetid][pMaterials], param3);
    SendClientMessage(playerid, COLOR_WHITE, szMessage);
    if(playerVariables[targetid][pGroup] == 1 || playerVariables[targetid][pGroup] == 2 || playerVariables[targetid][pGroup] == 3 || playerVariables[targetid][pGroup] == 5)
    {
        format(szMessage, sizeof(szMessage), "Credit: $%d | Warns: %d/3 | Lawer points: %d/3 | Premium: %s (%d points) | Faction warns: %d/3 | Faction punish: %d/20", playerVariables[targetid][pPhoneCredit],playerVariables[targetid][pWarns],playerVariables[targetid][pRobPoints],donator,playerVariables[targetid][pPremiumPoints],playerVariables[targetid][pFWarns],playerVariables[targetid][pFPunish]);
    }
    else
    {
        if(playerVariables[targetid][pDonate] == 1)
        {
            format(szMessage, sizeof(szMessage), "Credit: $%d | Warns: %d/3 | Rob Points: %d/8 | Premium: %s (%d points) | Faction warns: %d/3 | Faction punish: %d/20", playerVariables[targetid][pPhoneCredit],playerVariables[targetid][pWarns],playerVariables[targetid][pRobPoints],donator,playerVariables[targetid][pPremiumPoints],playerVariables[targetid][pFWarns],playerVariables[targetid][pFPunish]);
        }
        else
        {
            format(szMessage, sizeof(szMessage), "Credit: $%d | Warns: %d/3 | Rob Points: %d/10 | Premium: %s (%d points) | Faction warns: %d/3 | Faction punish: %d/20", playerVariables[targetid][pPhoneCredit],playerVariables[targetid][pWarns],playerVariables[targetid][pRobPoints],donator,playerVariables[targetid][pPremiumPoints],playerVariables[targetid][pFWarns],playerVariables[targetid][pFPunish]);
        }

    }
    SendClientMessage(playerid, COLOR_WHITE, szMessage);
    if(playerVariables[targetid][pCarModel1] >= 400)
    {
        format(param4, sizeof(param4), "%s (ID %d)", VehicleNames[playerVariables[targetid][pCarModel1] - 400], playerVariables[targetid][pCarID1]);
    }
    else
    {
        param4 = "None";
    }
    if(playerVariables[targetid][pCarModel2] >= 400)
    {
        format(param69, sizeof(param4), "%s (ID %d)", VehicleNames[playerVariables[targetid][pCarModel2] - 400], playerVariables[targetid][pCarID2]);
    }
    else
    {
        param69 = "None";
    }
    if(playerVariables[targetid][pCarModel3] >= 400)
    {
        format(param59, sizeof(param59), "%s (ID %d)", VehicleNames[playerVariables[targetid][pCarModel3] - 400], playerVariables[targetid][pCarID3]);
    }
    else
    {
        param59 = "None";
    }
    if(playerVariables[targetid][pCarModel4] >= 400)
    {
        format(param70, sizeof(param70), "%s (ID %d)", VehicleNames[playerVariables[targetid][pCarModel4] - 400], playerVariables[targetid][pCarID4]);
    }
    else
    {
        param70 = "None";
    }
    if(playerVariables[targetid][pClan] < 1)
    {
        param1 = "None";
        param100 = "None";
    }
    else
    {
        format(param1, sizeof(param1), "%s", clanVariables[playerVariables[targetid][pClan]][cClanName]);
        switch(playerVariables[targetid][pClanRank])
        {
            case 1: format(param100, sizeof(param100), "%s", clanVariables[playerVariables[targetid][pClan]][cClanRankName1]);
            case 2: format(param100, sizeof(param100), "%s", clanVariables[playerVariables[targetid][pClan]][cClanRankName2]);
            case 3: format(param100, sizeof(param100), "%s", clanVariables[playerVariables[targetid][pClan]][cClanRankName3]);
            case 4: format(param100, sizeof(param100), "%s", clanVariables[playerVariables[targetid][pClan]][cClanRankName4]);
            case 5: format(param100, sizeof(param100), "%s", clanVariables[playerVariables[targetid][pClan]][cClanRankName5]);
            case 6: format(param100, sizeof(param100), "%s", clanVariables[playerVariables[targetid][pClan]][cClanRankName6]);
            case 7: format(param100, sizeof(param100), "%s", clanVariables[playerVariables[targetid][pClan]][cClanRankName7]);
        }
    }
    format(szMessage, sizeof(szMessage), "Admin level: %d | House: %d | Business: %d | Drugs: %dg | Clan: %s | Rank: %s (%d)",playerVariables[targetid][pAdminLevel], getPlayerHouseID(targetid), getPlayerBusinessID(targetid),playerVariables[targetid][pDrugs], param1, param100,playerVariables[targetid][pClanRank]);
    SendClientMessage(playerid, COLOR_WHITE, szMessage);

    format(szMessage, sizeof(szMessage), "Vehicle 1: %s | Vehicle 2: %s | Vehicle 3: %s | Vehicle 4: %s",param4,param69,param59,param70);
    SendClientMessage(playerid, COLOR_WHITE, szMessage);

    new Float:HAFloats[2], country[MAX_COUNTRY_NAME];
    GetPlayerHealth(targetid,HAFloats[0]);
    GetPlayerArmour(targetid,HAFloats[1]);
    GetCountryName(playerVariables[targetid][pConnectionIP], country, sizeof(country));
    if(playerVariables[playerid][pAdminLevel] >= 1)
    {
        switch(playerVariables[targetid][pPrisonID])
        {
                case 0: format(szMessage, sizeof(szMessage), "IP: %s | Health: %.1f | Armour: %.1f", playerVariables[targetid][pConnectionIP],HAFloats[0], HAFloats[1]);
                case 1: format(szMessage, sizeof(szMessage), "IP: %s | Health: %.1f | Armour: %.1f | Admin Prison Time: %d", playerVariables[targetid][pConnectionIP], HAFloats[0], HAFloats[1], playerVariables[targetid][pPrisonTime]);
                case 2: format(szMessage, sizeof(szMessage), "IP: %s | Health: %.1f | Armour: %.1f | Admin Jail Time: %d", playerVariables[targetid][pConnectionIP], HAFloats[0], HAFloats[1], playerVariables[targetid][pPrisonTime]);
                case 3: format(szMessage, sizeof(szMessage), "IP: %s | Health: %.1f | Armour: %.1f | Jail Time: %d", playerVariables[targetid][pConnectionIP], HAFloats[0], HAFloats[1], playerVariables[targetid][pPrisonTime]);
        }
        SendClientMessage(playerid, COLOR_TEAL, szMessage);
    }
    SCM(playerid, COLOR_TEAL, "--------------------------------------------------------------------------------------------------------------------------------");
    return 1;
}

CMD:check(playerid,params[])
{
    if(playerVariables[playerid][pAdminLevel] >= 1 || playerVariables[playerid][pHelper] >= 2) {

        new
            targetid;

        if(sscanf(params, "u", targetid))
            return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/check [playerid]");

        if(playerVariables[targetid][pStatus] < 1)
            return SendClientMessage(playerid, COLOR_GREY, "The specified player ID is either not connected or has not authenticated.");


        showStats(playerid, targetid);
    }
    else return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
    return 1;
}

 

Quitjob

CMD:quitjob(playerid, params[])
{
        new string[128];
        if(playerVariables[playerid][pJob] >= 1)
        {
            format(string, sizeof(string), "You have quit your job (%s).", jobVariables[playerVariables[playerid][pJob]][jJobName]);
            SendClientMessage(playerid, COLOR_WHITE, string);
            playerVariables[playerid][pJob] = 0;
        }
        return 1;
}
Edited by GTA_SA
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
if (strcmp(cmd, "/check", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /check [playerid/PartOfName]");
return 1;
}
//giveplayerid = strval(tmp);
           giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
   if(giveplayerid != INVALID_PLAYER_ID)
   {
ShowStats(playerid,giveplayerid);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   No Such Player");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   You are not an admin");
}
}
return 1;
}
if(strcmp(cmd, "/quitjob", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	   	{
		    if(PlayerInfo[playerid][pJob] > 0)
		    {
		        if(PlayerInfo[playerid][pDonateRank] > 0)
		        {
		            if(PlayerInfo[playerid][pContractTime] >= 0)
					{
					    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You already forfilled your 1 hour Contract, and quited your Job.");
					    PlayerInfo[playerid][pJob] = 0;
					    PlayerInfo[playerid][pChar] = 0;
					    PlayerInfo[playerid][pContractTime] = 0;
					}
					else
					{
					    new chours = 2 - PlayerInfo[playerid][pContractTime];
					    format(string, sizeof(string), "* You still have %d hours left to forfill and end your Contract.", chours / 2);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					}
		        }
		        else
		        {
					if(PlayerInfo[playerid][pContractTime] >= 5)
					{
					    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You already forfilled your 1 hour Contract, and quited your Job.");
					    PlayerInfo[playerid][pJob] = 0;
					    PlayerInfo[playerid][pChar] = 0;
					    PlayerInfo[playerid][pContractTime] = 0;
					}
					else
					{
					    new chours = 5 - PlayerInfo[playerid][pContractTime];
					    format(string, sizeof(string), "* You still have %d hours left to forfill and end your Contract.", chours / 2);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You don't even have a Job !");
			}
		}//not connected
		return 1;
	}
Edited by Jupiter
Link to comment
Share on other sites

  • 0
if (strcmp(cmd, "/check", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /check [playerid/PartOfName]");
return 1;
}
//giveplayerid = strval(tmp);
           giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
   if(giveplayerid != INVALID_PLAYER_ID)
   {
ShowStats(playerid,giveplayerid);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   No Such Player");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   You are not an admin");
}
}
return 1;
}
if(strcmp(cmd, "/quitjob", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	   	{
		    if(PlayerInfo[playerid][pJob] > 0)
		    {
		        if(PlayerInfo[playerid][pDonateRank] > 0)
		        {
		            if(PlayerInfo[playerid][pContractTime] >= 0)
					{
					    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You already forfilled your 1 hour Contract, and quited your Job.");
					    PlayerInfo[playerid][pJob] = 0;
					    PlayerInfo[playerid][pChar] = 0;
					    PlayerInfo[playerid][pContractTime] = 0;
					}
					else
					{
					    new chours = 2 - PlayerInfo[playerid][pContractTime];
					    format(string, sizeof(string), "* You still have %d hours left to forfill and end your Contract.", chours / 2);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					}
		        }
		        else
		        {
					if(PlayerInfo[playerid][pContractTime] >= 5)
					{
					    SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You already forfilled your 1 hour Contract, and quited your Job.");
					    PlayerInfo[playerid][pJob] = 0;
					    PlayerInfo[playerid][pChar] = 0;
					    PlayerInfo[playerid][pContractTime] = 0;
					}
					else
					{
					    new chours = 5 - PlayerInfo[playerid][pContractTime];
					    format(string, sizeof(string), "* You still have %d hours left to forfill and end your Contract.", chours / 2);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You don't even have a Job !");
			}
		}//not connected
		return 1;
	}

? -___- Copy/paste

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.