/findgiftbox
#1

How I can add zone to this cmd? like Giftbox is Placed at [location name]


Код:
CMD:findgiftbox(playerid, params[])
{
    if(CheckPointCheck(playerid))
	{
        SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
        return 1;
    }
	if(dynamicgift != 0)
	{
		new Float:Position[3];
		GetDynamicObjectPos(dynamicgift, Position[0], Position[1], Position[2]);
		SendClientMessageEx(playerid, COLOR_BLUE, " The giftbox is placed at [I NEED ZONE HERE]");
		SetPlayerCheckpoint(playerid, Position[0], Position[1], Position[2], 5.0);
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_BLUE, "Giftbox not placed yet");
	}
	return 1;
}
Reply
#2

Take only the Array & enum from this: http://pastebin.com/f68e1a6ad

And then write the command like this:

Код:
CMD:findgiftbox(playerid, params[])
{
    if(CheckPointCheck(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
    if(!dynamicgift) return SendClientMessageEx(playerid, COLOR_BLUE, "Giftbox not placed yet");
    new Float:Position[3],string[64];
    GetDynamicObjectPos(dynamicgift, Position[0], Position[1], Position[2]);
    for(new i = 0; i != sizeof(gSAZones); i++ ) {
        if(Position[0] >= gSAZones[i][SAZONE_AREA][0] && Position[0] <= gSAZones[i][SAZONE_AREA][3] && Position[1] >= gSAZones[i][SAZONE_AREA][1] && Position[1] <= gSAZones[i][SAZONE_AREA][4])
        {
            format(string, 64, gSAZones[i][SAZONE_NAME], 0);
            break;
        }
    }
    format(string,sizeof string," The giftbox is placed at %s",string);
    SendClientMessage(playerid, COLOR_BLUE, string);
    SetPlayerCheckpoint(playerid, Position[0], Position[1], Position[2], 5.0);
    return 1;
}
Greekz
Reply
#3

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Take only the Array & enum from this: http://pastebin.com/f68e1a6ad

And then write the command like this:

Код:
CMD:findgiftbox(playerid, params[])
{
    if(CheckPointCheck(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
    if(!dynamicgift) return SendClientMessageEx(playerid, COLOR_BLUE, "Giftbox not placed yet");
    new Float:Position[3],string[64];
    GetDynamicObjectPos(dynamicgift, Position[0], Position[1], Position[2]);
    for(new i = 0; i != sizeof(gSAZones); i++ ) {
        if(Position[0] >= gSAZones[i][SAZONE_AREA][0] && Position[0] <= gSAZones[i][SAZONE_AREA][3] && Position[1] >= gSAZones[i][SAZONE_AREA][1] && Position[1] <= gSAZones[i][SAZONE_AREA][4])
        {
            format(string, 64, gSAZones[i][SAZONE_NAME], 0);
            break;
        }
    }
    format(string,sizeof string," The giftbox is placed at %s",string);
    SendClientMessage(playerid, COLOR_BLUE, string);
    SetPlayerCheckpoint(playerid, Position[0], Position[1], Position[2], 5.0);
    return 1;
}
Greekz
We need to get the giftbox's location, not the player's.
Reply
#4

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
We need to get the giftbox's location, not the player's.
You watched too fast...i edited my post
Reply
#5

Ty works, but look http://prntscr.com/6fgcbi the massage not showing full
Код:
format(string,sizeof string," The giftbox is at %s we have set checkpoint to the location of the giftbox! Go to it",string);
Reply
#6

Yes you made the string too long

Look at this line:

Код:
new Float:Position[3],string[64];
Write it like this:

Код:
new Float:Position[3],string[128];
Greekz
Reply
#7

Yeah, mate when i do /findgiftbox it's giving my zone location not the giftbox maybe becuase I didnt add Array & enum from this http://pastebin.com/f68e1a6ad

give me the codes what to add sorry for wasting your time
Reply
#8

Quote:
Originally Posted by ShadeWalker
Посмотреть сообщение
Yeah, mate when i do /findgiftbox it's giving my zone location
Thats impossible, when you used my Code...

This Code snippet you should copy: http://pastebin.com/whqXgF9y
Reply
#9

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Thats impossible, when you used my Code...

This Code snippet you should copy: http://pastebin.com/whqXgF9y
ERROR, Please if You have skype add me rojeh.najjar1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)