Guard/Armor ppl, so they have to accept it! -
Pancake - 26.04.2011
How should it work:
I am typing in an command like ((/armor ID Amount)), the id i typed in will get a client message like((My Name offers u protection for 2000$)). So the player can accept it by typing in ((/accept armor))!!
Код:
ocmd:armor(playerid,params[])
{
new pID,amount,string[128];
if(sscanf(params,"ui",pID,amount))SendClientMessage(playerid,COLOR_RED, "/armor ID Amount");
PlayerSave(pID);
format(string,sizeof(string),"%s offered you protection for %s.",Charname(playerid),amount);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
return 1;
}
this could be the offer part!! havent tested that script yet!! but how to accept??
Or how did u guys do that?
AW: Guard/Armor ppl, so they have to accept it! -
Pancake - 27.04.2011
bump
Re: Guard/Armor ppl, so they have to accept it! -
TheGarfield - 27.04.2011
pawn Код:
ocmd:armor(playerid,params[])
{
static pID,amount;.
if(sscanf(params,"ui",pID,amount)) return SendClientMessage(playerid,COLOR_RED, "/armor ID Amount");
static string[128];
SetPlayerArmour(pID, amount);
PlayerSave(pID);
format(string,sizeof(string),"%s offered you protection for %s.",Charname(playerid),amount);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
return 1;
}
I do not know "oCMD", more try
Re: Guard/Armor ppl, so they have to accept it! -
Steven82 - 27.04.2011
You may only bump every 48 hours, not 24 hours.
AW: Guard/Armor ppl, so they have to accept it! -
Pancake - 28.04.2011
Код:
ocmd:armor(playerid,params[])
{
new pID,amount,string[128];
if(sscanf(params,"ui",pID,amount))SendClientMessage(playerid,COLOR_RED, "/armor ID Amount");
format(string,sizeof(string),"%s offered you protection for %s.",Charname(playerid),amount);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
return 1;
}
I cant find the mistake in the script, but there must be one!
it should look like:
Код:
Peter_Hacking offered you protection for 2000.
but it looks like:
Whats wrong?
//PS: sry for the bump, i am used to a 24h rule.
Re: Guard/Armor ppl, so they have to accept it! -
[DM]Kane - 28.04.2011
You can code a function for it aswell.
First create a global variable (on top of script) which contains information about whether any player has requested to guard them or not.
Код:
new ArmourRequested[MAX_PLAYERS]=-1;
In your /gaurd command, add this line:
Код:
ArmourRequested[playerid]=1;
At the bottom of the script, add this function:
Код:
stock AcceptArmour(playerid, fromID, amount)
{
if(ArmourRequested[playerid]==1)
{
GivePlayerMoney(playerid, -amount);
GivePlayerMoney(fromID, amount);
SendClientMessage(playerid, COLOR, "Accepted Armour");
ArmourRequested[playerid]=0;
}
else
{
}
return 1;
}
Use this function. but not sure it will work or not :P
AW: Guard/Armor ppl, so they have to accept it! -
Pancake - 28.04.2011
I dont think thats the way to fix my problem, caus in this way the player(who got the offer), wouldnt have to write a command back to the bodyguard in order to accept.
Wasnt there a include with a callback like "OnCommandResponse" or sth.? i could use that for my /armor operation.
If someones knows bout that pls gimme the link? i searched the forum up and down for it?(maybe i am using the wrong keywords??)
But yeah, Why does the script i posted
a comment before not work?
where it should show the amount, its shows "Р" or nothing?
And thanks to all the helper till yet!
Re: Guard/Armor ppl, so they have to accept it! -
Tommy_Mandaz - 28.04.2011
Well you made this mistake you put: %s for the amount, which is a string, you need to do a %d, for the amount and keep the other %s for the name. So it would be like this:
pawn Код:
new pID,amount,string[128];
if(sscanf(params,"ui",pID,amount))SendClientMessage(playerid,COLOR_RED, "/armor ID Amount");
format(string,sizeof(string),"%s offered you protection for %d.",Charname(playerid),amount);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
Re: Guard/Armor ppl, so they have to accept it! -
[DM]Kane - 28.04.2011
Pancake, just add a command, "/accept" and add a statement AcceptArmout(playerid, fromID, amount);
But you'll have to specify who is 'fromID'. You can make a player variable for it, like pGuardfromID[MAX_PLAYERS]; and put its value in the /gaurd command.
AW: Guard/Armor ppl, so they have to accept it! -
Pancake - 29.04.2011
Could u specify the way of accepting the armor/guard?
like i said i am new to all this
And thx at tommy that was the reason for the error!