Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GetNextSanitaryTrashPos(playerid) {
- new
- trashid = INVALID_TRASH_ID,
- trashGEID[UUID_LEN],
- itemid = INVALID_ITEM_ID,
- containerid = INVALID_CONTAINER_ID,
- Float:x, Float:y, Float:z, Float:pX, Float:pY, Float:pZ,
- Float:currentPos;
- GetPlayerPos(playerid, pX, pY, pZ);
- foreach(new i : trash_Index) {
- if(IsValidTrash(i)) {
- GetTrashItemGEID(i, trashGEID);
- itemid = GetItemFromGEID(trashGEID);
- if(IsValidItem(itemid)) {
- printf("GetNextSanitaryTrashPos itemid : %d", itemid);
- printf("GetNextSanitaryTrashPos sanTrash_LastTrashItem : %d", sanitaryTrash_Data[playerid][sanTrash_LastTrashItem]);
- // On vérifie que la poubelle à vider n'est pas la même que celle qu'on vient de vider
- // if(itemid != sanitaryTrash_Data[playerid][sanTrash_LastTrashItem]) {
- if(!Iter_Contains(sanTrash_List<playerid>, i)) {
- GetItemPos(itemid, x, y, z);
- // Vérifier la position (prendre la poubelle la plus proche)
- printf("Distance(x, y, z, pX, pY, pZ) : %f", Distance(x, y, z, pX, pY, pZ));
- printf("currentPos : %f", currentPos);
- if(currentPos < Distance(x, y, z, pX, pY, pZ)) {
- containerid = GetTrashItemContainerID(itemid);
- if(IsValidContainer(containerid)) {
- // Si la poubelle n'est pas vide
- if(GetContainerItemCount(containerid) > 0) {
- trashid = i;
- break;
- }
- }
- }
- currentPos = Distance(x, y, z, pX, pY, pZ);
- }
- }
- }
- }
- return trashid;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement