/guard - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /guard (
/showthread.php?tid=228644)
/guard -
Venice - 20.02.2011
pawn Code:
if(strcmp(cmd, "/guard", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 8)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Bodyguard!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /guard [playerid/PartOfName] [price]");
return 1;
}
new money;
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { return 1; }
money = strval(tmp);
if(money < 1 || money > 99999) { SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1, or above 99999!"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_GREY, " Cant offer protection to yourself !");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd protection to %s for $%d.", giveplayer, money);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Bodyguard %s wants to protect you for $%d, (type /accept bodyguard) to accept.", sendername, money);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
GuardOffer[giveplayerid] = playerid;
GuardPrice[giveplayerid] = money;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is offline!");
}
}
return 1;
}
Im Offer Vest Abybody hes Accept But He can\'t get 50 % Armour
No Armour Updating.Please Put A Armour Update
Re: /guard -
Marricio - 20.02.2011
what u mean
Re: /guard -
Venice - 20.02.2011
Quote:
Originally Posted by Marricio
what u mean
|
Im Offer Vest Abybody hes Accept But He can\'t get 50 % Armour
Re: /guard - [L3th4l] - 20.02.2011
Post the command:
/Accept Bodyguard
Re: /guard -
Venice - 20.02.2011
pawn Code:
else if(strcmp(x_job,"bodyguard",true) == 0)
{
if(GuardOffer[playerid] < 999)
{
if(GetPlayerMoney(playerid) > GuardPrice[playerid])
{
if(IsPlayerConnected(GuardOffer[playerid]))
{
GetPlayerName(GuardOffer[playerid], giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You accepted the Protection for $%d from Bodyguard %s.",GuardPrice[playerid],giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s accepted your Protection, and the $%d was added to your PayCheck.",sendername,GuardPrice[playerid]);
SendClientMessage(GuardOffer[playerid], COLOR_WHITE, string);
PlayerInfo[GuardOffer[playerid]][pPayCheck] += GuardPrice[playerid] * 5;
SafeGivePlayerMoney(playerid, -GuardPrice[playerid]);
GuardOffer[playerid] = 999;
GuardPrice[playerid] = 0;
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can\'t afford the Protection !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " No-one offerd you any Protection !");
return 1;
}
}
Re: /guard - [L3th4l] - 20.02.2011
Ok, so if i understood correctly, you want to give 50 armour to the guy that accepted the protection?
pawn Code:
else if(strcmp(x_job,"bodyguard",true) == 0)
{
if(GuardOffer[playerid] < 999)
{
if(GetPlayerMoney(playerid) > GuardPrice[playerid])
{
if(IsPlayerConnected(GuardOffer[playerid]))
{
GetPlayerName(GuardOffer[playerid], giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You accepted the Protection for $%d from Bodyguard %s.",GuardPrice[playerid],giveplayer);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* %s accepted your Protection, and the $%d was added to your PayCheck.",sendername,GuardPrice[playerid]);
SendClientMessage(GuardOffer[playerid], COLOR_WHITE, string);
PlayerInfo[GuardOffer[playerid]][pPayCheck] += GuardPrice[playerid] * 5;
SafeGivePlayerMoney(playerid, -GuardPrice[playerid]);
GuardOffer[playerid] = 999;
GuardPrice[playerid] = 0;
SetPlayerArmour(sendername, 50); // MAKE SURE that you change \'sendername\' to the player ID that accepted the bodyguard. I can\'t tell from this piece of code.
return 1;
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You can\'t afford the Protection !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " No-one offerd you any Protection !");
return 1;
}
}
Re: /guard -
Venice - 20.02.2011
Ohh thank you very much