SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/02/2020, 02:43 PM   #1
seventyone
Little Clucker
 
Join Date: Feb 2020
Posts: 31
Reputation: 0
Default Duplicate Object

hi, i need /duplicateobject for my script
https://pastebin.com/Fx0A7wTn
thanks
seventyone is offline   Reply With Quote
Old 19/02/2020, 07:05 PM   #2
Miqueias Barros
Gangsta
 
Miqueias Barros's Avatar
 
Join Date: May 2010
Location: Brazil 🇧🇷
Posts: 703
Reputation: 26
Default Re: Duplicate Object

what?
Miqueias Barros is offline   Reply With Quote
Old 19/02/2020, 07:08 PM   #3
seventyone
Little Clucker
 
Join Date: Feb 2020
Posts: 31
Reputation: 0
Default Re: Duplicate Object

Quote:
Originally Posted by Miqueias Barros View Post
what?

I need a command /duplicateobject

my all code is here

https://pastebin.com/Fx0A7wTn
seventyone is offline   Reply With Quote
Old 20/02/2020, 02:11 PM   #4
seventyone
Little Clucker
 
Join Date: Feb 2020
Posts: 31
Reputation: 0
Default Re: Duplicate Object

uppp
seventyone is offline   Reply With Quote
Old 20/02/2020, 04:34 PM   #5
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 622
Reputation: 57
Default Re: Duplicate Object

Quote:
Originally Posted by seventyone View Post
uppp
Just get the Object ID positions and create a new one with those information of Object ID.
SiaReyes is offline   Reply With Quote
Old 20/02/2020, 05:35 PM   #6
seventyone
Little Clucker
 
Join Date: Feb 2020
Posts: 31
Reputation: 0
Default Re: Duplicate Object

Quote:
Originally Posted by SiaReyes View Post
Just get the Object ID positions and create a new one with those information of Object ID.
can you explain me more? please
seventyone is offline   Reply With Quote
Old 21/02/2020, 06:28 PM   #7
seventyone
Little Clucker
 
Join Date: Feb 2020
Posts: 31
Reputation: 0
Default Re: Duplicate Object

upppp
seventyone is offline   Reply With Quote
Old 21/02/2020, 06:53 PM   #8
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 622
Reputation: 57
Default Re: Duplicate Object

I'm not sure, but it should be something like this
pawn Code:
CMD:duplicate(playerid, params[])
{
   
     new cloneid, bool:found=false;

     for(new i; i < MAX_COP_OBJECTS; i++) if(IsPlayerInRangeOfPoint(playerid, 5.0, CopObjectData[i][ObjX], CopObjectData[i][ObjX], CopObjectData[i][ObjX]))
     {
         found = true;
         cloneid = i;
         break;
     }
     if(!found) return  SendClientMessage(playerid, -1, "You are not near any cop object");
     if(CopObjectData[cloneid][ObjCreated]) return  SendClientMessage(playerid, -1, "Object Doesn't not exists!");

     new id = GetFreeObjectID();
     if(id == -1) return SendClientMessage(playerid, 0xE74C3CFF, "ERROR: {FFFFFF}Limited.");
     CopObjectData[id][ObjCreated] = true;

     GetPlayerName(playerid, CopObjectData[id][Owner], MAX_PLAYER_NAME);
     
     CopObjectData[id][Type] = CopObjectData[cloneid][Type];
     CopObjectData[id][ObjModel] = CopObjectData[cloneid][ObjModel];
     CopObjectData[id][ObjInterior] =  CopObjectData[cloneid][ObjInterior];
     CopObjectData[id][ObjVirtualWorld] = CopObjectData[cloneid][ObjVirtualWorld];
     CopObjectData[id][ObjX] = CopObjectData[cloneid][ObjX];
     CopObjectData[id][ObjY] = CopObjectData[cloneid][ObjY];
     CopObjectData[id][ObjZ] = CopObjectData[cloneid][ObjZ];
     CopObjectData[id][ObjRX] = CopObjectData[cloneid][ObjRX];
     CopObjectData[id][ObjRY] = CopObjectData[cloneid][ObjRY];
     CopObjectData[id][ObjRZ] = CopObjectData[cloneid][ObjRZ];
     CopObjectData[id][ObjID] = CreateDynamicObject(CopObjectData[id][ObjModel], x, y, z+2, 0.0, 0.0, a, CopObjectData[id][ObjVirtualWorld], CopObjectData[id][ObjInterior]);
     CopObjectData[id][ObjArea] = -1;
   
     new string[96];
     format(string, sizeof(string), "Police Line (ID: %d)\n{FFFFFF}Placed by %s", id, CopObjectData[id][Owner]);
     CopObjectData[id][ObjLabel] = CreateDynamic3DTextLabel(string, 0x3498DBFF, x, y, z + 0.35, 5.0, _, _, _, CopObjectData[id][ObjVirtualWorld], CopObjectData[id][ObjInterior]);
     InsertObjectToDB(id);
     return 1;

}
SiaReyes is offline   Reply With Quote
Old 22/02/2020, 10:05 AM   #9
seventyone
Little Clucker
 
