Knife from kitchen HELP
#1

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.
Reply
#2

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'
Reply
#3

I can do it in two minutes if you say your kitchen coordinates.
Reply
#4

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!
Reply
#5

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;
}
Reply
#6

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.
Reply
#7

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.
Reply
#8

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
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)