enum RopeInfo { RopeID, Float: RRX, Float: RRY, Float: RRZ, }; new RopeInformation[MAX_PLAYERS][RopeInfo]; #define MAX_Reppel_Ropes 2500 new RopeObjects[MAX_Reppel_Ropes][RopeInfo]; YCMD:climbrope(playerid, params[], help) { RopeInformation[playerid][RopeID] = CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+5, 0, 0, Angle); RopeInformation[playerid][RopeID] = CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+3, 0, 0, Angle); RopeInformation[playerid][RopeID] = CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+2, 0, 0, Angle); RopeInformation[playerid][RopeID] = CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+1, 0, 0, Angle); RopeInformation[playerid][RopeID] = CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]-5, 0, 0, Angle); SetTimerEx("destroyrope",9000, false,"d",playerid); } forward destroyrope(playerid); public destroyrope(playerid) { for(new i=0;i<sizeof(RopeObjects);i++ ) { if(RopeObjects[i][RopeID] != 0) { DestroyDynamicObject(RopeObjects[i][RopeID]); DestroyDynamicObject(RopeInformation[playerid][RopeID]); } } return 1; }
enum RopeInfo { Float: RRX, Float: RRY, Float: RRZ, }; new RopeInformation[MAX_PLAYERS][RopeInfo]; YCMD:climbrope(playerid, params[], help) { SetTimerEx("destroyrope",9000, false,"ddddd", CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+5, 0, 0, Angle), CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+3, 0, 0, Angle), CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+2, 0, 0, Angle), CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+1, 0, 0, Angle), CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]-5, 0, 0, Angle) ); } forward destroyrope(obj1,obj2,obj3,obj4,obj5); public destroyrope(obj1,obj2,obj3,obj4,obj5) { DestroyDynamicObject(obj1); DestroyDynamicObject(obj2); DestroyDynamicObject(obj3); DestroyDynamicObject(obj4); DestroyDynamicObject(obj5); }
Код:
enum RopeInfo { Float: RRX, Float: RRY, Float: RRZ, }; new RopeInformation[MAX_PLAYERS][RopeInfo]; YCMD:climbrope(playerid, params[], help) { SetTimerEx("destroyrope",9000, false,"ddddd", CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+5, 0, 0, Angle), CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+3, 0, 0, Angle), CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+2, 0, 0, Angle), CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]+1, 0, 0, Angle), CreateDynamicObject(19089, RopeInformation[playerid][RRX], RopeInformation[playerid][RRY], RopeInformation[playerid][RRZ]-5, 0, 0, Angle) ); } forward destroyrope(obj1,obj2,obj3,obj4,obj5); public destroyrope(obj1,obj2,obj3,obj4,obj5) { DestroyDynamicObject(obj1); DestroyDynamicObject(obj2); DestroyDynamicObject(obj3); DestroyDynamicObject(obj4); DestroyDynamicObject(obj5); } |
Oh alright I see you have an indeterminate number of ropes which means you need some kind of control system to handle clean up. There is a few things you will need to consider.
1.) Can a player spawn multiple sets of ropes at one time? 2.) Maximum rope length? Actually storing/deleting the objectids is really easy so I mean the main issue is the way you designed it it only creates 5 ropes so that code was insufficient to do anything more than what was done. |