30.09.2013, 18:23
pawn Код:
CMD:find(playerid, params[]) {
if(PlayerInfo[playerid][pJob] != 1 && PlayerInfo[playerid][pJob2] != 1) {
SendClientMessage(playerid, COLOR_GREY, "You're not a detective.");
}
else if(UsedFind[playerid]) {
SendClientMessage(playerid, COLOR_GREY, "You've already searched for someone - wait a little.");
}
else {
new
iTargetID;
if(sscanf(params, "u", iTargetID)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /find [playerid/partofname]");
}
else if(iTargetID == playerid) {
SendClientMessage(playerid, COLOR_GREY, "You can't use this command on yourself.");
}
else if(!IsPlayerConnected(iTargetID)) {
SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
}
else if(GetPlayerInterior(iTargetID) != 0) {
SendClientMessage(playerid, COLOR_GREY, "That person is inside an interior.");
}
else if(PlayerInfo[iTargetID][pAdmin] >= 1 && AdminDuty[iTargetID] == 1) {
SendClientMessage(playerid, COLOR_GREY, "You're unable to find this person.");
}
else {
switch(PlayerInfo[playerid][pDetSkill]) {
case 0 .. 50: {
FindTimePoints[playerid] = 4;
UsedFind[playerid] = 120;
}
case 51 .. 100: {
FindTimePoints[playerid] = 6;
UsedFind[playerid] = 90;
}
case 101 .. 200: {
FindTimePoints[playerid] = 8;
UsedFind[playerid] = 60;
}
case 201 .. 400: {
FindTimePoints[playerid] = 10;
UsedFind[playerid] = 30;
}
default: {
FindTimePoints[playerid] = 12;
UsedFind[playerid] = 15;
}
}
new
szZone[MAX_ZONE_NAME],
szMessage[108];
SetPlayerMarkerForPlayer(playerid, iTargetID, FIND_COLOR);
GetPlayer3DZone(iTargetID, szZone, sizeof(szZone));
format(szMessage, sizeof(szMessage), "%s has been last seen at %s.", GetPlayerNameEx(iTargetID), szZone);
SendClientMessage(playerid, COLOR_GRAD2, szMessage);
FindingPlayer[playerid]=iTargetID;
FindTime[playerid] = 1;
#if defined DOUBLE_EXP_ENABLED
new hour,minuite,second;
gettime(hour,minuite,second);
if(DoubleEXPcheck(hour))
{
PlayerInfo[playerid][pDetSkill] += 2;
SendClientMessage(playerid, COLOR_YELLOW, "* You have gained two skill points for this job due to double experience.");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "* You have only gained one skill point for this job since it's not within the double experience hours.");
PlayerInfo[playerid][pDetSkill]++;
}
#else
PlayerInfo[playerid][pDetSkill]++;
#endif
switch(PlayerInfo[playerid][pDetSkill]) {
case 50: SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 2, you can find a little faster.");
case 100: SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 3, you can find a little faster.");
case 200: SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 4, you can find a little faster.");
case 400: SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 5, you can find a little faster.");
}
}
}
return 1;
}