SA-MP Forums Archive
/findgiftbox - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /findgiftbox (/showthread.php?tid=567148)



/findgiftbox - Trevor Gin - 11.03.2015

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;
}



AW: /findgiftbox - Kaliber - 11.03.2015

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


Re: AW: /findgiftbox - ATGOggy - 11.03.2015

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.


AW: Re: AW: /findgiftbox - Kaliber - 11.03.2015

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


Re: /findgiftbox - Trevor Gin - 11.03.2015

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);



AW: /findgiftbox - Kaliber - 11.03.2015

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


Re: /findgiftbox - Trevor Gin - 11.03.2015

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


AW: Re: /findgiftbox - Kaliber - 11.03.2015

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


Re: AW: Re: /findgiftbox - Trevor Gin - 11.03.2015

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