Help to fix my problem
#1

Hi these cods for hitman's contract


PHP код:
    if(strcmp(cmd"/contract"true) == 0)
    {
        if(
PINFO[playerid][pMember] == || PINFO[playerid][pLeader] == 8) return SCM(playerid,COLOR_ALI,"You can't use contract when you are a hitman agent.");
        if(
PINFO[playerid][pLevel] < 3) return SCM(playerid,COL_SYN,"You need to have higher than 3 level to place a contract.");
        
tmp strtok(cmdtext,idx);
        if(!
strlen(tmp)) return SCM(playerid,COL_SYN,"Syntax: /contract <PlayerID/PartOfName> <Prize>");
        new 
taraf ReturnUser(tmp);
        if(!
IsPlayerConnected(taraf)) return SCM(playerid,COLOR_ALI,"That player is offline.");
        if(
PINFO[taraf][pMember] == || PINFO[taraf][pLeader] == 8) return SCM(playerid,COLOR_ALI,"You cannot contract a hitman agent.");
        
tmp strtok(cmdtext,idx);
        if(!
strlen(tmp)) return SCM(playerid,COL_SYN,"Syntax: /contract <PlayerID/PartOfName> <Prize>");
        new 
prize strval(tmp);
        if(
prize 500 || prize 10000) return SCM(playerid,COLOR_ALI,"Type a Prize number between $500 and $10,000");
        if(
prize GetPlayerPool(playerid)) return SCM(playerid,COLOR_ALI,"You haven't this cash.");
        if(
prize 3500 && gTeam[taraf] == TEAM_COP) return SCM(playerid,COLOR_ALI,"The cash to contract a cop must be higher than $3,500.");
        
GivePlayerPool(playerid,-prize);
        if(
PINFO[taraf][pHeadValue] <= 0)
        {
            
ContractsCount ++;
            
ContractID[taraf] = ReturnContractID();
            
ContractIDUsed[ReturnContractID()] = true;
            
AgentHiterID[taraf] = INVALID_PLAYER_ID;
        }
        
PINFO[taraf][pHeadValue] += prize;
        
SaveKonVal(taraf"pHeadValue"PINFO[taraf][pHeadValue]);
        
SCM(playerid,COLOR_ALI,"Player get contracted successfully.");
        return 
1;
    } 
with this code any body can contract a person for any times they can i need i cod for example i want contract some one i do it but if i want contract that person again i cant do it since after 24 hour or 12 hour.


thanks
Reply
#2

Is this what you're talking about?

Код:
new ContractWait[MAX_PLAYERS]; // at the top of your script

if(strcmp(cmd, "/contract", true) == 0)
    {
    	if(GetTickCount() - ContractWait[playerid] < 1000*60*12)
		{
			SendClientMessage(playerid, COLOR_RED, "Please wait before contracting again.");
			return 1;
		}
        if(PINFO[playerid][pMember] == 8 || PINFO[playerid][pLeader] == 8) return SCM(playerid,COLOR_ALI,"You can't use contract when you are a hitman agent.");
        if(PINFO[playerid][pLevel] < 3) return SCM(playerid,COL_SYN,"You need to have higher than 3 level to place a contract.");
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SCM(playerid,COL_SYN,"Syntax: /contract <PlayerID/PartOfName> <Prize>");
        new taraf = ReturnUser(tmp);
        if(!IsPlayerConnected(taraf)) return SCM(playerid,COLOR_ALI,"That player is offline.");
        if(PINFO[taraf][pMember] == 8 || PINFO[taraf][pLeader] == 8) return SCM(playerid,COLOR_ALI,"You cannot contract a hitman agent.");
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SCM(playerid,COL_SYN,"Syntax: /contract <PlayerID/PartOfName> <Prize>");
        new prize = strval(tmp);
        if(prize < 500 || prize > 10000) return SCM(playerid,COLOR_ALI,"Type a Prize number between $500 and $10,000");
        if(prize > GetPlayerPool(playerid)) return SCM(playerid,COLOR_ALI,"You haven't this cash.");
        if(prize < 3500 && gTeam[taraf] == TEAM_COP) return SCM(playerid,COLOR_ALI,"The cash to contract a cop must be higher than $3,500.");
        GivePlayerPool(playerid,-prize);
        if(PINFO[taraf][pHeadValue] <= 0)
        {
            ContractsCount ++;
            ContractID[taraf] = ReturnContractID();
            ContractIDUsed[ReturnContractID()] = true;
            AgentHiterID[taraf] = INVALID_PLAYER_ID;
        }
        PINFO[taraf][pHeadValue] += prize;
        SaveKonVal(taraf, "pHeadValue", PINFO[taraf][pHeadValue]);
        SCM(playerid,COLOR_ALI,"Player get contracted successfully.");
        ContractWait[playerid] = GetTickCount();
        return 1;
    }
12 in-game hours or real hours?

replace
Код:
ContractWait[playerid] < 1000*60*12
with
Код:
ContractWait[playerid] < 1000*60*720
for 12 real hours or any amount
Reply
#3

Quote:
Originally Posted by Nubik
Посмотреть сообщение
Is this what you're talking about?

Код:
new ContractWait[MAX_PLAYERS]; // at the top of your script

