17.02.2015, 15:47
test
PHP код:
COMMAND:bribe(playerid, params[])
{
if (PlayerInfo[playerid][pDead] == 0)
{
if (PlayerInfo[playerid][pTeam] == TEAM_CIVILIAN && PlayerInfo[playerid][pVigilante] == 0)
{
new idx,amount,string[256],tmp[256];
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
tmp = strtok(params, idx);
if (!strlen(tmp))
{
amount = 15000;
}
else
{
if (!isNumeric(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "Invalid Amount - Enter A Numerical Character.");
return 1;
}
amount = strval(tmp);
}
//permissions durring doing missions needed.
if (amount > 15000 || amount < 1000)
{
format(string, sizeof(string), "Invalid Amount $%d - Minimum Bribe : $1000 Maximum Bribe: $15000",amount);
SendClientMessage(playerid,COLOR_ERROR, string);
return 1;
}
if (PlayerInfo[playerid][pWantedLevel] > 8)
{
SendClientMessage(playerid,COLOR_ERROR, "You Are On The List Of Most Wanted Suspects. You Cannot Bribe The Police.");
return 1;
}
if (PlayerInfo[playerid][pBribeWaitTime] > 0)
{
SendClientMessage(playerid, COLOR_ERROR, "Please Wait Before Offering Another Bribe.");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (PlayerInfo[i][pSkill] != SKILL_COP && PlayerInfo[playerid][pVigilante] == 0)
{
format(string, sizeof(string), "%s Is Not A Police Officer.",PlayerInfo[TargetId][pName]);
SendClientMessage(playerid,COLOR_ERROR, string);
return 1;
}
if(IsPlayerInRangeOfPoint(i, 3.0, x,y,z))
{
format(string, sizeof(string), "You Have Offered Officer %s (%d) A Bribe ($%d). Wait To See If %s Will Accept.",PlayerInfo[i][pName],i,amount,SubjectGenderPronouns[PlayerInfo[i][pGender]]);
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, string);
format(string, sizeof(string), "~w~BRIBE OFFERED TO OFFICER %s", PlayerInfo[i][pName]);
SendGameText(playerid, string, 3000, 3);
format(string, sizeof(string), "%s (%d) Has Offered You A Bribe ($%d). Type /accept Or /refuse.",PlayerInfo[playerid][pName],playerid,amount);
SendClientMessage(i,COLOR_SERVER_HELP_MSG, string);
format(string, sizeof(string), "~w~OFFERED A BRIBE BY %s~n~[$%d]~n~~y~TYPE /ACCEPT OR /REFUSE", PlayerInfo[playerid][pName],amount);
SendGameText(i, string, 3000, 3);
PlayerInfo[playerid][pBribe] = amount;
PlayerInfo[playerid][pBribeWaitTime] = 30;
PlayerInfo[playerid][pBribeOfferedTo] = i;
PlayerInfo[i][pBribeOfferedBy] = playerid;
}
}
}
else
SendClientMessage(playerid, COLOR_ERROR, "Only Civilians Can Use This Command.");
}
else
SendErrorMessage(playerid, 3);
return 1;
}