Expanding the lawyer job (RP servers) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Expanding the lawyer job (RP servers) (
/showthread.php?tid=417061)
Expanding the lawyer job (RP servers) -
Jarrett - 19.02.2013
Hey guys, I have been looking about to expand the /defend command, with this command if someone is wanted you can remove a star. I've wanted to make a command where you can only /defend a most wanted (6 stars) after 1 hour. I have some ideas but can get my finger on it. Summarize what I just said?
A player is most wanted, a lawyer cannot /defend until 1 hour or 60 minutes have passed. Any tips? Here is the code if you need it.
Код:
CMD:defend(playerid, params[])
{
if(PlayerInfo[playerid][pJob] != 2 && PlayerInfo[playerid][pJob2] != 2)
{
SendClientMessageEx(playerid, COLOR_GREY, " You are not a Lawyer!");
return 1;
}
new string[128];
if(PlayerInfo[playerid][pLawyerTime] >= 1)
{
format(string, sizeof(string), "You must wait %d seconds!", PlayerInfo[playerid][pLawyerTime]);
SendClientMessageEx(playerid, COLOR_GRAD1,string);
return 1;
}
new giveplayerid, money;
if(sscanf(params, "ud", giveplayerid, money)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /defend [playerid] [price]");
if(money < 2000 || money > 10000) { SendClientMessageEx(playerid, COLOR_GREY, " Price not lower then $2,000 or above $10,000!"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GREY, " Cant offer protection to yourself!");
return 1;
}
if(PlayerInfo[giveplayerid][pWantedLevel] > 0)
{
format(string, sizeof(string), "* You offered to defend %s for $%d.", GetPlayerNameEx(giveplayerid), money);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Lawyer %s wants to defend you for $%d, (type /accept defense) to accept.", GetPlayerNameEx(playerid), money);
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
PlayerInfo[playerid][pLawyerTime] = 60;
DefendOffer[giveplayerid] = playerid;
DefendPrice[giveplayerid] = money;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " That player is not wanted!");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
}
return 1;
}
Re: Expanding the lawyer job (RP servers) -
Jarrett - 19.02.2013
Bump
Re: Expanding the lawyer job (RP servers) -
Jarrett - 19.02.2013
Bump
Re: Expanding the lawyer job (RP servers) -
MattSlater - 19.02.2013
Okay, you do it this way..
By not using the NGRP script.