if(strcmp(cmd, "/contract", true) == 0)
    {
    	if(GetTickCount() - ContractWait[playerid] < 1000*60*12)
		{
			SendClientMessage(playerid, COLOR_RED, "Please wait before contracting again.");
			return 1;
		}
        if(PINFO[playerid][pMember] == 8 || PINFO[playerid][pLeader] == 8) return SCM(playerid,COLOR_ALI,"You can't use contract when you are a hitman agent.");
        if(PINFO[playerid][pLevel] < 3) return SCM(playerid,COL_SYN,"You need to have higher than 3 level to place a contract.");
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SCM(playerid,COL_SYN,"Syntax: /contract <PlayerID/PartOfName> <Prize>");
        new taraf = ReturnUser(tmp);
        if(!IsPlayerConnected(taraf)) return SCM(playerid,COLOR_ALI,"That player is offline.");
        if(PINFO[taraf][pMember] == 8 || PINFO[taraf][pLeader] == 8) return SCM(playerid,COLOR_ALI,"You cannot contract a hitman agent.");
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SCM(playerid,COL_SYN,"Syntax: /contract <PlayerID/PartOfName> <Prize>");
        new prize = strval(tmp);
        if(prize < 500 || prize > 10000) return SCM(playerid,COLOR_ALI,"Type a Prize number between $500 and $10,000");
        if(prize > GetPlayerPool(playerid)) return SCM(playerid,COLOR_ALI,"You haven't this cash.");
        if(prize < 3500 && gTeam[taraf] == TEAM_COP) return SCM(playerid,COLOR_ALI,"The cash to contract a cop must be higher than $3,500.");
        GivePlayerPool(playerid,-prize);
        if(PINFO[taraf][pHeadValue] <= 0)
        {
            ContractsCount ++;
            ContractID[taraf] = ReturnContractID();
            ContractIDUsed[ReturnContractID()] = true;
            AgentHiterID[taraf] = INVALID_PLAYER_ID;
        }
        PINFO[taraf][pHeadValue] += prize;
        SaveKonVal(taraf, "pHeadValue", PINFO[taraf][pHeadValue]);
        SCM(playerid,COLOR_ALI,"Player get contracted successfully.");
        ContractWait[playerid] = GetTickCount();
        return 1;
    }
12 in-game hours or real hours?

replace
Код:
ContractWait[playerid] < 1000*60*12
with
Код:
ContractWait[playerid] < 1000*60*720
for 12 real hours or any amount
thanks i do it now but not working
Reply
#4

any body cant help me?
Reply
#5

Can you tell me what you want so i can fix your code.
Reply
#6

Quote:
Originally Posted by Nubik
Посмотреть сообщение
Is this what you're talking about?

Код:
new ContractWait[MAX_PLAYERS]; // at the top of your script

if(strcmp(cmd, "/contract", true) == 0)
    {
    	if(GetTickCount() - ContractWait[playerid] < 1000*60*12)
		{
			SendClientMessage(playerid, COLOR_RED, "Please wait before contracting again.");
			return 1;
		}
        if(PINFO[playerid][pMember] == 8 || PINFO[playerid][pLeader] == 8) return SCM(playerid,COLOR_ALI,"You can't use contract when you are a hitman agent.");
        if(PINFO[playerid][pLevel] < 3) return SCM(playerid,COL_SYN,"You need to have higher than 3 level to place a contract.");
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SCM(playerid,COL_SYN,"Syntax: /contract <PlayerID/PartOfName> <Prize>");
        new taraf = ReturnUser(tmp);
        if(!IsPlayerConnected(taraf)) return SCM(playerid,COLOR_ALI,"That player is offline.");
        if(PINFO[taraf][pMember] == 8 || PINFO[taraf][pLeader] == 8) return SCM(playerid,COLOR_ALI,"You cannot contract a hitman agent.");
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SCM(playerid,COL_SYN,"Syntax: /contract <PlayerID/PartOfName> <Prize>");
        new prize = strval(tmp);
        if(prize < 500 || prize > 10000) return SCM(playerid,COLOR_ALI,"Type a Prize number between $500 and $10,000");
        if(prize > GetPlayerPool(playerid)) return SCM(playerid,COLOR_ALI,"You haven't this cash.");
        if(prize < 3500 && gTeam[taraf] == TEAM_COP) return SCM(playerid,COLOR_ALI,"The cash to contract a cop must be higher than $3,500.");
        GivePlayerPool(playerid,-prize);
        if(PINFO[taraf][pHeadValue] <= 0)
        {
            ContractsCount ++;
            ContractID[taraf] = ReturnContractID();
            ContractIDUsed[ReturnContractID()] = true;
            AgentHiterID[taraf] = INVALID_PLAYER_ID;
        }
        PINFO[taraf][pHeadValue] += prize;
        SaveKonVal(taraf, "pHeadValue", PINFO[taraf][pHeadValue]);
        SCM(playerid,COLOR_ALI,"Player get contracted successfully.");
        ContractWait[playerid] = GetTickCount();
        return 1;
    }
12 in-game hours or real hours?

replace
Код:
ContractWait[playerid] < 1000*60*12
with
Код:
ContractWait[playerid] < 1000*60*720
for 12 real hours or any amount
Quote:
Originally Posted by Kinglee
Посмотреть сообщение
Can you tell me what you want so i can fix your code.
i say who want contract a person and do it right but if he want contract that person again not working since after 12 hour
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)