Join Date: Feb 2020
Posts: 31
Reputation: 0
Default Re: Duplicate Object

Quote:
Originally Posted by SiaReyes View Post
I'm not sure, but it should be something like this
pawn Code:
CMD:duplicate(playerid, params[])
{
   
     new cloneid, bool:found=false;

     for(new i; i < MAX_COP_OBJECTS; i++) if(IsPlayerInRangeOfPoint(playerid, 5.0, CopObjectData[i][ObjX], CopObjectData[i][ObjX], CopObjectData[i][ObjX]))
     {
         found = true;
         cloneid = i;
         break;
     }
     if(!found) return  SendClientMessage(playerid, -1, "You are not near any cop object");
     if(CopObjectData[cloneid][ObjCreated]) return  SendClientMessage(playerid, -1, "Object Doesn't not exists!");

     new id = GetFreeObjectID();
     if(id == -1) return SendClientMessage(playerid, 0xE74C3CFF, "ERROR: {FFFFFF}Limited.");
     CopObjectData[id][ObjCreated] = true;

     GetPlayerName(playerid, CopObjectData[id][Owner], MAX_PLAYER_NAME);
     
     CopObjectData[id][Type] = CopObjectData[cloneid][Type];
     CopObjectData[id][ObjModel] = CopObjectData[cloneid][ObjModel];
     CopObjectData[id][ObjInterior] =  CopObjectData[cloneid][ObjInterior];
     CopObjectData[id][ObjVirtualWorld] = CopObjectData[cloneid][ObjVirtualWorld];
     CopObjectData[id][ObjX] = CopObjectData[cloneid][ObjX];
     CopObjectData[id][ObjY] = CopObjectData[cloneid][ObjY];
     CopObjectData[id][ObjZ] = CopObjectData[cloneid][ObjZ];
     CopObjectData[id][ObjRX] = CopObjectData[cloneid][ObjRX];
     CopObjectData[id][ObjRY] = CopObjectData[cloneid][ObjRY];
     CopObjectData[id][ObjRZ] = CopObjectData[cloneid][ObjRZ];
     CopObjectData[id][ObjID] = CreateDynamicObject(CopObjectData[id][ObjModel], x, y, z+2, 0.0, 0.0, a, CopObjectData[id][ObjVirtualWorld], CopObjectData[id][ObjInterior]);
     CopObjectData[id][ObjArea] = -1;
   
     new string[96];
     format(string, sizeof(string), "Police Line (ID: %d)\n{FFFFFF}Placed by %s", id, CopObjectData[id][Owner]);
     CopObjectData[id][ObjLabel] = CreateDynamic3DTextLabel(string, 0x3498DBFF, x, y, z + 0.35, 5.0, _, _, _, CopObjectData[id][ObjVirtualWorld], CopObjectData[id][ObjInterior]);
     InsertObjectToDB(id);
     return 1;

}

Thanks, but it doesn't work. In the game he says that they are not near objects
seventyone is offline   Reply With Quote
Old 24/02/2020, 07:01 PM   #10
seventyone
Little Clucker
 
Join Date: Feb 2020
Posts: 31
Reputation: 0
Default Re: Duplicate Object

upppp
seventyone is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate object Ananisiki Scripting Help 3 20/11/2015 10:42 PM
Duplicate Key! norton2 Scripting Help 13 25/09/2015 11:14 AM
[Reqeust]Command to duplicate an object. faff Scripting Help 10 15/02/2013 02:23 PM
Why there isn't rotation when I duplicate an Object from map? Soap_MacTavish Scripting Help 2 07/02/2013 10:56 AM
duplicate car leetboi Scripting Help 2 26/11/2012 07:04 PM


All times are GMT. The time now is 10:21 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.