Command Help
#1

Hello, I am trying to make a /pickup command like this:

pawn Код:
if(strcmp("/pickup", cmdtext, true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
                        if(!IsPlayerInVehicle(playerid, GetPlayerVehicleID(playerid)))
                        {
                               if(IsPlayerInRangeOfPoint(playerid, 3.0, gunobjectx, gunobjecty, gunobjectz);
                   {
                           GivePlayerWeapon(playerid, 23, 10);
                               }
                        }
                }
         }
My only problem is there is more then one gunobject how can I make it check which gun object he is standing on? Thanks
Reply
#2

You can make a gunobject for each.

like
gunobject1x //same with y and z
gunobejct2x //same with y and z
Reply
#3

The problem is it creates the object within the script so when he does /drop it creates this:

pawn Код:
new Float:gunobjectx, Float:gunobjecty, Float:gunobjectz;
GetPlayerPos(playerid, gunobjectx, gunobjecty, gunobjectz);
CreateObject(320, gunobjectx, gunobjecty, gunobjectz, 0,0,0);
So how would I do it then?
Reply
#4

Quote:
Originally Posted by Tommy_Mandaz
Посмотреть сообщение
The problem is it creates the object within the script so when he does /drop it creates this:

pawn Код:
new Float:gunobjectx, Float:gunobjecty, Float:gunobjectz;
GetPlayerPos(playerid, gunobjectx, gunobjecty, gunobjectz);
CreateObject(320, gunobjectx, gunobjecty, gunobjectz, 0,0,0);
So how would I do it then?
You could make a variable, Then use that variable to get the object id
pawn Код:
new GUN[MAX_PLAYERS]
pawn Код:
GUN[playerid] = CreateObject(320, gunobjectx, gunobjecty, gunobjectz, 0,0,0);
printf("%s",Gun[playerid]);
If i'm correct, That should return the object id. You could do a printf to see what its putting out.

Then you use what the printf put out (it prints in the server window)
pawn Код:
If(GUN[playerid] == id that printed)
{
//You would do your pickup code here
}
That would take sometime, I'm taking it this is dynamic if it is, This may not work

May i see your /drop command?
Reply
#5

Sure thing you can use it hopefully I can get the /pickup thing in though...
Reply
#6

bump
Reply
#7

Bump Help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)