15.05.2012, 13:21
Ok Try this,this will work
And For The /recievehit
Код:
CMD:contract(playerid, params[])
{
if(PlayerCuffed[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place contracts while in cuffs.");
if(PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't place contracts while in jail.");
new string[128], giveplayerid, moneys, detail[32];
if(sscanf(params, "uds[32]", giveplayerid, moneys, detail)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /contract [playerid] [amount] [details]");
if( moneys < 50000 || moneys > 1000000)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't place contracts that are less than $50,000 or more than $1,000,000.");
return 1;
}
else if((moneys < 100000 || moneys > 1000000) && IsACop(giveplayerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "The minimum hit amount for a law enforcement officer is $100,000.");
return 1;
}
if(PlayerInfo[playerid][pLevel] < 3)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You must be level 3 to place a contract.");
return 1;
}
if(PlayerInfo[giveplayerid][pConnectTime] < 5)
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You can not place contracts on players with less than 5 playing hours.");
return 1;
}
if (IsPlayerConnected(giveplayerid))
{
if( PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pMember] == 8 )
{
SendClientMessageEx( playerid, COLOR_GREY, "You can't place contracts as a hitman." );
}
else
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if( moneys >= 1000001 )
{
SendClientMessageEx( playerid, COLOR_GREY, "The maximum contract price is $1,000,000!" );
return 1;
}
if( PlayerInfo[giveplayerid][pHeadValue] >= 1000000 )
{
SendClientMessageEx( playerid, COLOR_GREY, "That player has the maximum on their head." );
return 1;
}
if(moneys + PlayerInfo[giveplayerid][pHeadValue] >= 1000001 )
{
SendClientMessageEx( playerid, COLOR_GREY, "That player has the maximum on their head." );
return 1;
}
if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You can't contract yourself."); return 1; }
new playermoney = GetPlayerCash(playerid);
if (moneys > 0 && playermoney >= moneys)
{
if(strlen(detail) > 32) return SendClientMessageEx(playerid, COLOR_GRAD1, "Contract details may not be longer than 32 characters in length.");
GivePlayerCash(playerid, (0 - moneys));
PlayerInfo[giveplayerid][pHeadValue]+=moneys;
strmid(PlayerInfo[giveplayerid][pContractBy], GetPlayerNameEx(playerid), 0, strlen(GetPlayerNameEx(playerid)), MAX_PLAYER_NAME);
strmid(PlayerInfo[giveplayerid][pContractDetail], detail, 0, strlen(detail), 32);
format(string, sizeof(string), "%s has placed a contract on %s for $%d, details: %s.",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), moneys, detail);
SendFamilyMessage(8, COLOR_YELLOW, string);
format(string, sizeof(string), "* You placed a contract on %s for $%d, details: %s.",GetPlayerNameEx(giveplayerid), moneys, detail);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
new year, month,day;
new hour,minuite,second;
getdate(year, month, day);
gettime(hour,minuite,second);
format(string, sizeof(string), "<< %s has placed a contract on %s for $%d, details: %s (%d-%d-%d)(%d:%d) >>",GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid),moneys,detail,month,day,year,hour,minuite);
Log("logs/contracts.log", string);
format(string, sizeof(string), "%s has placed a contract on %s for $%d, details: %s.",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), moneys, detail);
ABroadCast(COLOR_YELLOW,string,4);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have enough money for this.");
}
}
}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}
Код:
CMD:recievehit(playerid, params[])
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
new string[128], targetid;
if(sscanf(params, "u", targetid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /recievehit [targetid]");
if(IsPlayerConnected(targetid))
{
if(GoChase[playerid] < 999)
{
SendClientMessageEx(playerid, COLOR_GREY, " You are already busy with another contract!");
return 1;
}
if(GotHit[targetid] == 1)
{
SendClientMessageEx(playerid, COLOR_GREY, " Another hitman has already assigned this target!");
return 1;
}
if(PlayerInfo[targetid][pHeadValue] == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, " That target doesn't have a contract on them!");
return 1;
}
format(string, sizeof(string), "* You have offered yourself a contract to kill %s. (type /accept contract)", GetPlayerNameEx(targetid));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
HitOffer[playerid] = playerid;
HitToGet[playerid] = targetid;
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " The contracted person is offline, use /contracts!");
return 1;
}
}
return 1;
}

