Knife from kitchen HELP -
Bluebay - 18.03.2011
Hello!
I need a script to a position given, you can take a knife in the kitchen drawer.
/knifeout command gives you a knife,
To me this is a RolePlay server should, therefore, for example, that if I should write
* Name took a knife from the drawer.
Thank you very much for your help.
I apologize for the bad translation, I used ****** translator for help.
Re: Knife from kitchen HELP -
Rivera - 18.03.2011
Umm... I think I can script it tomorrow, but I need your kitchen's coordinates. If you can post them here I can help ya'
Re: Knife from kitchen HELP -
admantis - 18.03.2011
I can do it in two minutes if you say your kitchen coordinates.
Re: Knife from kitchen HELP -
Rivera - 18.03.2011
Quote:
I can do it in two minutes if you say your kitchen coordinates.
|
ofc... but I dunno if he can find his kitchen's coordinates, he is a newbie!
Re: Knife from kitchen HELP -
austin070 - 18.03.2011
pawn Код:
if(strcmp(cmdtext, "/knifeout", true, 9)== 0)
{
if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z) // substitute x, y, and z with your kitchen's coordinates.
{
new str[128], name[24];
GetPlayerName(playerid, name, sizeof(name))
format(str, sizeof(str), "* %s takes a knife from the drawer.", name)
SendClientMessageToAll(0xFFFF00AA, str); //0xFFFF00 is yellow. change to whatever you want.
GivePlayerWeapon(playerid, 4, 0);
}
return 1;
}
Re: Knife from kitchen HELP -
Biesmen - 18.03.2011
Example:
Somewhere in your script:
pawn Код:
stock MeMessage(color, string[])
{
new Float:x, Float:y, Float:z;
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, x, y, z);
if(IsPlayerInRangeOfPoint(i, x, y, z, 10.0))
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
The command, at OnPlayerCommandText
Make a command, like /knifeout, then check if the player who types /knifeout is located at the coordinates if your kitchen,
if he's near the kitchen then make it send this message:
pawn Код:
new string[128], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "* %s took a knife from the drawer", playername);
MeMessage(COLOR_WHITE, string);
Not tested, not sure if it works.
Re: Knife from kitchen HELP -
admantis - 18.03.2011
Quote:
Originally Posted by Biesmen
Example:
Somewhere in your script:
pawn Код:
stock MeMessage(color, string[]) { new Float:x, Float:y, Float:z; for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { GetPlayerPos(i, x, y, z);
if(IsPlayerInRangeOfPoint(i, x, y, z, 10.0)) { SendClientMessage(i, color, string); } } } return 1; }
The command, at OnPlayerCommandText
Make a command, like /knifeout, then check if the player who types /knifeout is located at the coordinates if your kitchen,
if he's near the kitchen then make it send this message:
pawn Код:
new string[128], playername[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername, sizeof(playername)); format(string, sizeof(string), "* %s took a knife from the drawer", playername); MeMessage(COLOR_WHITE, string);
Not tested, not sure if it works.
|
IsPlayerInRange is bad implemented. The second parameter is the range, not the Float X, and the last one is Float Z. Just pointing it out.
Re: Knife from kitchen HELP -
Bluebay - 18.03.2011
This is the kitchen koordinates: 1260.3025,-796.0180,1084.2344,180 (X,Y,Z)
So? What is the good code?
And thanks for helping
Re: Knife from kitchen HELP -
austin070 - 18.03.2011
pawn Код:
if(strcmp(cmdtext, "/knifeout", true, 9)== 0)
{
if(IsPlayerInRangeOfPoint(playerid, 5, 1260.3025,-796.0180,1084.2344,180)
{
new str[128], name[24];
GetPlayerName(playerid, name, sizeof(name))
format(str, sizeof(str), "* %s takes a knife from the drawer.", name)
SendClientMessageToAll(0xFFFF00AA, str); //0xFFFF00 is yellow. change to whatever you want.
GivePlayerWeapon(playerid, 4, 0);
}
return 1;
}
Should work.
Re: Knife from kitchen HELP -
Biesmen - 18.03.2011
Quote:
Originally Posted by admantis
IsPlayerInRange is bad implemented. The second parameter is the range, not the Float X, and the last one is Float Z. Just pointing it out.
|
Used to PlayerToPoint :P. Thanks for correcting me.