13.01.2011, 13:51
I need a command please, take a look at this:
This is from the hitman faction, a command that is used to cancel the contracts when a player is afk, and something isn't working. Can you fix it for me please?
pawn Code:
else if ((strcmp("Takehit", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("Takehit")))
{
if(PlayerInfo[playerid][pRank] < 4)
{
SendClientMessage(playerid, COLOR_GREY, "You need Rank 4 to Cancel Contracts!");
return 0;
}
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "Usage: Takehit [name/id]");
return 0;
}
//giveplayerid = strval(tmp);
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerInfo[giveplayerid][pMember] != 8)
if(PlayerInfo[giveplayerid][pLeader] != 8)
{
SendClientMessage(playerid, COLOR_GREY, "That player is not a Hitman!");
return 0;
}
if(GoChase[giveplayerid] < 999)
{
SendClientMessage(playerid, COLOR_GREY, "That Hitman is already busy with a Contract!");
return 0;
}
if(IsPlayerConnected(hitid))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giver, sizeof(giver));
GetPlayerName(hitid, giveplayer, sizeof(giveplayer));
//format(string, sizeof(string), "You canceled %s's contract to kill: %s(ID:%d), for $%d.", giver, giveplayer, hitid, PlayerInfo[hitid][pValue]);
//SendClientMessage(playerid, COLOR_YELLOW, string);
//format(string, sizeof(string), "Hitman %s has canceled your contract to kill: %s(ID:%d), for $%d.", sendername, giveplayer, hitid, PlayerInfo[hitid][pValue]);
//SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string, sizeof(string), "* Hitman %s canceled $s's contract.", sendername, giver, giveplayer, hitid, PlayerInfo[hitid][pHeadValue]);
SendFamilyMessage(8, COLOR_YELLOW, string);
GoChase[giveplayerid] = hitid;
GetChased[hitid] = giveplayerid;
GotHit[hitid] = 1;
hitid = 0;
hitfound = 0;
return 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "The Contracted Person is offline, use Contracts in the Portable again !");
return 0;
}
}
return 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "That Hitman is not Online, or ain't a Hitman!");
return 0;
}
}