18.07.2015, 18:45
Hi all, I want to script a system to create objects and then any player can collect them.
So this is what I have.
With this I can create the object. But on the destroy function, it destroys the last object created, not the object where you are.
Sorry for my bad english, hope you can understand me. Thanks!!
So this is what I have.
Код:
#define MAX_MESAS 100 new mesas; enum MesasInfo { MesaID, Float:MesaX, Float:MesaY, Float:MesaZ, } new mInfo[MAX_MESAS][MesasInfo];
Код:
CMD:mesa(playerid, params[]) { if(isnull(params)) return SendClientMessage(playerid, Blanco, "USO: /mesa [Colocar | Quitar]"); else if(!strcmp(params, "colocar", true)) //this create the object { if(pInfo[playerid][TieneMesa] == 0) return SendClientMessage(playerid, Rojo, "* No tienes una mesa portбtil o ya la has colocado."); new Float: Pos[3]; GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); mInfo[mesas][MesaX] = Pos[0]; mInfo[mesas][MesaY] = Pos[1]; mInfo[mesas][MesaZ] = Pos[2]; mInfo[mesas][MesaID] = CreateDynamicObject(1594, Pos[0],Pos[1],Pos[2]-0.5, 0, 0, 0, 0); RemovePlayerAttachedObject(playerid, 1); pInfo[playerid][TieneMesa] = 0; mesas ++; SendClientMessage(playerid, Verde, "* Mesa desplegada."); } else if(!strcmp(params, "quitar", true)) //this must to destroy { new mid; for(new i; i < MAX_MESAS; i ++) { if(IsPlayerInRangeOfPoint(playerid, 2.0, mInfo[i][MesaX], mInfo[i][MesaY], mInfo[i][MesaZ])) { DestroyDynamicObject(mInfo[mid][MesaID]); SetPlayerAttachedObject(playerid,1,1210,6,0.427999,0.097999,0.072999,0.000000,-101.199989,0.000000,2.671000,1.232999,1.775999); SendClientMessage(playerid, Verde, "* Recoges la mesa y la pliegas."); pInfo[playerid][TieneMesa] = 1; } } } return 1; }
Sorry for my bad english, hope you can understand me. Thanks!!