Arrest Point
#1

Hello,

I wanna ask how to create arrest points.
My current scripts
Код:
CMD:arrestpoint(playerid, params[])
{
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
   	if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
   	if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
	GetPlayerPos(playerid, ap[0], ap[1], ap[2]);
	DestroyDynamic3DTextLabel(apt);
	DestroyPickup(apt2);
	apt = CreateDynamic3DTextLabel("Arrest Point\n{FFFF00}/arrest to arrest a suspect", COLOR_RED, ap[0], ap[1], ap[2], 12);
	apt2 = CreatePickup(1314, 1, ap[0], ap[1], ap[2]);
	SendClientMessage(playerid, COLOR_WHITE, " You have changed the NYPD's arrest point.");
	return 1;
}
It can only create one arrest point.
Can someone help me?
Reply
#2

Can someone help me?
Reply
#3

Not when you bump after less than an hour. Be patient.
Reply
#4

Check these lines:

pawn Код:
DestroyDynamic3DTextLabel(apt);
    DestroyPickup(apt2);
    apt = CreateDynamic3DTextLabel("Arrest Point\n{FFFF00}/arrest to arrest a suspect", COLOR_RED, ap[0], ap[1], ap[2], 12);
    apt2 = CreatePickup(1314, 1, ap[0], ap[1], ap[2]);
You are destroying the previously created text label and pickup when you write the command again. That's why you are able to create only one point. If you delete these lines;

pawn Код:
DestroyDynamic3DTextLabel(apt);
    DestroyPickup(apt2);
You will be able to create multiple points - however, you must be able to destroy something that you've created later. Because of that, I suggest you to script something like this;

pawn Код:
#define MAX_ARREST_POINTS 30 // Defining maximum arrest points.
new ArrestPoints[1][MAX_ARREST_POINTS]; // Creating our variable to store IDs, in case of you need to delete them.
new ArrestPointCount; // To keep how many arrest points have been created.
CMD:arrestpoint(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
        if(ArrestPointCount == MAX_ARREST_POINTS) return SendClientMessage(playerid, COLOR_GREY, "Arrest point limit has been filled!");
    GetPlayerPos(playerid, ap[0], ap[1], ap[2]);
    ArrestPoints[0][ArrestPointCount] = CreateDynamic3DTextLabel("Arrest Point\n{FFFF00}/arrest to arrest a suspect", COLOR_RED, ap[0], ap[1], ap[2], 12);
    ArrestPoints[1][ArrestPointCount] = CreatePickup(1314, 1, ap[0], ap[1], ap[2]);
    SendClientMessage(playerid, COLOR_WHITE, " You have changed the NYPD's arrest point.");
        ArrestPointCount++;
    return 1;
}
The code above is just for giving the idea.
Reply
#5

Lemme try, thanks before

___________________________________


warning 203: symbol is never used: "ArrestPointCount"
warning 203: symbol is never used: "ArrestPoints"
warning 204: symbol is assigned a value that is never used: "apt"
warning 204: symbol is assigned a value that is never used: "apt2"

4 warns, how to fix that?
Reply
#6

Quote:
Originally Posted by Latisha
Посмотреть сообщение
Lemme try, thanks before

___________________________________


warning 203: symbol is never used: "ArrestPointCount"
warning 203: symbol is never used: "ArrestPoints"
warning 204: symbol is assigned a value that is never used: "apt"
warning 204: symbol is assigned a value that is never used: "apt2"

4 warns, how to fix that?
Did you copy the code I've written or what? Delete "apt" and "apt2" variables from the script.

EDIT: Also replace

pawn Код:
new ArrestPointCount;
with

pawn Код:
new ArrestPointCount = 0;
Reply
#7

I have to delete this?
Код:
apt = CreateDynamic3DTextLabel("Arrest Point\n{FFFF00}/arrest to arrest a suspect", COLOR_RED, ap[0], ap[1], ap[2], 12);
apt2 = CreatePickup(1314, 1, ap[0], ap[1], ap[2]);
Reply
#8

Quote:
Originally Posted by Latisha
Посмотреть сообщение
I have to delete this?
Код:
apt = CreateDynamic3DTextLabel("Arrest Point\n{FFFF00}/arrest to arrest a suspect", COLOR_RED, ap[0], ap[1], ap[2], 12);
apt2 = CreatePickup(1314, 1, ap[0], ap[1], ap[2]);
I have already explained the code above. If you want to check if it works, just delete your whole "CMD:arrestpoint" lines and replace with mine.
Reply
#9

warning 213: tag mismatch
error 032: array index out of bounds (variable "ArrestPoints")
warning 204: symbol is assigned a value that is never used: "apt"
warning 204: symbol is assigned a value that is never used: "apt2"

I used your scripts
Reply
#10

Quote:
Originally Posted by Latisha
Посмотреть сообщение
warning 213: tag mismatch
error 032: array index out of bounds (variable "ArrestPoints")
warning 204: symbol is assigned a value that is never used: "apt"
warning 204: symbol is assigned a value that is never used: "apt2"

I used your scripts
Ooops, my bad. I didn't notice the mistake I've made, sorry. Use this:

pawn Код:
#define MAX_ARREST_POINTS 30 // Defining maximum arrest points.
new ArrestPoints[MAX_ARREST_POINTS]; // Creating our variable to store IDs, in case of you need to delete them.
new Text3D:ArrestPointText[MAX_ARREST_POINTS];
new ArrestPointCount; // To keep how many arrest points have been created.
CMD:arrestpoint(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty.");
        if(ArrestPointCount == MAX_ARREST_POINTS) return SendClientMessage(playerid, COLOR_GREY, "Arrest point limit has been filled!");
    GetPlayerPos(playerid, ap[0], ap[1], ap[2]);
    ArrestPointText[ArrestPointCount] = CreateDynamic3DTextLabel("Arrest Point\n{FFFF00}/arrest to arrest a suspect", COLOR_RED, ap[0], ap[1], ap[2], 12);
    ArrestPoints[ArrestPointCount] = CreatePickup(1314, 1, ap[0], ap[1], ap[2]);
    SendClientMessage(playerid, COLOR_WHITE, " You have changed the NYPD's arrest point.");
        ArrestPointCount++;
    return 1;
}
Also, press CTRL-F in the program you use to edit your script and search for "apt" and "apt2". Then delete them.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)